File tree 6 files changed +28
-19
lines changed
6 files changed +28
-19
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,7 @@ option(LIBCXX_ENABLE_VENDOR_AVAILABILITY_ANNOTATIONS
123
123
to provide compile-time errors when using features unavailable on some version of
124
124
the shared library they shipped should turn this on and see `include/__availability`
125
125
for more details." OFF )
126
+ option (LIBCXX_ENABLE_CLANG_TIDY "Whether to compile and run clang-tidy checks" OFF )
126
127
127
128
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
128
129
set (LIBCXX_DEFAULT_TEST_CONFIG "llvm-libc++-shared-gcc.cfg.in" )
@@ -862,6 +863,10 @@ add_subdirectory(modules)
862
863
863
864
set (LIBCXX_TEST_DEPS "cxx_experimental" )
864
865
866
+ if (LIBCXX_ENABLE_CLANG_TIDY)
867
+ list (APPEND LIBCXX_TEST_DEPS cxx-tidy)
868
+ endif ()
869
+
865
870
list (APPEND LIBCXX_TEST_DEPS generate-cxx-modules)
866
871
867
872
if (LIBCXX_INCLUDE_BENCHMARKS)
Original file line number Diff line number Diff line change @@ -82,6 +82,7 @@ Deprecations and Removals
82
82
libatomic is not available. If you are one such user, please reach out to the libc++ developers so we can collaborate
83
83
on a path for supporting atomics properly on freestanding platforms.
84
84
85
+
85
86
Upcoming Deprecations and Removals
86
87
----------------------------------
87
88
@@ -106,6 +107,3 @@ Build System Changes
106
107
107
108
- The ``LIBCXX_EXECUTOR `` and ``LIBCXXABI_EXECUTOR `` CMake variables have been removed. Please
108
109
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.
Original file line number Diff line number Diff line change 1
1
2
2
set (LIBCXX_TEST_TOOLS_PATH ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
3
3
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 ()
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)
7
12
endif ()
8
- add_subdirectory (clang_tidy_checks)
Original file line number Diff line number Diff line change @@ -9,17 +9,6 @@ set(Clang_DIR_SAVE ${Clang_DIR})
9
9
# versions must match. Otherwise there likely will be ODR-violations. This had
10
10
# led to crashes and incorrect output of the clang-tidy based checks.
11
11
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." )
23
12
24
13
set (SOURCES
25
14
abi_tag_on_virtual.cpp
@@ -33,7 +22,11 @@ set(SOURCES
33
22
libcpp_module.cpp
34
23
)
35
24
36
- list (APPEND LIBCXX_TEST_DEPS cxx-tidy)
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 ()
37
30
38
31
set (LLVM_DIR "${LLVM_DIR_SAVE} " CACHE PATH "The directory containing a CMake configuration file for LLVM." FORCE)
39
32
set (Clang_DIR "${Clang_DIR_SAVE} " CACHE PATH "The directory containing a CMake configuration file for Clang." FORCE)
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ definitions:
43
43
44
44
environment_definitions :
45
45
_common_env : &common_env
46
+ ENABLE_CLANG_TIDY : " On"
46
47
LLVM_SYMBOLIZER_PATH : " /usr/bin/llvm-symbolizer-${LLVM_HEAD_VERSION}"
47
48
CLANG_CRASH_DIAGNOSTICS_DIR : " crash_diagnostics"
48
49
CC : clang-${LLVM_HEAD_VERSION}
Original file line number Diff line number Diff line change @@ -44,6 +44,9 @@ CMAKE The CMake binary to use. This variable is optional.
44
44
CLANG_FORMAT The clang-format binary to use when generating the format
45
45
ignore list.
46
46
47
+ ENABLE_CLANG_TIDY Whether to compile and run clang-tidy checks. This variable
48
+ is optional.
49
+
47
50
EOF
48
51
}
49
52
@@ -108,6 +111,10 @@ function clean() {
108
111
rm -rf " ${BUILD_DIR} "
109
112
}
110
113
114
+ if [ -z " ${ENABLE_CLANG_TIDY} " ]; then
115
+ ENABLE_CLANG_TIDY=Off
116
+ fi
117
+
111
118
function generate-cmake-base() {
112
119
echo " --- Generating CMake"
113
120
${CMAKE} \
@@ -119,6 +126,7 @@ function generate-cmake-base() {
119
126
-DLIBCXX_ENABLE_WERROR=YES \
120
127
-DLIBCXXABI_ENABLE_WERROR=YES \
121
128
-DLIBUNWIND_ENABLE_WERROR=YES \
129
+ -DLIBCXX_ENABLE_CLANG_TIDY=${ENABLE_CLANG_TIDY} \
122
130
-DLLVM_LIT_ARGS=" -sv --xunit-xml-output test-results.xml --timeout=1500 --time-tests" \
123
131
" ${@ } "
124
132
}
You can’t perform that action at this time.
0 commit comments