Skip to content

Commit

Permalink
Revert r260265, "clang-cl: Support loading plugins on Windows"
Browse files Browse the repository at this point in the history
It causes memory exhaust on mingw-w64(x64). Investigating.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@260536 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
chapuni committed Feb 11, 2016
1 parent aba1af8 commit 7eba45f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 13 deletions.
5 changes: 1 addition & 4 deletions docs/ClangPlugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,11 @@ Registering a plugin
====================

A plugin is loaded from a dynamic library at runtime by the compiler. To
register a plugin in a library, use ``FrontendPluginRegistry::Add<>``.
On Windows, you also need to export your plugin registry using
``LLVM_EXPORT_REGISTRY``. Here is an example:
register a plugin in a library, use ``FrontendPluginRegistry::Add<>``:

.. code-block:: c++

static FrontendPluginRegistry::Add<MyPlugin> X("my-plugin-name", "my plugin description");
LLVM_EXPORT_REGISTRY(FrontendPluginRegistry)

Putting it all together
=======================
Expand Down
1 change: 0 additions & 1 deletion examples/PrintFunctionNames/PrintFunctionNames.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,3 @@ class PrintFunctionNamesAction : public PluginASTAction {

static FrontendPluginRegistry::Add<PrintFunctionNamesAction>
X("print-fns", "print function names");
LLVM_EXPORT_REGISTRY(FrontendPluginRegistry)
9 changes: 1 addition & 8 deletions lib/FrontendTool/ExecuteCompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,9 @@ bool clang::ExecuteCompilerInvocation(CompilerInstance *Clang) {
e = Clang->getFrontendOpts().Plugins.size(); i != e; ++i) {
const std::string &Path = Clang->getFrontendOpts().Plugins[i];
std::string 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 {
if (llvm::sys::DynamicLibrary::LoadLibraryPermanently(Path.c_str(), &Error))
Clang->getDiagnostics().Report(diag::err_fe_unable_to_load_plugin)
<< Path << Error;
}
}

// Honor -mllvm.
Expand Down

0 comments on commit 7eba45f

Please sign in to comment.