Bury leaked sema pointer when reading from AST files.

Should suppress several LSan reports.

llvm-svn: 207056
This commit is contained in:
Nico Weber 2014-04-24 00:51:03 +00:00
parent 1a80595a2b
commit 1ada62654f
2 changed files with 3 additions and 2 deletions

View File

@ -455,6 +455,7 @@ public:
}
Sema *takeSema() { return TheSema.release(); }
void resetAndLeakSema() { BuryPointer(TheSema.release()); }
/// }
/// @name Module Management

View File

@ -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();