[llvm-branch-commits] [clang-tools-extra] a42f1f8 - replace clang LLVM_ENABLE_PLUGINS -> CLANG_PLUGIN_SUPPORT in tests

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Feb 14 14:15:36 PST 2022


Author: Jameson Nash
Date: 2022-02-14T14:11:28-08:00
New Revision: a42f1f88f1361bd010fbec932d70f698853488ec

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

LOG: 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 76cad51ba700233d6e3492eddcbb466b6adbc2eb)

Added: 
    

Modified: 
    clang-tools-extra/test/CMakeLists.txt
    clang-tools-extra/test/lit.site.cfg.py.in
    clang/CMakeLists.txt
    clang/examples/AnnotateFunctions/CMakeLists.txt
    clang/examples/Attribute/CMakeLists.txt
    clang/examples/CallSuperAttribute/CMakeLists.txt
    clang/examples/PluginsOrder/CMakeLists.txt
    clang/examples/PrintFunctionNames/CMakeLists.txt
    clang/lib/Analysis/plugins/CMakeLists.txt
    clang/test/CMakeLists.txt
    clang/test/lit.site.cfg.py.in
    clang/tools/driver/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/test/CMakeLists.txt b/clang-tools-extra/test/CMakeLists.txt
index 9321457ae1a39..170e5f8bd197d 100644
--- a/clang-tools-extra/test/CMakeLists.txt
+++ b/clang-tools-extra/test/CMakeLists.txt
@@ -17,7 +17,7 @@ string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUN
 
 llvm_canonicalize_cmake_booleans(
   CLANG_TIDY_ENABLE_STATIC_ANALYZER
-  LLVM_ENABLE_PLUGINS
+  CLANG_PLUGIN_SUPPORT
   LLVM_INSTALL_TOOLCHAIN_ONLY
   )
 
@@ -87,10 +87,19 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
       PLUGIN_TOOL clang-tidy
       DEPENDS clang-tidy-headers)
 
+  if(CLANG_BUILT_STANDALONE)
+    # LLVMHello library is needed below
+    if (EXISTS ${LLVM_MAIN_SRC_DIR}/lib/Transforms/Hello
+       AND NOT TARGET LLVMHello)
+      add_subdirectory(${LLVM_MAIN_SRC_DIR}/lib/Transforms/Hello
+        lib/Transforms/Hello)
+    endif()
+  endif()
+
   if(TARGET CTTestTidyModule)
       list(APPEND CLANG_TOOLS_TEST_DEPS CTTestTidyModule LLVMHello)
       target_include_directories(CTTestTidyModule PUBLIC BEFORE "${CLANG_TOOLS_SOURCE_DIR}")
-      if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
+      if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
         set(LLVM_LINK_COMPONENTS
           Support
         )

diff  --git a/clang-tools-extra/test/lit.site.cfg.py.in b/clang-tools-extra/test/lit.site.cfg.py.in
index e7db0e2ef2cb8..d30e6664816b7 100644
--- a/clang-tools-extra/test/lit.site.cfg.py.in
+++ b/clang-tools-extra/test/lit.site.cfg.py.in
@@ -12,7 +12,7 @@ config.clang_libs_dir = "@SHLIBDIR@"
 config.python_executable = "@Python3_EXECUTABLE@"
 config.target_triple = "@TARGET_TRIPLE@"
 config.clang_tidy_staticanalyzer = @CLANG_TIDY_ENABLE_STATIC_ANALYZER@
-config.has_plugins = @LLVM_ENABLE_PLUGINS@ & ~@LLVM_INSTALL_TOOLCHAIN_ONLY@
+config.has_plugins = @CLANG_PLUGIN_SUPPORT@ & ~@LLVM_INSTALL_TOOLCHAIN_ONLY@
 
 # 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.

diff  --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 1cc9bacf4e5eb..4225c028e1794 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -476,6 +476,10 @@ add_definitions( -D_GNU_SOURCE )
 option(CLANG_BUILD_TOOLS
   "Build the Clang tools. If OFF, just generate build targets." ON)
 
+CMAKE_DEPENDENT_OPTION(CLANG_PLUGIN_SUPPORT
+  "Build clang with plugin support" ON
+  "LLVM_ENABLE_PLUGINS OR LLVM_EXPORT_SYMBOLS_FOR_PLUGINS" OFF)
+
 option(CLANG_ENABLE_ARCMT "Build ARCMT." ON)
 option(CLANG_ENABLE_STATIC_ANALYZER
   "Include static analyzer in clang binary." ON)

diff  --git a/clang/examples/AnnotateFunctions/CMakeLists.txt b/clang/examples/AnnotateFunctions/CMakeLists.txt
index e9850b64f08d7..e6541f7cc62a6 100644
--- a/clang/examples/AnnotateFunctions/CMakeLists.txt
+++ b/clang/examples/AnnotateFunctions/CMakeLists.txt
@@ -1,6 +1,6 @@
 add_llvm_library(AnnotateFunctions MODULE AnnotateFunctions.cpp PLUGIN_TOOL clang)
 
-if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
+if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
   set(LLVM_LINK_COMPONENTS
     Support
   )

diff  --git a/clang/examples/Attribute/CMakeLists.txt b/clang/examples/Attribute/CMakeLists.txt
index 42f04f5039bc7..5392ac0df1703 100644
--- a/clang/examples/Attribute/CMakeLists.txt
+++ b/clang/examples/Attribute/CMakeLists.txt
@@ -1,6 +1,6 @@
 add_llvm_library(Attribute MODULE Attribute.cpp PLUGIN_TOOL clang)
 
-if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
+if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
   target_link_libraries(Attribute PRIVATE
     clangAST
     clangBasic

diff  --git a/clang/examples/CallSuperAttribute/CMakeLists.txt b/clang/examples/CallSuperAttribute/CMakeLists.txt
index 922f0cfa797a8..f4284adf289e3 100644
--- a/clang/examples/CallSuperAttribute/CMakeLists.txt
+++ b/clang/examples/CallSuperAttribute/CMakeLists.txt
@@ -1,6 +1,6 @@
 add_llvm_library(CallSuperAttr MODULE CallSuperAttrInfo.cpp PLUGIN_TOOL clang)
 
-if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
+if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
   set(LLVM_LINK_COMPONENTS
     Support
   )

diff  --git a/clang/examples/PluginsOrder/CMakeLists.txt b/clang/examples/PluginsOrder/CMakeLists.txt
index 289e234ac28c4..612587a6d2fe3 100644
--- a/clang/examples/PluginsOrder/CMakeLists.txt
+++ b/clang/examples/PluginsOrder/CMakeLists.txt
@@ -1,6 +1,6 @@
 add_llvm_library(PluginsOrder MODULE PluginsOrder.cpp PLUGIN_TOOL clang)
 
-if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
+if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
   set(LLVM_LINK_COMPONENTS
     Support
   )

diff  --git a/clang/examples/PrintFunctionNames/CMakeLists.txt b/clang/examples/PrintFunctionNames/CMakeLists.txt
index 63b0c015732c3..67f1b16744eaf 100644
--- a/clang/examples/PrintFunctionNames/CMakeLists.txt
+++ b/clang/examples/PrintFunctionNames/CMakeLists.txt
@@ -11,7 +11,7 @@ endif()
 
 add_llvm_library(PrintFunctionNames MODULE PrintFunctionNames.cpp PLUGIN_TOOL clang)
 
-if(LLVM_ENABLE_PLUGINS AND (WIN32 OR CYGWIN))
+if(CLANG_PLUGIN_SUPPORT AND (WIN32 OR CYGWIN))
   set(LLVM_LINK_COMPONENTS
     Support
   )

diff  --git a/clang/lib/Analysis/plugins/CMakeLists.txt b/clang/lib/Analysis/plugins/CMakeLists.txt
index bd7314a871fc5..7b754ea3f2bc9 100644
--- a/clang/lib/Analysis/plugins/CMakeLists.txt
+++ b/clang/lib/Analysis/plugins/CMakeLists.txt
@@ -1,4 +1,4 @@
-if(CLANG_ENABLE_STATIC_ANALYZER AND LLVM_ENABLE_PLUGINS)
+if(CLANG_ENABLE_STATIC_ANALYZER AND CLANG_PLUGIN_SUPPORT)
   add_subdirectory(SampleAnalyzer)
   add_subdirectory(CheckerDependencyHandling)
   add_subdirectory(CheckerOptionHandling)

diff  --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt
index 07de12b7c190b..cbe7c787a1a26 100644
--- a/clang/test/CMakeLists.txt
+++ b/clang/test/CMakeLists.txt
@@ -14,12 +14,12 @@ llvm_canonicalize_cmake_booleans(
   CLANG_DEFAULT_PIE_ON_LINUX
   CLANG_ENABLE_ARCMT
   CLANG_ENABLE_STATIC_ANALYZER
+  CLANG_PLUGIN_SUPPORT
   CLANG_SPAWN_CC1
   ENABLE_BACKTRACES
   LLVM_ENABLE_NEW_PASS_MANAGER
   LLVM_ENABLE_ZLIB
   LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
-  LLVM_ENABLE_PLUGINS
   LLVM_ENABLE_THREADS
   LLVM_WITH_Z3
   )
@@ -145,7 +145,7 @@ if( NOT CLANG_BUILT_STANDALONE )
 endif()
 
 if (CLANG_ENABLE_STATIC_ANALYZER)
-  if (LLVM_ENABLE_PLUGINS)
+  if (CLANG_PLUGIN_SUPPORT)
     list(APPEND CLANG_TEST_DEPS
       SampleAnalyzerPlugin
       CheckerDependencyHandlingAnalyzerPlugin

diff  --git a/clang/test/lit.site.cfg.py.in b/clang/test/lit.site.cfg.py.in
index bc3022d2bee9a..1e2e331d54db9 100644
--- a/clang/test/lit.site.cfg.py.in
+++ b/clang/test/lit.site.cfg.py.in
@@ -34,7 +34,7 @@ config.enable_threads = @LLVM_ENABLE_THREADS@
 config.host_arch = "@HOST_ARCH@"
 config.python_executable = "@Python3_EXECUTABLE@"
 config.use_z3_solver = lit_config.params.get('USE_Z3_SOLVER', "@USE_Z3_SOLVER@")
-config.has_plugins = @LLVM_ENABLE_PLUGINS@
+config.has_plugins = @CLANG_PLUGIN_SUPPORT@
 config.clang_vendor_uti = "@CLANG_VENDOR_UTI@"
 config.llvm_external_lit = path(r"@LLVM_EXTERNAL_LIT@")
 

diff  --git a/clang/tools/driver/CMakeLists.txt b/clang/tools/driver/CMakeLists.txt
index 52d439ce6a3b6..6b3e159d1b648 100644
--- a/clang/tools/driver/CMakeLists.txt
+++ b/clang/tools/driver/CMakeLists.txt
@@ -17,8 +17,6 @@ set( LLVM_LINK_COMPONENTS
   Vectorize
   )
 
-option(CLANG_PLUGIN_SUPPORT "Build clang with plugin support" ON)
-
 # Support plugins.
 if(CLANG_PLUGIN_SUPPORT)
   set(support_plugins SUPPORT_PLUGINS)


        


More information about the llvm-branch-commits mailing list