mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 12:16:49 +00:00
Revert "[libc++][CMake] Removes LIBCXX_ENABLE_CLANG_TIDY. (#85262)"
This reverts commit 4109b18ee5de1346c2b89a5c89b86bae5c8631d3. It looks like the automatic detection has false positives. This broke the following build https://github.com/llvm/llvm-project/pull/85262
This commit is contained in:
parent
39c739eec9
commit
f804217155
@ -123,6 +123,7 @@ option(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS
|
||||
to provide compile-time errors when using features unavailable on some version of
|
||||
the shared library they shipped should turn this on and see `include/__availability`
|
||||
for more details." OFF)
|
||||
option(LIBCXX_ENABLE_CLANG_TIDY "Whether to compile and run clang-tidy checks" OFF)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
set(LIBCXX_DEFAULT_TEST_CONFIG "llvm-libc++-shared-gcc.cfg.in")
|
||||
@ -862,6 +863,10 @@ add_subdirectory(modules)
|
||||
|
||||
set(LIBCXX_TEST_DEPS "cxx_experimental")
|
||||
|
||||
if (LIBCXX_ENABLE_CLANG_TIDY)
|
||||
list(APPEND LIBCXX_TEST_DEPS cxx-tidy)
|
||||
endif()
|
||||
|
||||
list(APPEND LIBCXX_TEST_DEPS generate-cxx-modules)
|
||||
|
||||
if (LIBCXX_INCLUDE_BENCHMARKS)
|
||||
|
@ -82,6 +82,7 @@ Deprecations and Removals
|
||||
libatomic is not available. If you are one such user, please reach out to the libc++ developers so we can collaborate
|
||||
on a path for supporting atomics properly on freestanding platforms.
|
||||
|
||||
|
||||
Upcoming Deprecations and Removals
|
||||
----------------------------------
|
||||
|
||||
@ -106,6 +107,3 @@ Build System Changes
|
||||
|
||||
- The ``LIBCXX_EXECUTOR`` and ``LIBCXXABI_EXECUTOR`` CMake variables have been removed. Please
|
||||
set ``LIBCXX_TEST_PARAMS`` to ``executor=<...>`` instead.
|
||||
|
||||
- The Cmake variable ``LIBCXX_ENABLE_CLANG_TIDY`` has been removed. The build system has been changed
|
||||
to automatically detect the presence of ``clang-tidy`` and the required ``Clang`` libraries.
|
||||
|
@ -1,8 +1,12 @@
|
||||
|
||||
set(LIBCXX_TEST_TOOLS_PATH ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
|
||||
|
||||
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
message(STATUS "Clang-tidy tests are disabled due to non-clang based compiler.")
|
||||
return()
|
||||
# TODO: Remove LIBCXX_ENABLE_CLANG_TIDY
|
||||
if(LIBCXX_ENABLE_CLANG_TIDY)
|
||||
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
||||
message(STATUS "Clang-tidy can only be used when building libc++ with "
|
||||
"a clang compiler.")
|
||||
return()
|
||||
endif()
|
||||
add_subdirectory(clang_tidy_checks)
|
||||
endif()
|
||||
add_subdirectory(clang_tidy_checks)
|
||||
|
@ -9,17 +9,6 @@ set(Clang_DIR_SAVE ${Clang_DIR})
|
||||
# versions must match. Otherwise there likely will be ODR-violations. This had
|
||||
# led to crashes and incorrect output of the clang-tidy based checks.
|
||||
find_package(Clang ${CMAKE_CXX_COMPILER_VERSION})
|
||||
if(NOT Clang_FOUND)
|
||||
message(STATUS "Clang-tidy tests are disabled since the "
|
||||
"Clang development package is unavailable.")
|
||||
return()
|
||||
endif()
|
||||
if(NOT TARGET clangTidy)
|
||||
message(STATUS "Clang-tidy tests are disabled since the "
|
||||
"Clang development package has no clangTidy target.")
|
||||
return()
|
||||
endif()
|
||||
message(STATUS "Clang-tidy tests are enabled.")
|
||||
|
||||
set(SOURCES
|
||||
abi_tag_on_virtual.cpp
|
||||
@ -33,7 +22,11 @@ set(SOURCES
|
||||
libcpp_module.cpp
|
||||
)
|
||||
|
||||
list(APPEND LIBCXX_TEST_DEPS cxx-tidy)
|
||||
if(NOT Clang_FOUND)
|
||||
message(STATUS "Could not find a suitable version of the Clang development package;
|
||||
custom libc++ clang-tidy checks will not be available.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(LLVM_DIR "${LLVM_DIR_SAVE}" CACHE PATH "The directory containing a CMake configuration file for LLVM." FORCE)
|
||||
set(Clang_DIR "${Clang_DIR_SAVE}" CACHE PATH "The directory containing a CMake configuration file for Clang." FORCE)
|
||||
|
@ -43,6 +43,7 @@ definitions:
|
||||
|
||||
environment_definitions:
|
||||
_common_env: &common_env
|
||||
ENABLE_CLANG_TIDY: "On"
|
||||
LLVM_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer-${LLVM_HEAD_VERSION}"
|
||||
CLANG_CRASH_DIAGNOSTICS_DIR: "crash_diagnostics"
|
||||
CC: clang-${LLVM_HEAD_VERSION}
|
||||
|
@ -44,6 +44,9 @@ CMAKE The CMake binary to use. This variable is optional.
|
||||
CLANG_FORMAT The clang-format binary to use when generating the format
|
||||
ignore list.
|
||||
|
||||
ENABLE_CLANG_TIDY Whether to compile and run clang-tidy checks. This variable
|
||||
is optional.
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
@ -108,6 +111,10 @@ function clean() {
|
||||
rm -rf "${BUILD_DIR}"
|
||||
}
|
||||
|
||||
if [ -z "${ENABLE_CLANG_TIDY}" ]; then
|
||||
ENABLE_CLANG_TIDY=Off
|
||||
fi
|
||||
|
||||
function generate-cmake-base() {
|
||||
echo "--- Generating CMake"
|
||||
${CMAKE} \
|
||||
@ -119,6 +126,7 @@ function generate-cmake-base() {
|
||||
-DLIBCXX_ENABLE_WERROR=YES \
|
||||
-DLIBCXXABI_ENABLE_WERROR=YES \
|
||||
-DLIBUNWIND_ENABLE_WERROR=YES \
|
||||
-DLIBCXX_ENABLE_CLANG_TIDY=${ENABLE_CLANG_TIDY} \
|
||||
-DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
|
||||
"${@}"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user