summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/FrontendAction.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2014-04-24 02:42:04 +0000
committerNico Weber <nicolasweber@gmx.de>2014-04-24 02:42:04 +0000
commit7de358e93639369a011920618d3b08a7e2e57c70 (patch)
tree8014259f8b8bb44104835cd161f4e57d7b104b74 /clang/lib/Frontend/FrontendAction.cpp
parent49fdc41b2175acb089ac880e24729856b31088b0 (diff)
downloadbcm5719-llvm-7de358e93639369a011920618d3b08a7e2e57c70.tar.gz
bcm5719-llvm-7de358e93639369a011920618d3b08a7e2e57c70.zip
Don't leak objects in load-from-ast path unless DisableFree is set.
Also update a comment to match a code change that was done in r110978. llvm-svn: 207065
Diffstat (limited to 'clang/lib/Frontend/FrontendAction.cpp')
-rw-r--r--clang/lib/Frontend/FrontendAction.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index 6cbd8ba193e..4bb539c88a9 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -408,16 +408,16 @@ void FrontendAction::EndSourceFile() {
// Finalize the action.
EndSourceFileAction();
- // Release the consumer and the AST, in that order since the consumer may
- // perform actions in its destructor which require the context.
+ // Sema references the ast consumer, so reset sema first.
//
// FIXME: There is more per-file stuff we could just drop here?
- if (CI.getFrontendOpts().DisableFree) {
- BuryPointer(CI.takeASTConsumer());
+ bool DisableFree = CI.getFrontendOpts().DisableFree;
+ if (DisableFree) {
if (!isCurrentFileAST()) {
CI.resetAndLeakSema();
CI.resetAndLeakASTContext();
}
+ BuryPointer(CI.takeASTConsumer());
} else {
if (!isCurrentFileAST()) {
CI.setSema(0);
@@ -443,7 +443,7 @@ void FrontendAction::EndSourceFile() {
// FrontendAction.
CI.clearOutputFiles(/*EraseFiles=*/shouldEraseOutputFiles());
- if (isCurrentFileAST()) {
+ if (DisableFree && isCurrentFileAST()) {
CI.resetAndLeakSema();
CI.resetAndLeakASTContext();
CI.resetAndLeakPreprocessor();
OpenPOWER on IntegriCloud