diff options
author | Nico Weber <nicolasweber@gmx.de> | 2019-01-05 01:10:20 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2019-01-05 01:10:20 +0000 |
commit | 9f0c21c1e0e3bc9fc3b8a1f785db8440146a891c (patch) | |
tree | fb00deb15429c642644d65116b948b55f06d0f92 /clang/lib/Frontend/FrontendAction.cpp | |
parent | e6ed8540c5896c54f1ec1f9130af922e15362b93 (diff) | |
download | bcm5719-llvm-9f0c21c1e0e3bc9fc3b8a1f785db8440146a891c.tar.gz bcm5719-llvm-9f0c21c1e0e3bc9fc3b8a1f785db8440146a891c.zip |
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.
llvm-svn: 350451
Diffstat (limited to 'clang/lib/Frontend/FrontendAction.cpp')
-rw-r--r-- | clang/lib/Frontend/FrontendAction.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp index 83152bd3533..a1866e48cc4 100644 --- a/clang/lib/Frontend/FrontendAction.cpp +++ b/clang/lib/Frontend/FrontendAction.cpp @@ -156,6 +156,24 @@ FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI, 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; |