diff options
-rw-r--r-- | clang/include/clang/Frontend/CompilerInstance.h | 1 | ||||
-rw-r--r-- | clang/lib/Frontend/FrontendAction.cpp | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/clang/include/clang/Frontend/CompilerInstance.h b/clang/include/clang/Frontend/CompilerInstance.h index a7368bd1497..cefd172fafc 100644 --- a/clang/include/clang/Frontend/CompilerInstance.h +++ b/clang/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/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index dfe3d85ba73..6cbd8ba193e 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/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(); |