]> granicus.if.org Git - clang/commitdiff
Bury leaked sema pointer when reading from AST files.
authorNico Weber <nicolasweber@gmx.de>
Thu, 24 Apr 2014 00:51:03 +0000 (00:51 +0000)
committerNico Weber <nicolasweber@gmx.de>
Thu, 24 Apr 2014 00:51:03 +0000 (00:51 +0000)
Should suppress several LSan reports.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207056 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Frontend/CompilerInstance.h
lib/Frontend/FrontendAction.cpp

index a7368bd1497681cc298fb3e3683e5b0cc4c24db1..cefd172fafcaddb5f5729a1f7403bc6f05f8e56b 100644 (file)
@@ -455,6 +455,7 @@ public:
   }
 
   Sema *takeSema() { return TheSema.release(); }
+  void resetAndLeakSema() { BuryPointer(TheSema.release()); }
 
   /// }
   /// @name Module Management
index dfe3d85ba730c3297d841ef12c686ddccfb58d00..6cbd8ba193e240d8bb79ee094f8e56e49b075795 100644 (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();