From 4f32786ac45210143654390177105eb749b614e9 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Mon, 21 Mar 2011 18:40:17 +0000 Subject: Improve crash recovery cleanup to recovery CompilerInstances during crash recovery. This was a huge resource "root" during crashes. This change requires making a bunch of fundamental Clang structures (optionally) reference counted to allow correct ownership semantics of these objects (e.g., ASTContext) to play out between an active ASTUnit and CompilerInstance object. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128011 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Frontend/FrontendAction.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lib/Frontend/FrontendAction.cpp') diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp index 5c34e9491b..42da44c2c7 100644 --- a/lib/Frontend/FrontendAction.cpp +++ b/lib/Frontend/FrontendAction.cpp @@ -258,10 +258,10 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, // matching EndSourceFile(). failure: if (isCurrentFileAST()) { - CI.takeASTContext(); - CI.takePreprocessor(); - CI.takeSourceManager(); - CI.takeFileManager(); + CI.setASTContext(0); + CI.setPreprocessor(0); + CI.setSourceManager(0); + CI.setFileManager(0); } CI.getDiagnosticClient().EndSourceFile(); @@ -313,7 +313,7 @@ void FrontendAction::EndSourceFile() { CI.takeASTConsumer(); if (!isCurrentFileAST()) { CI.takeSema(); - CI.takeASTContext(); + CI.resetAndLeakASTContext(); } } else { if (!isCurrentFileAST()) { @@ -342,10 +342,10 @@ void FrontendAction::EndSourceFile() { if (isCurrentFileAST()) { CI.takeSema(); - CI.takeASTContext(); - CI.takePreprocessor(); - CI.takeSourceManager(); - CI.takeFileManager(); + CI.resetAndLeakASTContext(); + CI.resetAndLeakPreprocessor(); + CI.resetAndLeakSourceManager(); + CI.resetAndLeakFileManager(); } setCompilerInstance(0); -- cgit v1.2.3-18-g5258