Skip to content

Commit f0fbccb

Browse files
authored
[clang-tidy] Enable plugin tests with LLVM_INSTALL_TOOLCHAIN_ONLY (#90370)
The only reason for the removed condition was that there was a dependency for `CTTestTidyModule` on the `clang-tidy-headers` target, which was only created under the same `NOT LLVM_INSTALL_TOOLCHAIN_ONLY` condition. It looks like this target is not needed for `CTTestTidyModule` to build and run, so the dependency can be removed along with the condition. See also https://reviews.llvm.org/D111100 for earlier discussions.
1 parent 6d44a1e commit f0fbccb

File tree

2 files changed

+22
-25
lines changed

2 files changed

+22
-25
lines changed

clang-tools-extra/test/CMakeLists.txt

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -67,33 +67,30 @@ foreach(dep ${LLVM_UTILS_DEPS})
6767
endif()
6868
endforeach()
6969

70-
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
71-
if (NOT WIN32 OR NOT LLVM_LINK_LLVM_DYLIB)
72-
llvm_add_library(
73-
CTTestTidyModule
74-
MODULE clang-tidy/CTTestTidyModule.cpp
75-
PLUGIN_TOOL clang-tidy
76-
DEPENDS clang-tidy-headers)
77-
endif()
70+
if (NOT WIN32 OR NOT LLVM_LINK_LLVM_DYLIB)
71+
llvm_add_library(
72+
CTTestTidyModule
73+
MODULE clang-tidy/CTTestTidyModule.cpp
74+
PLUGIN_TOOL clang-tidy)
75+
endif()
7876

79-
if(CLANG_BUILT_STANDALONE)
80-
# LLVMHello library is needed below
81-
if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Transforms/Hello
82-
AND NOT TARGET LLVMHello)
83-
add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Transforms/Hello
84-
lib/Transforms/Hello)
85-
endif()
77+
if(CLANG_BUILT_STANDALONE)
78+
# LLVMHello library is needed below
79+
if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Transforms/Hello
80+
AND NOT TARGET LLVMHello)
81+
add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Transforms/Hello
82+
lib/Transforms/Hello)
8683
endif()
84+
endif()
8785

88-
if(TARGET CTTestTidyModule)
89-
list(APPEND CLANG_TOOLS_TEST_DEPS CTTestTidyModule LLVMHello)
90-
target_include_directories(CTTestTidyModule PUBLIC BEFORE "${CLANG_TOOLS_SOURCE_DIR}")
91-
if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
92-
set(LLVM_LINK_COMPONENTS
93-
Support
94-
)
95-
endif()
96-
endif()
86+
if(TARGET CTTestTidyModule)
87+
list(APPEND CLANG_TOOLS_TEST_DEPS CTTestTidyModule LLVMHello)
88+
target_include_directories(CTTestTidyModule PUBLIC BEFORE "${CLANG_TOOLS_SOURCE_DIR}")
89+
if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
90+
set(LLVM_LINK_COMPONENTS
91+
Support
92+
)
93+
endif()
9794
endif()
9895

9996
add_lit_testsuite(check-clang-extra "Running clang-tools-extra/test"

clang-tools-extra/test/lit.site.cfg.py.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ config.python_executable = "@Python3_EXECUTABLE@"
1010
config.target_triple = "@LLVM_TARGET_TRIPLE@"
1111
config.host_triple = "@LLVM_HOST_TRIPLE@"
1212
config.clang_tidy_staticanalyzer = @CLANG_TIDY_ENABLE_STATIC_ANALYZER@
13-
config.has_plugins = @CLANG_PLUGIN_SUPPORT@ & ~@LLVM_INSTALL_TOOLCHAIN_ONLY@
13+
config.has_plugins = @CLANG_PLUGIN_SUPPORT@
1414
# Support substitution of the tools and libs dirs with user parameters. This is
1515
# used when we can't determine the tool dir at configuration time.
1616
config.llvm_tools_dir = lit_config.substitute("@LLVM_TOOLS_DIR@")

0 commit comments

Comments
 (0)