aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2011-01-25 20:34:14 +0000
committerNico Weber <nicolasweber@gmx.de>2011-01-25 20:34:14 +0000
commit5aa74affa5d61d04c4b034b3722ca41aec0cba6e (patch)
treea7d535bc8a361a750f92e4373b84bfe47a72df26 /lib/CodeGen
parentc60e13aeff96515d27638129154b1308c15ded3d (diff)
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
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/CodeGenAction.cpp17
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() {