File tree Expand file tree Collapse file tree 5 files changed +43
-6
lines changed Expand file tree Collapse file tree 5 files changed +43
-6
lines changed Original file line number Diff line number Diff line change @@ -213,11 +213,18 @@ export namespace std {
213
213
using std::chrono::ambiguous_local_time;
214
214
using std::chrono::nonexistent_local_time;
215
215
# endif // if 0
216
+ # endif // _LIBCPP_ENABLE_EXPERIMENTAL
217
+ #endif // !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) &&
218
+ // !defined(_LIBCPP_HAS_NO_LOCALIZATION)
216
219
217
220
// [time.zone.info], information classes
218
221
using std::chrono::local_info;
219
222
using std::chrono::sys_info;
220
223
224
+ #if !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) && \
225
+ !defined(_LIBCPP_HAS_NO_LOCALIZATION)
226
+
227
+ # ifdef _LIBCPP_ENABLE_EXPERIMENTAL
221
228
# if 0
222
229
// [time.zone.timezone], class time_zone
223
230
using std::chrono::choose;
@@ -248,7 +255,7 @@ export namespace std {
248
255
# endif
249
256
# endif // _LIBCPP_ENABLE_EXPERIMENTAL
250
257
#endif // !defined(_LIBCPP_HAS_NO_TIME_ZONE_DATABASE) && !defined(_LIBCPP_HAS_NO_FILESYSTEM) &&
251
- // !defined(_LIBCPP_HAS_NO_LOCALIZATION)
258
+ // !defined(_LIBCPP_HAS_NO_LOCALIZATION)
252
259
253
260
} // namespace chrono
254
261
Original file line number Diff line number Diff line change @@ -138,9 +138,6 @@ export namespace std {
138
138
}
139
139
#endif // _LIBCPP_HAS_NO_LOCALIZATION
140
140
141
- #if _LIBCPP_STD_VER >= 23
142
- // [range.adaptor.object], range adaptor objects
143
- using std::ranges::range_adaptor_closure;
144
141
// Note: This declaration not in the synopsis or explicitly in the wording.
145
142
// However it is needed for the range adaptors.
146
143
// [range.adaptor.object]/3
@@ -151,7 +148,11 @@ export namespace std {
151
148
// involving an object of type cv D as an operand to the | operator is
152
149
// undefined if overload resolution selects a program-defined operator|
153
150
// function.
151
+ // This is used internally in C++20 mode.
154
152
using std::ranges::operator |;
153
+ #if _LIBCPP_STD_VER >= 23
154
+ // [range.adaptor.object], range adaptor objects
155
+ using std::ranges::range_adaptor_closure;
155
156
#endif
156
157
157
158
// [range.all], all view
Original file line number Diff line number Diff line change 1
1
include (HandleLitArguments )
2
2
add_subdirectory (tools )
3
+ # When the tools add clang-tidy support, the dependencies need to be updated.
4
+ # This cannot be done in the tools CMakeLists.txt since that does not update
5
+ # the status in this (a parent) directory.
6
+ if (TARGET cxx-tidy )
7
+ list (APPEND LIBCXX_TEST_DEPS cxx-tidy )
8
+ endif ()
3
9
4
10
# By default, libcxx and libcxxabi share a library directory.
5
11
if (NOT LIBCXX_CXX_ABI_LIBRARY_PATH )
Original file line number Diff line number Diff line change 26
26
// The GCC compiler flags are not always compatible with clang-tidy.
27
27
// UNSUPPORTED: gcc
28
28
29
+ // Clang 17 has false positives.
30
+ // UNSUPPORTED: clang-17
31
+
29
32
{ lit_header_restrictions .get (header , '' )}
30
33
31
34
// TODO: run clang-tidy with modules enabled once they are supported
Original file line number Diff line number Diff line change @@ -64,6 +64,28 @@ if(NOT HAS_CLANG_TIDY_HEADERS)
64
64
"clang-tidy headers are not present." )
65
65
return ()
66
66
endif ()
67
+
68
+ # The clangTidy plugin uses C++20, so ensure that we support C++20 when using libstdc++.
69
+ # This is required because some versions of libstdc++ used as a system library on build platforms
70
+ # we support do not support C++20 yet.
71
+ # Note it has not been tested whether version 11 works.
72
+ file (WRITE "${CMAKE_CURRENT_BINARY_DIR} /test.cpp" "
73
+ #include <version>
74
+ #if defined(_GLIBCXX_RELEASE) && _GLIBCXX_RELEASE < 12
75
+ # error The libstdc++ version is too old.
76
+ #endif
77
+ int main(){}
78
+ " )
79
+ try_compile (HAS_NEWER_STANDARD_LIBRARY
80
+ "${CMAKE_CURRENT_BINARY_DIR} "
81
+ "${CMAKE_CURRENT_BINARY_DIR} /test.cpp"
82
+ LINK_LIBRARIES clangTidy )
83
+
84
+ if (NOT HAS_NEWER_STANDARD_LIBRARY )
85
+ message (STATUS "Clang-tidy tests are disabled due to using "
86
+ "stdlibc++ older than version 12" )
87
+ return ()
88
+ endif ()
67
89
message (STATUS "Clang-tidy tests are enabled." )
68
90
69
91
set (SOURCES
@@ -88,5 +110,3 @@ set_target_properties(cxx-tidy PROPERTIES
88
110
89
111
set_target_properties (cxx-tidy PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} )
90
112
set (CMAKE_SHARED_MODULE_SUFFIX_CXX .plugin ) # Use a portable suffix to simplify how we can find it from Lit
91
-
92
- list (APPEND LIBCXX_TEST_DEPS cxx-tidy )
You can’t perform that action at this time.
0 commit comments