[clang-tools-extra] 3e7a8aa - [clang-tidy] Don't try to build CTTestTidyModule for Windows with dylibs

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 22 02:09:21 PDT 2022


Author: Martin Storsjö
Date: 2022-03-22T11:08:32+02:00
New Revision: 3e7a8aab759a9bdf90f35a60ea6e96ec64e36cb9

URL: https://github.com/llvm/llvm-project/commit/3e7a8aab759a9bdf90f35a60ea6e96ec64e36cb9
DIFF: https://github.com/llvm/llvm-project/commit/3e7a8aab759a9bdf90f35a60ea6e96ec64e36cb9.diff

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

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.

Differential Revision: https://reviews.llvm.org/D121687

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/test/CMakeLists.txt b/clang-tools-extra/test/CMakeLists.txt
index 170e5f8bd197d..26aece9cf337e 100644
--- a/clang-tools-extra/test/CMakeLists.txt
+++ b/clang-tools-extra/test/CMakeLists.txt
@@ -81,11 +81,13 @@ foreach(dep ${LLVM_UTILS_DEPS})
 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


        


More information about the cfe-commits mailing list