Skip to content

Commit a42f1f8

Browse files
vtjnashtstellar
authored andcommitted
replace clang LLVM_ENABLE_PLUGINS -> CLANG_PLUGIN_SUPPORT in tests
Ensure CLANG_PLUGIN_SUPPORT is compatible with llvm_add_library. Fixes an issue noted in D111100. Differential Revision: https://reviews.llvm.org/D119199 (cherry picked from commit 76cad51)
1 parent ae88d88 commit a42f1f8

File tree

12 files changed

+25
-14
lines changed

12 files changed

+25
-14
lines changed

clang-tools-extra/test/CMakeLists.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUN
1717

1818
llvm_canonicalize_cmake_booleans(
1919
CLANG_TIDY_ENABLE_STATIC_ANALYZER
20-
LLVM_ENABLE_PLUGINS
20+
CLANG_PLUGIN_SUPPORT
2121
LLVM_INSTALL_TOOLCHAIN_ONLY
2222
)
2323

@@ -87,10 +87,19 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
8787
PLUGIN_TOOL clang-tidy
8888
DEPENDS clang-tidy-headers)
8989

90+
if(CLANG_BUILT_STANDALONE)
91+
# LLVMHello library is needed below
92+
if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Transforms/Hello
93+
AND NOT TARGET LLVMHello)
94+
add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Transforms/Hello
95+
lib/Transforms/Hello)
96+
endif()
97+
endif()
98+
9099
if(TARGET CTTestTidyModule)
91100
list(APPEND CLANG_TOOLS_TEST_DEPS CTTestTidyModule LLVMHello)
92101
target_include_directories(CTTestTidyModule PUBLIC BEFORE "${CLANG_TOOLS_SOURCE_DIR}")
93-
if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
102+
if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
94103
set(LLVM_LINK_COMPONENTS
95104
Support
96105
)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ config.clang_libs_dir = "@SHLIBDIR@"
1212
config.python_executable = "@Python3_EXECUTABLE@"
1313
config.target_triple = "@TARGET_TRIPLE@"
1414
config.clang_tidy_staticanalyzer = @CLANG_TIDY_ENABLE_STATIC_ANALYZER@
15-
config.has_plugins = @LLVM_ENABLE_PLUGINS@ & ~@LLVM_INSTALL_TOOLCHAIN_ONLY@
15+
config.has_plugins = @CLANG_PLUGIN_SUPPORT@ & ~@LLVM_INSTALL_TOOLCHAIN_ONLY@
1616

1717
# Support substitution of the tools and libs dirs with user parameters. This is
1818
# used when we can't determine the tool dir at configuration time.

clang/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,10 @@ add_definitions( -D_GNU_SOURCE )
476476
option(CLANG_BUILD_TOOLS
477477
"Build the Clang tools. If OFF, just generate build targets." ON)
478478

479+
CMAKE_DEPENDENT_OPTION(CLANG_PLUGIN_SUPPORT
480+
"Build clang with plugin support" ON
481+
"LLVM_ENABLE_PLUGINS OR LLVM_EXPORT_SYMBOLS_FOR_PLUGINS" OFF)
482+
479483
option(CLANG_ENABLE_ARCMT "Build ARCMT." ON)
480484
option(CLANG_ENABLE_STATIC_ANALYZER
481485
"Include static analyzer in clang binary." ON)

clang/examples/AnnotateFunctions/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
add_llvm_library(AnnotateFunctions MODULE AnnotateFunctions.cpp PLUGIN_TOOL clang)
22

3-
if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
3+
if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
44
set(LLVM_LINK_COMPONENTS
55
Support
66
)

clang/examples/Attribute/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
add_llvm_library(Attribute MODULE Attribute.cpp PLUGIN_TOOL clang)
22

3-
if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
3+
if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
44
target_link_libraries(Attribute PRIVATE
55
clangAST
66
clangBasic

clang/examples/CallSuperAttribute/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
add_llvm_library(CallSuperAttr MODULE CallSuperAttrInfo.cpp PLUGIN_TOOL clang)
22

3-
if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
3+
if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
44
set(LLVM_LINK_COMPONENTS
55
Support
66
)

clang/examples/PluginsOrder/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
add_llvm_library(PluginsOrder MODULE PluginsOrder.cpp PLUGIN_TOOL clang)
22

3-
if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
3+
if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
44
set(LLVM_LINK_COMPONENTS
55
Support
66
)

clang/examples/PrintFunctionNames/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ endif()
1111

1212
add_llvm_library(PrintFunctionNames MODULE PrintFunctionNames.cpp PLUGIN_TOOL clang)
1313

14-
if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
14+
if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
1515
set(LLVM_LINK_COMPONENTS
1616
Support
1717
)

clang/lib/Analysis/plugins/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
if(CLANG_ENABLE_STATIC_ANALYZER AND LLVM_ENABLE_PLUGINS)
1+
if(CLANG_ENABLE_STATIC_ANALYZER AND CLANG_PLUGIN_SUPPORT)
22
add_subdirectory(SampleAnalyzer)
33
add_subdirectory(CheckerDependencyHandling)
44
add_subdirectory(CheckerOptionHandling)

clang/test/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ llvm_canonicalize_cmake_booleans(
1414
CLANG_DEFAULT_PIE_ON_LINUX
1515
CLANG_ENABLE_ARCMT
1616
CLANG_ENABLE_STATIC_ANALYZER
17+
CLANG_PLUGIN_SUPPORT
1718
CLANG_SPAWN_CC1
1819
ENABLE_BACKTRACES
1920
LLVM_ENABLE_NEW_PASS_MANAGER
2021
LLVM_ENABLE_ZLIB
2122
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
22-
LLVM_ENABLE_PLUGINS
2323
LLVM_ENABLE_THREADS
2424
LLVM_WITH_Z3
2525
)
@@ -145,7 +145,7 @@ if( NOT CLANG_BUILT_STANDALONE )
145145
endif()
146146

147147
if (CLANG_ENABLE_STATIC_ANALYZER)
148-
if (LLVM_ENABLE_PLUGINS)
148+
if (CLANG_PLUGIN_SUPPORT)
149149
list(APPEND CLANG_TEST_DEPS
150150
SampleAnalyzerPlugin
151151
CheckerDependencyHandlingAnalyzerPlugin

0 commit comments

Comments
 (0)