Skip to content

Commit 26fdc97

Browse files
committed
[libc++][CMake] Removes LIBCXX_ENABLE_CLANG_TIDY.
The clang-tidy selection in CMake was refactored in #81362. During review it was suggested to remove this CMake option.
1 parent 6ae4fcf commit 26fdc97

File tree

6 files changed

+14
-27
lines changed

6 files changed

+14
-27
lines changed

libcxx/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ Deprecations and Removals
8080
libatomic is not available. If you are one such user, please reach out to the libc++ developers so we can collaborate
8181
on a path for supporting atomics properly on freestanding platforms.
8282

83+
- The Cmake variable ``LIBCXX_ENABLE_CLANG_TIDY`` has been removed. The build system has been changed
84+
to automatically detect the presence of ``clang-tidy`` and the required ``Clang`` libraries.
8385

8486
Upcoming Deprecations and Removals
8587
----------------------------------

libcxx/test/tools/CMakeLists.txt

Lines changed: 4 additions & 8 deletions
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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ 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+
else()
17+
message(STATUS "Clang-tidy tests are enabled.")
18+
endif()
1219

1320
set(SOURCES
1421
abi_tag_on_virtual.cpp
@@ -22,11 +29,7 @@ set(SOURCES
2229
libcpp_module.cpp
2330
)
2431

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()
32+
list(APPEND LIBCXX_TEST_DEPS cxx-tidy)
3033

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

libcxx/utils/ci/buildkite-pipeline.yml

Lines changed: 0 additions & 1 deletion
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

Lines changed: 0 additions & 8 deletions
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)