Migrate 'PrettySTackTraceParserEntry' object out of Parser, and have it constructed within ParseAST. This avoids double crashes
during crash recovery. llvm-svn: 128056
This commit is contained in:
parent
b41dde505c
commit
4c9d46b310
|
@ -76,7 +76,6 @@ class Parser : public CodeCompletionHandler {
|
|||
friend class ColonProtectionRAIIObject;
|
||||
friend class InMessageExpressionRAIIObject;
|
||||
friend class ParenBraceBracketBalancer;
|
||||
PrettyStackTraceParserEntry CrashInfo;
|
||||
|
||||
Preprocessor &PP;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue