[clang] 9197834 - Revert "Fix CLANG_ENABLE_STATIC_ANALYZER=OFF building all analyzer source"
Nico Weber via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 20 13:19:09 PDT 2021
Author: Nico Weber
Date: 2021-09-20T16:18:03-04:00
New Revision: 9197834535364efff505580ef940ad41cd293275
URL: https://github.com/llvm/llvm-project/commit/9197834535364efff505580ef940ad41cd293275
DIFF: https://github.com/llvm/llvm-project/commit/9197834535364efff505580ef940ad41cd293275.diff
LOG: Revert "Fix CLANG_ENABLE_STATIC_ANALYZER=OFF building all analyzer source"
This reverts commit 6d7b3d6b3a8dbd62650b6c3dae1fe904a8ae9048.
Breaks running cmake with `-DCLANG_ENABLE_STATIC_ANALYZER=OFF`
without turning off CLANG_TIDY_ENABLE_STATIC_ANALYZER.
See comments on https://reviews.llvm.org/D109611 for details.
Added:
Modified:
clang/cmake/modules/AddClang.cmake
clang/lib/StaticAnalyzer/CMakeLists.txt
llvm/cmake/modules/AddLLVM.cmake
Removed:
################################################################################
diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake
index c2d46b743b856..5752f4277444e 100644
--- a/clang/cmake/modules/AddClang.cmake
+++ b/clang/cmake/modules/AddClang.cmake
@@ -100,12 +100,7 @@ macro(add_clang_library name)
# The Xcode generator doesn't handle object libraries correctly.
list(APPEND LIBTYPE OBJECT)
endif()
- if (NOT EXCLUDE_FROM_ALL)
- # Only include libraries that don't have EXCLUDE_FROM_ALL set. This
- # ensure that the clang static analyzer libraries are not compiled
- # as part of clang-shlib if CLANG_ENABLE_STATIC_ANALYZER=OFF.
- set_property(GLOBAL APPEND PROPERTY CLANG_STATIC_LIBS ${name})
- endif()
+ set_property(GLOBAL APPEND PROPERTY CLANG_STATIC_LIBS ${name})
endif()
llvm_add_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs})
@@ -115,11 +110,8 @@ macro(add_clang_library name)
endif()
foreach(lib ${libs})
- if(TARGET ${lib})
+ if(TARGET ${lib})
target_link_libraries(${lib} INTERFACE ${LLVM_COMMON_LIBS})
- if (EXCLUDE_FROM_ALL)
- continue()
- endif()
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ARG_INSTALL_WITH_TOOLCHAIN)
get_target_export_arg(${name} Clang export_to_clangtargets UMBRELLA clang-libraries)
diff --git a/clang/lib/StaticAnalyzer/CMakeLists.txt b/clang/lib/StaticAnalyzer/CMakeLists.txt
index a610252e1de7a..3d1509254f52f 100644
--- a/clang/lib/StaticAnalyzer/CMakeLists.txt
+++ b/clang/lib/StaticAnalyzer/CMakeLists.txt
@@ -1,10 +1,3 @@
-# These directories can significantly impact build time, only build
-# them if anything depends on the clangStaticAnalyzer* libraries.
-if(NOT CLANG_ENABLE_STATIC_ANALYZER)
- set_property(DIRECTORY PROPERTY EXCLUDE_FROM_ALL ON)
- set(EXCLUDE_FROM_ALL ON)
-endif()
-
add_subdirectory(Core)
add_subdirectory(Checkers)
add_subdirectory(Frontend)
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index dca1c2af45bb1..c5a9e0209f13b 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -429,13 +429,10 @@ endfunction(set_windows_version_resource_properties)
# This is used to specify that this is a component library of
# LLVM which means that the source resides in llvm/lib/ and it is a
# candidate for inclusion into libLLVM.so.
-# EXCLUDE_FROM_ALL
-# Do not build this library as part of the default target, only
-# if explicitly requested or when linked against.
# )
function(llvm_add_library name)
cmake_parse_arguments(ARG
- "MODULE;SHARED;STATIC;OBJECT;DISABLE_LLVM_LINK_LLVM_DYLIB;SONAME;NO_INSTALL_RPATH;COMPONENT_LIB;EXCLUDE_FROM_ALL"
+ "MODULE;SHARED;STATIC;OBJECT;DISABLE_LLVM_LINK_LLVM_DYLIB;SONAME;NO_INSTALL_RPATH;COMPONENT_LIB"
"OUTPUT_NAME;PLUGIN_TOOL;ENTITLEMENTS;BUNDLE_PATH"
"ADDITIONAL_HEADERS;DEPENDS;LINK_COMPONENTS;LINK_LIBS;OBJLIBS"
${ARGN})
@@ -538,9 +535,6 @@ function(llvm_add_library name)
# FIXME: Add name_static to anywhere in TARGET ${name}'s PROPERTY.
set(ARG_STATIC)
- if(ARG_EXCLUDE_FROM_ALL OR EXCLUDE_FROM_ALL)
- set_target_properties(${name_static} PROPERTIES EXCLUDE_FROM_ALL ON)
- endif()
endif()
if(ARG_MODULE)
@@ -552,10 +546,6 @@ function(llvm_add_library name)
add_library(${name} STATIC ${ALL_FILES})
endif()
- if(ARG_EXCLUDE_FROM_ALL OR EXCLUDE_FROM_ALL)
- set_target_properties(${name} PROPERTIES EXCLUDE_FROM_ALL ON)
- endif()
-
if(ARG_COMPONENT_LIB)
set_target_properties(${name} PROPERTIES LLVM_COMPONENT TRUE)
set_property(GLOBAL APPEND PROPERTY LLVM_COMPONENT_LIBS ${name})
More information about the cfe-commits
mailing list