From f4f9ad0f5d8e8994c677c3712dff7585bf8bd963 Mon Sep 17 00:00:00 2001 From: Vassil Vassilev Date: Tue, 5 Oct 2021 06:11:42 +0000 Subject: Reland "[clang-repl] Allow loading of plugins in clang-repl." Differential revision: https://reviews.llvm.org/D110484 --- clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp') diff --git a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp index b95851e..dc8409f 100644 --- a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp @@ -203,24 +203,7 @@ bool ExecuteCompilerInvocation(CompilerInstance *Clang) { return true; } - // 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 P(Plugin.instantiate()); - if (P->getActionType() == PluginASTAction::ReplaceAction) { - Clang->getFrontendOpts().ProgramAction = clang::frontend::PluginAction; - Clang->getFrontendOpts().ActionName = Plugin.getName().str(); - break; - } - } + Clang->LoadRequestedPlugins(); // Honor -mllvm. // -- cgit v1.1