do a significant amount of work in its destructor, which may access the
context. (PR4642).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77423
91177308-0d34-0410-b5e6-
96231b3b80d8
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)
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();