]> granicus.if.org Git - clang/commitdiff
Migrate 'PrettySTackTraceParserEntry' object out of Parser, and have it constructed...
authorTed Kremenek <kremenek@apple.com>
Tue, 22 Mar 2011 01:15:17 +0000 (01:15 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 22 Mar 2011 01:15:17 +0000 (01:15 +0000)
during crash recovery.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128056 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Parse/Parser.h
lib/Parse/ParseAST.cpp
lib/Parse/Parser.cpp

index b9af05e58f1c1d7fe4064a84436e2d23b3da7e67..d07f605270f6c07f08ff66e2a269f054f86f1558 100644 (file)
@@ -76,7 +76,6 @@ class Parser : public CodeCompletionHandler {
   friend class ColonProtectionRAIIObject;
   friend class InMessageExpressionRAIIObject;
   friend class ParenBraceBracketBalancer;
-  PrettyStackTraceParserEntry CrashInfo;
 
   Preprocessor &PP;
 
index bca0fa7ba501f1475a3537be961bdb74a512f73f..21917b23ffb6a92cfc016ac2a6889fc50dd6db2f 100644 (file)
@@ -45,9 +45,7 @@ void clang::ParseAST(Preprocessor &PP, ASTConsumer *Consumer,
                                    CompletionConsumer));
 
   // Recover resources if we crash before exiting this method.
-  llvm::CrashRecoveryContextCleanupRegistrar
-    SemaCleanupInCrash(llvm::CrashRecoveryContextCleanup::
-                        create<Sema>(S.get()));
+  llvm::CrashRecoveryContextCleanupRegistrar<Sema> CleaupSema(S.get());
   
   ParseAST(*S.get(), PrintStats);
 }
@@ -61,7 +59,15 @@ void clang::ParseAST(Sema &S, bool PrintStats) {
 
   ASTConsumer *Consumer = &S.getASTConsumer();
 
-  Parser P(S.getPreprocessor(), S);
+  llvm::OwningPtr<Parser> ParseOP(new Parser(S.getPreprocessor(), S));
+  Parser &P = *ParseOP.get();
+
+  PrettyStackTraceParserEntry CrashInfo(P);
+
+  // Recover resources if we crash before exiting this method.
+  llvm::CrashRecoveryContextCleanupRegistrar<Parser>
+    CleaupParser(ParseOP.get());
+
   S.getPreprocessor().EnterMainSourceFile();
   P.Initialize();
   S.Initialize();
index 3946fc72080750cd6ff70bb8e2fd92da422635d1..60ca1d49e7cbd9bcd2bb185251c130b0ca323800 100644 (file)
@@ -22,7 +22,7 @@
 using namespace clang;
 
 Parser::Parser(Preprocessor &pp, Sema &actions)
-  : CrashInfo(*this), PP(pp), Actions(actions), Diags(PP.getDiagnostics()),
+  : PP(pp), Actions(actions), Diags(PP.getDiagnostics()),
     GreaterThanIsOperator(true), ColonIsSacred(false), 
     InMessageExpression(false), TemplateParameterDepth(0) {
   Tok.setKind(tok::eof);