Author: nico Date: Fri Jan 4 17:10:20 2019 New Revision: 350451 URL: http://llvm.org/viewvc/llvm-project?rev=350451&view=rev Log: Move -add-plugin validation after -load was executed.
Moves the code added in r350340 around a bit, to hopefully make the existing plugin tests pass when clang is built with examples enabled. Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp cfe/trunk/lib/Frontend/FrontendAction.cpp Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=350451&r1=350450&r2=350451&view=diff ============================================================================== --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original) +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri Jan 4 17:10:20 2019 @@ -1666,20 +1666,7 @@ static InputKind ParseFrontendArgs(Front Opts.ProgramAction = frontend::PluginAction; Opts.ActionName = A->getValue(); } - for (const std::string &Arg : Args.getAllArgValues(OPT_add_plugin)) { - bool Found = false; - for (FrontendPluginRegistry::iterator it = FrontendPluginRegistry::begin(), - ie = FrontendPluginRegistry::end(); - it != ie; ++it) { - if (it->getName() == Arg) - Found = true; - } - if (!Found) { - Diags.Report(diag::err_fe_invalid_plugin_name) << Arg; - continue; - } - Opts.AddPluginActions.push_back(Arg); - } + Opts.AddPluginActions = Args.getAllArgValues(OPT_add_plugin); for (const auto *AA : Args.filtered(OPT_plugin_arg)) Opts.PluginArgs[AA->getValue(0)].emplace_back(AA->getValue(1)); Modified: cfe/trunk/lib/Frontend/FrontendAction.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendAction.cpp?rev=350451&r1=350450&r2=350451&view=diff ============================================================================== --- cfe/trunk/lib/Frontend/FrontendAction.cpp (original) +++ cfe/trunk/lib/Frontend/FrontendAction.cpp Fri Jan 4 17:10:20 2019 @@ -156,6 +156,24 @@ FrontendAction::CreateWrappedASTConsumer if (FrontendPluginRegistry::begin() == FrontendPluginRegistry::end()) return Consumer; + // Validate -add-plugin args. + bool FoundAllPlugins = true; + for (const std::string &Arg : CI.getFrontendOpts().AddPluginActions) { + bool Found = false; + for (FrontendPluginRegistry::iterator it = FrontendPluginRegistry::begin(), + ie = FrontendPluginRegistry::end(); + it != ie; ++it) { + if (it->getName() == Arg) + Found = true; + } + if (!Found) { + CI.getDiagnostics().Report(diag::err_fe_invalid_plugin_name) << Arg; + FoundAllPlugins = false; + } + } + if (!FoundAllPlugins) + return nullptr; + // If this is a code completion run, avoid invoking the plugin consumers if (CI.hasCodeCompletionConsumer()) return Consumer; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits