diff options
author | Vassil Vassilev <v.g.vassilev@gmail.com> | 2021-10-05 06:10:38 +0000 |
---|---|---|
committer | Vassil Vassilev <v.g.vassilev@gmail.com> | 2021-10-05 06:10:38 +0000 |
commit | 3e9d04f7e422c3e62d9adac506df8e7d42acc206 (patch) | |
tree | fe595f6f8c7e2d10b523d0858264cb734a61addd /clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp | |
parent | 81fb640f83b6a5d099f9124739ab3049be79ea56 (diff) | |
download | llvm-3e9d04f7e422c3e62d9adac506df8e7d42acc206.zip llvm-3e9d04f7e422c3e62d9adac506df8e7d42acc206.tar.gz llvm-3e9d04f7e422c3e62d9adac506df8e7d42acc206.tar.bz2 |
Revert "[clang-repl] Allow loading of plugins in clang-repl."
This reverts commit 81fb640f83b6a5d099f9124739ab3049be79ea56 due to bot failures:
https://lab.llvm.org/buildbot#builders/57/builds/10807
Diffstat (limited to 'clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp')
-rw-r--r-- | clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp index dc8409f..b95851e 100644 --- a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -203,7 +203,24 @@ bool ExecuteCompilerInvocation(CompilerInstance *Clang) { return true; } - Clang->LoadRequestedPlugins(); + // Load any requested plugins. + for (const std::string &Path : Clang->getFrontendOpts().Plugins) { + std::string Error; + if (llvm::sys::DynamicLibrary::LoadLibraryPermanently(Path.c_str(), &Error)) + Clang->getDiagnostics().Report(diag::err_fe_unable_to_load_plugin) + << Path << Error; + } + + // Check if any of the loaded plugins replaces the main AST action + for (const FrontendPluginRegistry::entry &Plugin : + FrontendPluginRegistry::entries()) { + std::unique_ptr<PluginASTAction> P(Plugin.instantiate()); + if (P->getActionType() == PluginASTAction::ReplaceAction) { + Clang->getFrontendOpts().ProgramAction = clang::frontend::PluginAction; + Clang->getFrontendOpts().ActionName = Plugin.getName().str(); + break; + } + } // Honor -mllvm. // |