From 5aa74affa5d61d04c4b034b3722ca41aec0cba6e Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 25 Jan 2011 20:34:14 +0000 Subject: Add -add-plugin flag, which runs plugins in addition to codegen. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124227 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenAction.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'lib/CodeGen/CodeGenAction.cpp') 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( - &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() { -- cgit v1.2.3-18-g5258