aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseAST.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-03-22 01:15:17 +0000
committerTed Kremenek <kremenek@apple.com>2011-03-22 01:15:17 +0000
commit614f96a7cf94805c2d336639300b62dc2f54e9e0 (patch)
tree2691b6c6f0f83db1a034fe3d317e56d7671261e6 /lib/Parse/ParseAST.cpp
parent55c02585de7b02bcb72352f731d9bc342c8282f3 (diff)
Migrate 'PrettySTackTraceParserEntry' object out of Parser, and have it constructed within ParseAST. This avoids double crashes
during crash recovery. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128056 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseAST.cpp')
-rw-r--r--lib/Parse/ParseAST.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/Parse/ParseAST.cpp b/lib/Parse/ParseAST.cpp
index bca0fa7ba5..21917b23ff 100644
--- a/lib/Parse/ParseAST.cpp
+++ b/lib/Parse/ParseAST.cpp
@@ -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();