r207056 - Bury leaked sema pointer when reading from AST files.
Nico Weber
nicolasweber at gmx.de
Wed Apr 23 17:51:03 PDT 2014
Author: nico
Date: Wed Apr 23 19:51:03 2014
New Revision: 207056
URL: http://llvm.org/viewvc/llvm-project?rev=207056&view=rev
Log:
Bury leaked sema pointer when reading from AST files.
Should suppress several LSan reports.
Modified:
cfe/trunk/include/clang/Frontend/CompilerInstance.h
cfe/trunk/lib/Frontend/FrontendAction.cpp
Modified: cfe/trunk/include/clang/Frontend/CompilerInstance.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInstance.h?rev=207056&r1=207055&r2=207056&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/CompilerInstance.h (original)
+++ cfe/trunk/include/clang/Frontend/CompilerInstance.h Wed Apr 23 19:51:03 2014
@@ -455,6 +455,7 @@ public:
}
Sema *takeSema() { return TheSema.release(); }
+ void resetAndLeakSema() { BuryPointer(TheSema.release()); }
/// }
/// @name Module Management
Modified: cfe/trunk/lib/Frontend/FrontendAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendAction.cpp?rev=207056&r1=207055&r2=207056&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendAction.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendAction.cpp Wed Apr 23 19:51:03 2014
@@ -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();
More information about the cfe-commits
mailing list