aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-11-17 23:01:17 +0000
committerTed Kremenek <kremenek@apple.com>2011-11-17 23:01:17 +0000
commitd04a982d3472d98e58f58dfc327ca11e236980f5 (patch)
tree647d4b0f151f350460e4fd7b5318569a355155a4 /lib/Frontend
parentee081c4051cde4bd44475b5e29d695008c15a9cc (diff)
Simplify crash cleanup logic in ASTUnit::LoadFromCommandLine() by zeroing out two IntrusiveRefCnt pointers after we have assigned their respective values into fields of ASTUnit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144929 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend')
-rw-r--r--lib/Frontend/ASTUnit.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp
index 64b931f5a8..e2544027b5 100644
--- a/lib/Frontend/ASTUnit.cpp
+++ b/lib/Frontend/ASTUnit.cpp
@@ -1877,7 +1877,7 @@ ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin,
AST.reset(new ASTUnit(false));
ConfigureDiags(Diags, ArgBegin, ArgEnd, *AST, CaptureDiagnostics);
AST->Diagnostics = Diags;
-
+ Diags = 0; // Zero out now to ease cleanup during crash recovery.
AST->FileSystemOpts = CI->getFileSystemOpts();
AST->FileMgr = new FileManager(AST->FileSystemOpts);
AST->OnlyLocalDecls = OnlyLocalDecls;
@@ -1887,17 +1887,12 @@ ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin,
AST->NumStoredDiagnosticsFromDriver = StoredDiagnostics.size();
AST->StoredDiagnostics.swap(StoredDiagnostics);
AST->Invocation = CI;
+ CI = 0; // Zero out now to ease cleanup during crash recovery.
AST->NestedMacroExpansions = NestedMacroExpansions;
// Recover resources if we crash before exiting this method.
llvm::CrashRecoveryContextCleanupRegistrar<ASTUnit>
ASTUnitCleanup(AST.get());
- llvm::CrashRecoveryContextCleanupRegistrar<CompilerInvocation,
- llvm::CrashRecoveryContextReleaseRefCleanup<CompilerInvocation> >
- CICleanup(CI.getPtr());
- llvm::CrashRecoveryContextCleanupRegistrar<DiagnosticsEngine,
- llvm::CrashRecoveryContextReleaseRefCleanup<DiagnosticsEngine> >
- DiagCleanup(Diags.getPtr());
return AST->LoadFromCompilerInvocation(PrecompilePreamble) ? 0 : AST.take();
}