diff options
author | Ehsan Akhgari <ehsan.akhgari@gmail.com> | 2016-02-09 19:43:11 +0000 |
---|---|---|
committer | Ehsan Akhgari <ehsan.akhgari@gmail.com> | 2016-02-09 19:43:11 +0000 |
commit | ae1cd1e7c301954bab703e9116a30b330902d43a (patch) | |
tree | 5e05d5fc1c72617e97fae831445f8c0d5db0f663 /lib/FrontendTool | |
parent | 1172fe22d8efbf1a684349b53b637519e003d170 (diff) | |
download | clang-ae1cd1e7c301954bab703e9116a30b330902d43a.tar.gz |
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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260265 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/FrontendTool')
-rw-r--r-- | lib/FrontendTool/ExecuteCompilerInvocation.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/FrontendTool/ExecuteCompilerInvocation.cpp b/lib/FrontendTool/ExecuteCompilerInvocation.cpp index 116590e537..90642abb5d 100644 --- a/lib/FrontendTool/ExecuteCompilerInvocation.cpp +++ b/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. |