[cfe-commits] r77423 - /cfe/trunk/tools/clang-cc/clang-cc.cpp
Daniel Dunbar
daniel at zuster.org
Tue Jul 28 19:40:09 PDT 2009
Author: ddunbar
Date: Tue Jul 28 21:40:09 2009
New Revision: 77423
URL: http://llvm.org/viewvc/llvm-project?rev=77423&view=rev
Log:
Destroy the ASTConsumer prior to the Context, HTMLPrinter for example wants to
do a significant amount of work in its destructor, which may access the
context. (PR4642).
Modified:
cfe/trunk/tools/clang-cc/clang-cc.cpp
Modified: cfe/trunk/tools/clang-cc/clang-cc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang-cc.cpp?rev=77423&r1=77422&r2=77423&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang-cc.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang-cc.cpp Tue Jul 28 21:40:09 2009
@@ -2078,6 +2078,13 @@
if (FixItRewrite)
FixItRewrite->WriteFixedFile(InFile, OutputFile);
+
+ // Disable the consumer prior to the context, the consumer may perform actions
+ // in its destructor which require the context.
+ if (DisableFree)
+ Consumer.take();
+ else
+ Consumer.reset();
// If in -disable-free mode, don't deallocate ASTContext.
if (DisableFree)
@@ -2104,11 +2111,6 @@
if (ClearSourceMgr)
PP.getSourceManager().clearIDTables();
- if (DisableFree)
- Consumer.take();
- else
- Consumer.reset();
-
// Always delete the output stream because we don't want to leak file
// handles. Also, we don't want to try to erase an open file.
OS.reset();
More information about the cfe-commits
mailing list