mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-13 19:24:21 +00:00
Move backend output out of destructor.
Don't free AST consumer when --disable-free is set. llvm-svn: 59030
This commit is contained in:
parent
4497fbf6e0
commit
a94d873b4b
@ -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) {
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user