From: Nico Weber Date: Thu, 24 Apr 2014 00:51:03 +0000 (+0000) Subject: Bury leaked sema pointer when reading from AST files. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2f579d9d0ddf670ff2b783d82e5ee3af0a83d7e1;p=clang Bury leaked sema pointer when reading from AST files. Should suppress several LSan reports. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207056 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Frontend/CompilerInstance.h b/include/clang/Frontend/CompilerInstance.h index a7368bd149..cefd172faf 100644 --- a/include/clang/Frontend/CompilerInstance.h +++ b/include/clang/Frontend/CompilerInstance.h @@ -455,6 +455,7 @@ public: } Sema *takeSema() { return TheSema.release(); } + void resetAndLeakSema() { BuryPointer(TheSema.release()); } /// } /// @name Module Management diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp index dfe3d85ba7..6cbd8ba193 100644 --- a/lib/Frontend/FrontendAction.cpp +++ b/lib/Frontend/FrontendAction.cpp @@ -415,7 +415,7 @@ void FrontendAction::EndSourceFile() { if (CI.getFrontendOpts().DisableFree) { BuryPointer(CI.takeASTConsumer()); if (!isCurrentFileAST()) { - BuryPointer(CI.takeSema()); + CI.resetAndLeakSema(); CI.resetAndLeakASTContext(); } } else { @@ -444,7 +444,7 @@ void FrontendAction::EndSourceFile() { CI.clearOutputFiles(/*EraseFiles=*/shouldEraseOutputFiles()); if (isCurrentFileAST()) { - CI.takeSema(); + CI.resetAndLeakSema(); CI.resetAndLeakASTContext(); CI.resetAndLeakPreprocessor(); CI.resetAndLeakSourceManager();