[PATCH] D121687: [clang-tidy] Don't try to build CTTestTidyModule for Windows with dylibs

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 15 04:45:55 PDT 2022


mstorsjo created this revision.
mstorsjo added a reviewer: rnk.
Herald added subscribers: xazax.hun, mgorny.
Herald added a project: All.
mstorsjo requested review of this revision.
Herald added a project: clang-tools-extra.

In MinGW mode, it's possible to build LLVM/Clang with
LLVM_LINK_LLVM_DYLIB (which implicitly enables plugins too). Other
existing ways of building plugins on Windows is to build with
LLVM_EXPORT_SYMBOLS_FOR_PLUGINS, where each executable exports its
symbols.

With LLVM_LINK_LLVM_DYLIB, we can't generally skip building plugins
even if they are set up with PLUGIN_TOOL, as some plugins (e.g.
under clang/examples) set up that way do build properly (as
they manually call clang_target_link_libraries, which links in the
libclang-cpp.dll dylib).

For CTTestTidyModule, there's no corresponding dylib that would
provide the same exports.

Alternatively, we could make the condition
`if (NOT WIN32 OR LLVM_EXPORT_SYMBOLS_FOR_PLUGINS)`, as that's the
only way this plugin would be possible to link on Windows.

(Currently, building this plugin with `LLVM_EXPORT_SYMBOLS_FOR_PLUGINS`
fails to link one symbol though, but in principle, it could
work.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121687

Files:
  clang-tools-extra/test/CMakeLists.txt


Index: clang-tools-extra/test/CMakeLists.txt
===================================================================
--- clang-tools-extra/test/CMakeLists.txt
+++ clang-tools-extra/test/CMakeLists.txt
@@ -81,11 +81,13 @@
 endforeach()
 
 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
-  llvm_add_library(
-      CTTestTidyModule
-      MODULE clang-tidy/CTTestTidyModule.cpp
-      PLUGIN_TOOL clang-tidy
-      DEPENDS clang-tidy-headers)
+  if (NOT WIN32 AND NOT LLVM_LINK_LLVM_DYLIB)
+    llvm_add_library(
+        CTTestTidyModule
+        MODULE clang-tidy/CTTestTidyModule.cpp
+        PLUGIN_TOOL clang-tidy
+        DEPENDS clang-tidy-headers)
+  endif()
 
   if(CLANG_BUILT_STANDALONE)
     # LLVMHello library is needed below


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121687.415386.patch
Type: text/x-patch
Size: 724 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220315/5c262e70/attachment-0001.bin>


More information about the cfe-commits mailing list