diff options
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CodeGenAction.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/CodeGen/CodeGenAction.cpp b/lib/CodeGen/CodeGenAction.cpp index 9660e68c70..69ac995a46 100644 --- a/lib/CodeGen/CodeGenAction.cpp +++ b/lib/CodeGen/CodeGenAction.cpp @@ -28,7 +28,7 @@ using namespace clang; using namespace llvm; -namespace { +namespace clang { class BackendConsumer : public ASTConsumer { Diagnostic &Diags; BackendAction Action; @@ -236,10 +236,7 @@ void CodeGenAction::EndSourceFileAction() { return; // Steal the module from the consumer. - BackendConsumer *Consumer = static_cast<BackendConsumer*>( - &getCompilerInstance().getASTConsumer()); - - TheModule.reset(Consumer->takeModule()); + TheModule.reset(BEConsumer->takeModule()); } llvm::Module *CodeGenAction::takeModule() { @@ -274,10 +271,12 @@ ASTConsumer *CodeGenAction::CreateASTConsumer(CompilerInstance &CI, if (BA != Backend_EmitNothing && !OS) return 0; - return new BackendConsumer(BA, CI.getDiagnostics(), - CI.getCodeGenOpts(), CI.getTargetOpts(), - CI.getFrontendOpts().ShowTimers, InFile, OS.take(), - CI.getLLVMContext()); + BEConsumer = + new BackendConsumer(BA, CI.getDiagnostics(), + CI.getCodeGenOpts(), CI.getTargetOpts(), + CI.getFrontendOpts().ShowTimers, InFile, OS.take(), + CI.getLLVMContext()); + return BEConsumer; } void CodeGenAction::ExecuteAction() { |