summaryrefslogtreecommitdiffstats
path: root/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2011-06-16 16:17:05 +0000
committerChandler Carruth <chandlerc@gmail.com>2011-06-16 16:17:05 +0000
commitb5703510595ebf8af37e6e7a479534a01e69fccd (patch)
tree81ed2de1676bf135ac0bb06f793d192e0ecda3c3 /clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
parent8bd11f183478a5a1f18d6e42b0ea00f876c86d46 (diff)
downloadbcm5719-llvm-b5703510595ebf8af37e6e7a479534a01e69fccd.tar.gz
bcm5719-llvm-b5703510595ebf8af37e6e7a479534a01e69fccd.zip
Raise the ARCMT functionality in Clang into proper FrontendActions.
These are somewhat special in that they wrap any other FrontendAction, running various ARC transformations or checks prior to the standard action's run. To implement them easily, this extends FrontendAction to have a WrapperFrontendAction utility class which forwards all calls by default to an inner action setup at construction time. This is then subclassed to override the specific behavior needed by the different ARCMT tools. Finally, FrontendTool is taught how to create these wrapper actions from the existing flags and options structures. The result is that clangFrontend no longer depends on clangARCMigrate. This is very important, as clangARCMigrate *heavily* depends on clangFrontend. Fundamentally ARCMigrate is at the same layer as a library like Rewrite, sitting firmly on top of the Frontend, but tied together with the FrontendTool when building the clang binary itself. llvm-svn: 133161
Diffstat (limited to 'clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp')
-rw-r--r--clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
index 664b53351dc..7ad263e14b8 100644
--- a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
+++ b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
@@ -14,6 +14,7 @@
#include "clang/FrontendTool/Utils.h"
#include "clang/StaticAnalyzer/Frontend/FrontendActions.h"
+#include "clang/ARCMigrate/ARCMTActions.h"
#include "clang/CodeGen/CodeGenAction.h"
#include "clang/Driver/CC1Options.h"
#include "clang/Driver/OptTable.h"
@@ -89,6 +90,21 @@ static FrontendAction *CreateFrontendAction(CompilerInstance &CI) {
if (!Act)
return 0;
+ // Potentially wrap the base FE action in an ARC Migrate Tool action.
+ switch (CI.getFrontendOpts().ARCMTAction) {
+ case FrontendOptions::ARCMT_None:
+ break;
+ case FrontendOptions::ARCMT_Check:
+ Act = new arcmt::CheckAction(Act);
+ break;
+ case FrontendOptions::ARCMT_Modify:
+ Act = new arcmt::TransformationAction(Act);
+ break;
+ case FrontendOptions::ARCMT_ModifyInMemory:
+ Act = new arcmt::InMemoryTransformationAction(Act);
+ break;
+ }
+
// If there are any AST files to merge, create a frontend action
// adaptor to perform the merge.
if (!CI.getFrontendOpts().ASTMergeFiles.empty())
OpenPOWER on IntegriCloud