Skip to content

Commit 4109b18

Browse files
authored
[libc++][CMake] Removes LIBCXX_ENABLE_CLANG_TIDY. (llvm#85262)
The clang-tidy selection in CMake was refactored in llvm#81362. During review it was suggested to remove this CMake option.
1 parent 4ea850b commit 4109b18

File tree

6 files changed

+19
-28
lines changed

6 files changed

+19
-28
lines changed

libcxx/CMakeLists.txt

-5
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ option(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS
123123
to provide compile-time errors when using features unavailable on some version of
124124
the shared library they shipped should turn this on and see `include/__availability`
125125
for more details." OFF)
126-
option(LIBCXX_ENABLE_CLANG_TIDY "Whether to compile and run clang-tidy checks" OFF)
127126

128127
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
129128
set(LIBCXX_DEFAULT_TEST_CONFIG "llvm-libc++-shared-gcc.cfg.in")
@@ -863,10 +862,6 @@ add_subdirectory(modules)
863862

864863
set(LIBCXX_TEST_DEPS "cxx_experimental")
865864

866-
if (LIBCXX_ENABLE_CLANG_TIDY)
867-
list(APPEND LIBCXX_TEST_DEPS cxx-tidy)
868-
endif()
869-
870865
list(APPEND LIBCXX_TEST_DEPS generate-cxx-modules)
871866

872867
if (LIBCXX_INCLUDE_BENCHMARKS)

libcxx/docs/ReleaseNotes/19.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ Deprecations and Removals
8282
libatomic is not available. If you are one such user, please reach out to the libc++ developers so we can collaborate
8383
on a path for supporting atomics properly on freestanding platforms.
8484

85-
8685
Upcoming Deprecations and Removals
8786
----------------------------------
8887

@@ -107,3 +106,6 @@ Build System Changes
107106

108107
- The ``LIBCXX_EXECUTOR`` and ``LIBCXXABI_EXECUTOR`` CMake variables have been removed. Please
109108
set ``LIBCXX_TEST_PARAMS`` to ``executor=<...>`` instead.
109+
110+
- The Cmake variable ``LIBCXX_ENABLE_CLANG_TIDY`` has been removed. The build system has been changed
111+
to automatically detect the presence of ``clang-tidy`` and the required ``Clang`` libraries.

libcxx/test/tools/CMakeLists.txt

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11

22
set(LIBCXX_TEST_TOOLS_PATH ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
33

4-
# TODO: Remove LIBCXX_ENABLE_CLANG_TIDY
5-
if(LIBCXX_ENABLE_CLANG_TIDY)
6-
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
7-
message(STATUS "Clang-tidy can only be used when building libc++ with "
8-
"a clang compiler.")
9-
return()
10-
endif()
11-
add_subdirectory(clang_tidy_checks)
4+
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
5+
message(STATUS "Clang-tidy tests are disabled due to non-clang based compiler.")
6+
return()
127
endif()
8+
add_subdirectory(clang_tidy_checks)

libcxx/test/tools/clang_tidy_checks/CMakeLists.txt

+12-5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ set(Clang_DIR_SAVE ${Clang_DIR})
99
# versions must match. Otherwise there likely will be ODR-violations. This had
1010
# led to crashes and incorrect output of the clang-tidy based checks.
1111
find_package(Clang ${CMAKE_CXX_COMPILER_VERSION})
12+
if(NOT Clang_FOUND)
13+
message(STATUS "Clang-tidy tests are disabled since the "
14+
"Clang development package is unavailable.")
15+
return()
16+
endif()
17+
if(NOT TARGET clangTidy)
18+
message(STATUS "Clang-tidy tests are disabled since the "
19+
"Clang development package has no clangTidy target.")
20+
return()
21+
endif()
22+
message(STATUS "Clang-tidy tests are enabled.")
1223

1324
set(SOURCES
1425
abi_tag_on_virtual.cpp
@@ -22,11 +33,7 @@ set(SOURCES
2233
libcpp_module.cpp
2334
)
2435

25-
if(NOT Clang_FOUND)
26-
message(STATUS "Could not find a suitable version of the Clang development package;
27-
custom libc++ clang-tidy checks will not be available.")
28-
return()
29-
endif()
36+
list(APPEND LIBCXX_TEST_DEPS cxx-tidy)
3037

3138
set(LLVM_DIR "${LLVM_DIR_SAVE}" CACHE PATH "The directory containing a CMake configuration file for LLVM." FORCE)
3239
set(Clang_DIR "${Clang_DIR_SAVE}" CACHE PATH "The directory containing a CMake configuration file for Clang." FORCE)

libcxx/utils/ci/buildkite-pipeline.yml

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ definitions:
4343

4444
environment_definitions:
4545
_common_env: &common_env
46-
ENABLE_CLANG_TIDY: "On"
4746
LLVM_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer-${LLVM_HEAD_VERSION}"
4847
CLANG_CRASH_DIAGNOSTICS_DIR: "crash_diagnostics"
4948
CC: clang-${LLVM_HEAD_VERSION}

libcxx/utils/ci/run-buildbot

-8
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,6 @@ CMAKE The CMake binary to use. This variable is optional.
4444
CLANG_FORMAT The clang-format binary to use when generating the format
4545
ignore list.
4646
47-
ENABLE_CLANG_TIDY Whether to compile and run clang-tidy checks. This variable
48-
is optional.
49-
5047
EOF
5148
}
5249

@@ -111,10 +108,6 @@ function clean() {
111108
rm -rf "${BUILD_DIR}"
112109
}
113110

114-
if [ -z "${ENABLE_CLANG_TIDY}" ]; then
115-
ENABLE_CLANG_TIDY=Off
116-
fi
117-
118111
function generate-cmake-base() {
119112
echo "--- Generating CMake"
120113
${CMAKE} \
@@ -126,7 +119,6 @@ function generate-cmake-base() {
126119
-DLIBCXX_ENABLE_WERROR=YES \
127120
-DLIBCXXABI_ENABLE_WERROR=YES \
128121
-DLIBUNWIND_ENABLE_WERROR=YES \
129-
-DLIBCXX_ENABLE_CLANG_TIDY=${ENABLE_CLANG_TIDY} \
130122
-DLLVM_LIT_ARGS="-sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
131123
"${@}"
132124
}

0 commit comments

Comments
 (0)