[cfe-commits] r124551 - in /cfe/trunk: include/clang/Frontend/FrontendOptions.h lib/Frontend/CompilerInvocation.cpp lib/Frontend/FrontendAction.cpp
Nico Weber
nicolasweber at gmx.de
Sat Jan 29 13:21:49 PST 2011
Author: nico
Date: Sat Jan 29 15:21:49 2011
New Revision: 124551
URL: http://llvm.org/viewvc/llvm-project?rev=124551&view=rev
Log:
Support for -plugin-arg- with -add-plugin
Modified:
cfe/trunk/include/clang/Frontend/FrontendOptions.h
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/FrontendAction.cpp
Modified: cfe/trunk/include/clang/Frontend/FrontendOptions.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendOptions.h?rev=124551&r1=124550&r2=124551&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/FrontendOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/FrontendOptions.h Sat Jan 29 15:21:49 2011
@@ -100,12 +100,15 @@
/// The name of the action to run when using a plugin action.
std::string ActionName;
- /// Arg to pass to the plugin
+ /// Args to pass to the plugin
std::vector<std::string> PluginArgs;
/// The list of plugin actions to run in addition to the normal action.
std::vector<std::string> AddPluginActions;
+ /// Args to pass to the additional plugins
+ std::vector<std::vector<std::string> > AddPluginArgs;
+
/// The list of plugins to load.
std::vector<std::string> Plugins;
Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=124551&r1=124550&r2=124551&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Sat Jan 29 15:21:49 2011
@@ -438,6 +438,10 @@
for (unsigned i = 0, e = Opts.AddPluginActions.size(); i != e; ++i) {
Res.push_back("-add-plugin");
Res.push_back(Opts.AddPluginActions[i]);
+ for(unsigned ai = 0, ae = Opts.AddPluginArgs.size(); ai != ae; ++ai) {
+ Res.push_back("-plugin-arg-" + Opts.AddPluginActions[i]);
+ Res.push_back(Opts.AddPluginArgs[i][ai]);
+ }
}
for (unsigned i = 0, e = Opts.ASTMergeFiles.size(); i != e; ++i) {
Res.push_back("-ast-merge");
@@ -1106,6 +1110,14 @@
}
Opts.AddPluginActions = Args.getAllArgValues(OPT_add_plugin);
+ Opts.AddPluginArgs.resize(Opts.AddPluginActions.size());
+ for (int i = 0, e = Opts.AddPluginActions.size(); i != e; ++i) {
+ for (arg_iterator it = Args.filtered_begin(OPT_plugin_arg),
+ end = Args.filtered_end(); it != end; ++it) {
+ if ((*it)->getValue(Args, 0) == Opts.AddPluginActions[i])
+ Opts.AddPluginArgs[i].push_back((*it)->getValue(Args, 1));
+ }
+ }
if (const Arg *A = Args.getLastArg(OPT_code_completion_at)) {
Opts.CodeCompletionAt =
Modified: cfe/trunk/lib/Frontend/FrontendAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendAction.cpp?rev=124551&r1=124550&r2=124551&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendAction.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendAction.cpp Sat Jan 29 15:21:49 2011
@@ -112,7 +112,7 @@
if (it->getName() == CI.getFrontendOpts().AddPluginActions[i]) {
llvm::OwningPtr<PluginASTAction> P(it->instantiate());
FrontendAction* c = P.get();
- if (P->ParseArgs(CI, CI.getFrontendOpts().PluginArgs))
+ if (P->ParseArgs(CI, CI.getFrontendOpts().AddPluginArgs[i]))
Consumers.push_back(c->CreateASTConsumer(CI, InFile));
}
}
More information about the cfe-commits
mailing list