Move backend output out of destructor.

Don't free AST consumer when --disable-free is set.

llvm-svn: 59030
This commit is contained in:
Daniel Dunbar 2008-11-11 06:35:39 +00:00
parent 4497fbf6e0
commit a94d873b4b
2 changed files with 8 additions and 3 deletions

View File

@ -89,9 +89,6 @@ namespace {
CodeGenPasses(0), PerModulePasses(0), PerFunctionPasses(0) {}
~BackendConsumer() {
// FIXME: Move out of destructor.
EmitAssembly();
delete AsmOutStream;
delete TheTargetData;
delete ModuleProvider;
@ -115,6 +112,11 @@ namespace {
virtual void HandleTranslationUnit(TranslationUnit& TU) {
Gen->HandleTranslationUnit(TU);
EmitAssembly();
// Force a flush here in case we never get released.
if (AsmOutStream)
AsmOutStream->flush();
}
virtual void HandleTagDeclDefinition(TagDecl *D) {

View File

@ -1363,6 +1363,9 @@ static void ProcessInputFile(Preprocessor &PP, PreprocessorFactory &PPF,
// files.
if (ClearSourceMgr)
PP.getSourceManager().clearIDTables();
if (DisableFree)
Consumer.take();
}
static void ProcessSerializedFile(const std::string& InFile, Diagnostic& Diag,