summaryrefslogtreecommitdiffstats
path: root/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
diff options
context:
space:
mode:
authorEhsan Akhgari <ehsan.akhgari@gmail.com>2016-02-09 19:43:11 +0000
committerEhsan Akhgari <ehsan.akhgari@gmail.com>2016-02-09 19:43:11 +0000
commit75b3a4b507fb9a55bd9840a8e4fa3854e7008f90 (patch)
tree42ef3c13673b3e4a437a121217be624fee2fbdac /clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
parent3f8b09da3fb9a3b78d7813b4adc2ac5916c6f25b (diff)
downloadbcm5719-llvm-75b3a4b507fb9a55bd9840a8e4fa3854e7008f90.tar.gz
bcm5719-llvm-75b3a4b507fb9a55bd9840a8e4fa3854e7008f90.zip
clang-cl: Support loading plugins on Windows
This builds on the support being added to LLVM to import and export registries from DLLs. This will allow us to pick up the registry entries added in the DLL's copy of FrontendPluginRegistry. This will allow us to use plugins on Windows using: $ clang-cl -Xclang -load -Xclang plugin.dll \ -Xclang -add-plugin -Xclang foo llvm-svn: 260265
Diffstat (limited to 'clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp')
-rw-r--r--clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
index 116590e5375..90642abb5d5 100644
--- a/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
+++ b/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp
@@ -189,9 +189,16 @@ bool clang::ExecuteCompilerInvocation(CompilerInstance *Clang) {
e = Clang->getFrontendOpts().Plugins.size(); i != e; ++i) {
const std::string &Path = Clang->getFrontendOpts().Plugins[i];
std::string Error;
- if (llvm::sys::DynamicLibrary::LoadLibraryPermanently(Path.c_str(), &Error))
+ llvm::sys::DynamicLibrary DL(
+ llvm::sys::DynamicLibrary::getPermanentLibrary(Path.c_str(), &Error));
+ if (DL.isValid()) {
+ // On Windows, we need to import the plugin front-end action
+ // dynamically.
+ LLVM_IMPORT_REGISTRY(FrontendPluginRegistry, DL);
+ } else {
Clang->getDiagnostics().Report(diag::err_fe_unable_to_load_plugin)
<< Path << Error;
+ }
}
// Honor -mllvm.
OpenPOWER on IntegriCloud