[PATCH] D120301: clang-tools-extra: Make test dependency on LLVMHello optional

Tom Stellard via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 21 22:37:53 PST 2022


tstellar created this revision.
tstellar added a reviewer: vtjnash.
Herald added a subscriber: mgorny.
tstellar requested review of this revision.
Herald added a project: clang-tools-extra.

This fixes clang + clang-tools-extra standalone build after
36892727e4f19a60778e371d78f8fb09d8122c85 <https://reviews.llvm.org/rG36892727e4f19a60778e371d78f8fb09d8122c85>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120301

Files:
  clang-tools-extra/test/CMakeLists.txt
  clang-tools-extra/test/clang-tidy/CTTestTidyModule.cpp
  clang-tools-extra/test/lit.cfg.py
  clang-tools-extra/test/lit.site.cfg.py.in


Index: clang-tools-extra/test/lit.site.cfg.py.in
===================================================================
--- clang-tools-extra/test/lit.site.cfg.py.in
+++ clang-tools-extra/test/lit.site.cfg.py.in
@@ -13,6 +13,7 @@
 config.target_triple = "@TARGET_TRIPLE@"
 config.clang_tidy_staticanalyzer = @CLANG_TIDY_ENABLE_STATIC_ANALYZER@
 config.has_plugins = @CLANG_PLUGIN_SUPPORT@ & ~@LLVM_INSTALL_TOOLCHAIN_ONLY@
+config.has_llvm_hello = @LLVM_HAS_LLVM_HELLO@
 
 # Support substitution of the tools and libs dirs with user parameters. This is
 # used when we can't determine the tool dir at configuration time.
Index: clang-tools-extra/test/lit.cfg.py
===================================================================
--- clang-tools-extra/test/lit.cfg.py
+++ clang-tools-extra/test/lit.cfg.py
@@ -155,3 +155,6 @@
 # Plugins (loadable modules)
 if config.has_plugins and config.llvm_plugin_ext:
     config.available_features.add('plugins')
+
+if config.has_llvm_hello:
+    config.available_features.add("llvm-hello")
Index: clang-tools-extra/test/clang-tidy/CTTestTidyModule.cpp
===================================================================
--- clang-tools-extra/test/clang-tidy/CTTestTidyModule.cpp
+++ clang-tools-extra/test/clang-tidy/CTTestTidyModule.cpp
@@ -1,4 +1,4 @@
-// REQUIRES: plugins
+// REQUIRES: plugins, llvm-hello
 // RUN: clang-tidy -checks='-*,mytest*' --list-checks -load %llvmshlibdir/CTTestTidyModule%pluginext -load %llvmshlibdir/LLVMHello%pluginext | FileCheck --check-prefix=CHECK-LIST %s
 // CHECK-LIST: Enabled checks:
 // CHECK-LIST-NEXT:    mytest1
Index: clang-tools-extra/test/CMakeLists.txt
===================================================================
--- clang-tools-extra/test/CMakeLists.txt
+++ clang-tools-extra/test/CMakeLists.txt
@@ -15,10 +15,15 @@
 
 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
 
+if (TARGET LLVMHello)
+  set (LLVM_HAS_LLVM_HELLO 1)
+endif()
+
 llvm_canonicalize_cmake_booleans(
   CLANG_TIDY_ENABLE_STATIC_ANALYZER
   CLANG_PLUGIN_SUPPORT
   LLVM_INSTALL_TOOLCHAIN_ONLY
+  LLVM_HAS_LLVM_HELLO
   )
 
 configure_lit_site_cfg(
@@ -97,7 +102,10 @@
   endif()
 
   if(TARGET CTTestTidyModule)
-      list(APPEND CLANG_TOOLS_TEST_DEPS CTTestTidyModule LLVMHello)
+      list(APPEND CLANG_TOOLS_TEST_DEPS CTTestTidyModule)
+      if (TARGET  LLVMHello)
+        list(APPEND CLANG_TOOLS_TEST_DEPS CTTestTidyModule)
+      endif()
       target_include_directories(CTTestTidyModule PUBLIC BEFORE "${CLANG_TOOLS_SOURCE_DIR}")
       if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
         set(LLVM_LINK_COMPONENTS


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D120301.410452.patch
Type: text/x-patch
Size: 2644 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220222/8ae234a1/attachment.bin>


More information about the cfe-commits mailing list