diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-05-04 12:36:56 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-05-04 12:36:56 +0000 |
commit | fa4de125c9417c16ce20e52527ff7ee91633127d (patch) | |
tree | 61cb4599870f3d604c04a402602b7ecdd69ffb4c /clang/lib/Frontend/FrontendAction.cpp | |
parent | 52266388f8941adff5f7ca6c246d14a40a6ddbc0 (diff) | |
download | bcm5719-llvm-fa4de125c9417c16ce20e52527ff7ee91633127d.tar.gz bcm5719-llvm-fa4de125c9417c16ce20e52527ff7ee91633127d.zip |
Frontend: Stop leaking when not -disable-free
Try again to plug a leak that's been around since at least r128011 after
coming across the FIXME. Nico Weber tried something similar in r207065
but had to revert in r207070 due to a bot failure.
The build failure isn't visible anymore so I'm not sure what went wrong.
I'm doing this slightly differently -- when not -disable-free I'm still
resetting the members (just not leaking them) -- so maybe it will work
out this time? Tests pass locally, anyway.
llvm-svn: 236419
Diffstat (limited to 'clang/lib/Frontend/FrontendAction.cpp')
-rw-r--r-- | clang/lib/Frontend/FrontendAction.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index d42ca718c39..3c136262ef7 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/lib/Frontend/FrontendAction.cpp @@ -494,13 +494,20 @@ void FrontendAction::EndSourceFile() { // FrontendAction. CI.clearOutputFiles(/*EraseFiles=*/shouldEraseOutputFiles()); - // FIXME: Only do this if DisableFree is set. if (isCurrentFileAST()) { - CI.resetAndLeakSema(); - CI.resetAndLeakASTContext(); - CI.resetAndLeakPreprocessor(); - CI.resetAndLeakSourceManager(); - CI.resetAndLeakFileManager(); + if (DisableFree) { + CI.resetAndLeakSema(); + CI.resetAndLeakASTContext(); + CI.resetAndLeakPreprocessor(); + CI.resetAndLeakSourceManager(); + CI.resetAndLeakFileManager(); + } else { + CI.setSema(nullptr); + CI.setASTContext(nullptr); + CI.setPreprocessor(nullptr); + CI.setSourceManager(nullptr); + CI.setFileManager(nullptr); + } } setCompilerInstance(nullptr); |