r260536 - Revert r260265, "clang-cl: Support loading plugins on Windows"

2016-02-11 Thread NAKAMURA Takumi via cfe-commits
Author: chapuni
Date: Thu Feb 11 10:33:20 2016
New Revision: 260536

URL: http://llvm.org/viewvc/llvm-project?rev=260536=rev
Log:
Revert r260265, "clang-cl: Support loading plugins on Windows"

It causes memory exhaust on mingw-w64(x64). Investigating.

Modified:
cfe/trunk/docs/ClangPlugins.rst
cfe/trunk/examples/PrintFunctionNames/PrintFunctionNames.cpp
cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp

Modified: cfe/trunk/docs/ClangPlugins.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangPlugins.rst?rev=260536=260535=260536=diff
==
--- cfe/trunk/docs/ClangPlugins.rst (original)
+++ cfe/trunk/docs/ClangPlugins.rst Thu Feb 11 10:33:20 2016
@@ -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 X("my-plugin-name", "my plugin 
description");
-  LLVM_EXPORT_REGISTRY(FrontendPluginRegistry)
 
 Putting it all together
 ===

Modified: cfe/trunk/examples/PrintFunctionNames/PrintFunctionNames.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/PrintFunctionNames/PrintFunctionNames.cpp?rev=260536=260535=260536=diff
==
--- cfe/trunk/examples/PrintFunctionNames/PrintFunctionNames.cpp (original)
+++ cfe/trunk/examples/PrintFunctionNames/PrintFunctionNames.cpp Thu Feb 11 
10:33:20 2016
@@ -121,4 +121,3 @@ protected:
 
 static FrontendPluginRegistry::Add
 X("print-fns", "print function names");
-LLVM_EXPORT_REGISTRY(FrontendPluginRegistry)

Modified: cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp?rev=260536=260535=260536=diff
==
--- cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp (original)
+++ cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp Thu Feb 11 
10:33:20 2016
@@ -189,16 +189,9 @@ bool clang::ExecuteCompilerInvocation(Co
  e = Clang->getFrontendOpts().Plugins.size(); i != e; ++i) {
 const std::string  = Clang->getFrontendOpts().Plugins[i];
 std::string Error;
-llvm::sys::DynamicLibrary DL(
-llvm::sys::DynamicLibrary::getPermanentLibrary(Path.c_str(), ));
-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(), 
))
   Clang->getDiagnostics().Report(diag::err_fe_unable_to_load_plugin)
 << Path << Error;
-}
   }
 
   // Honor -mllvm.


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r260265 - clang-cl: Support loading plugins on Windows

2016-02-09 Thread Ehsan Akhgari via cfe-commits
Author: ehsan
Date: Tue Feb  9 13:43:11 2016
New Revision: 260265

URL: http://llvm.org/viewvc/llvm-project?rev=260265=rev
Log:
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

Modified:
cfe/trunk/docs/ClangPlugins.rst
cfe/trunk/examples/PrintFunctionNames/PrintFunctionNames.cpp
cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp

Modified: cfe/trunk/docs/ClangPlugins.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ClangPlugins.rst?rev=260265=260264=260265=diff
==
--- cfe/trunk/docs/ClangPlugins.rst (original)
+++ cfe/trunk/docs/ClangPlugins.rst Tue Feb  9 13:43:11 2016
@@ -37,11 +37,14 @@ 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<>``:
+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:
 
 .. code-block:: c++
 
   static FrontendPluginRegistry::Add X("my-plugin-name", "my plugin 
description");
+  LLVM_EXPORT_REGISTRY(FrontendPluginRegistry)
 
 Putting it all together
 ===

Modified: cfe/trunk/examples/PrintFunctionNames/PrintFunctionNames.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/PrintFunctionNames/PrintFunctionNames.cpp?rev=260265=260264=260265=diff
==
--- cfe/trunk/examples/PrintFunctionNames/PrintFunctionNames.cpp (original)
+++ cfe/trunk/examples/PrintFunctionNames/PrintFunctionNames.cpp Tue Feb  9 
13:43:11 2016
@@ -121,3 +121,4 @@ protected:
 
 static FrontendPluginRegistry::Add
 X("print-fns", "print function names");
+LLVM_EXPORT_REGISTRY(FrontendPluginRegistry)

Modified: cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp?rev=260265=260264=260265=diff
==
--- cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp (original)
+++ cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp Tue Feb  9 
13:43:11 2016
@@ -189,9 +189,16 @@ bool clang::ExecuteCompilerInvocation(Co
  e = Clang->getFrontendOpts().Plugins.size(); i != e; ++i) {
 const std::string  = Clang->getFrontendOpts().Plugins[i];
 std::string Error;
-if (llvm::sys::DynamicLibrary::LoadLibraryPermanently(Path.c_str(), 
))
+llvm::sys::DynamicLibrary DL(
+llvm::sys::DynamicLibrary::getPermanentLibrary(Path.c_str(), ));
+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.


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits