Skip to content

Commit dc11020

Browse files
committed
[libc++] Update the CI to Clang-20 and drop Clang-17 support
1 parent b968fd9 commit dc11020

File tree

34 files changed

+38
-138
lines changed

34 files changed

+38
-138
lines changed

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ jobs:
4848
'generic-cxx26',
4949
'generic-modules'
5050
]
51-
cc: [ 'clang-19' ]
52-
cxx: [ 'clang++-19' ]
51+
cc: [ 'clang-20' ]
52+
cxx: [ 'clang++-20' ]
5353
include:
5454
- config: 'generic-gcc'
5555
cc: 'gcc-14'
@@ -88,18 +88,18 @@ jobs:
8888
'generic-cxx20',
8989
'generic-cxx23'
9090
]
91-
cc: [ 'clang-19' ]
92-
cxx: [ 'clang++-19' ]
91+
cc: [ 'clang-20' ]
92+
cxx: [ 'clang++-20' ]
9393
include:
9494
- config: 'generic-gcc-cxx11'
9595
cc: 'gcc-14'
9696
cxx: 'g++-14'
9797
- config: 'generic-cxx23'
98-
cc: 'clang-17'
99-
cxx: 'clang++-17'
100-
- config: 'generic-cxx26'
10198
cc: 'clang-18'
10299
cxx: 'clang++-18'
100+
- config: 'generic-cxx26'
101+
cc: 'clang-19'
102+
cxx: 'clang++-19'
103103
steps:
104104
- uses: actions/checkout@v4
105105
- name: ${{ matrix.config }}
@@ -169,8 +169,8 @@ jobs:
169169
- name: ${{ matrix.config }}
170170
run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
171171
env:
172-
CC: clang-19
173-
CXX: clang++-19
172+
CC: clang-20
173+
CXX: clang++-20
174174
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
175175
if: always()
176176
with:

libcxx/include/__configuration/compiler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
// Warn if a compiler version is used that is not supported anymore
3434
// LLVM RELEASE Update the minimum compiler versions
3535
# if defined(_LIBCPP_CLANG_VER)
36-
# if _LIBCPP_CLANG_VER < 1700
37-
# warning "Libc++ only supports Clang 17 and later"
36+
# if _LIBCPP_CLANG_VER < 1800
37+
# warning "Libc++ only supports Clang 18 and later"
3838
# endif
3939
# elif defined(_LIBCPP_APPLE_CLANG_VER)
4040
# if _LIBCPP_APPLE_CLANG_VER < 1500

libcxx/include/__cxx03/__memory/uninitialized_algorithms.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,8 @@ __uninitialized_allocator_relocate(_Alloc& __alloc, _Tp* __first, _Tp* __last, _
642642
__guard.__complete();
643643
std::__allocator_destroy(__alloc, __first, __last);
644644
} else {
645-
__builtin_memcpy(const_cast<__remove_const_t<_Tp>*>(__result), __first, sizeof(_Tp) * (__last - __first));
645+
// Casting to void* to suppress clang complaining that this is technically UB.
646+
__builtin_memcpy(static_cast<void*>(__result), __first, sizeof(_Tp) * (__last - __first));
646647
}
647648
}
648649

libcxx/include/__type_traits/promote.h

Lines changed: 2 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,12 @@
1313
#include <__type_traits/integral_constant.h>
1414
#include <__type_traits/is_arithmetic.h>
1515

16-
#if defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER == 1700
17-
# include <__type_traits/is_same.h>
18-
# include <__utility/declval.h>
19-
#endif
20-
2116
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
2217
# pragma GCC system_header
2318
#endif
2419

2520
_LIBCPP_BEGIN_NAMESPACE_STD
2621

27-
// TODO(LLVM-20): Remove this workaround
28-
#if !defined(_LIBCPP_CLANG_VER) || _LIBCPP_CLANG_VER != 1700
29-
3022
template <class... _Args>
3123
class __promote {
3224
static_assert((is_arithmetic<_Args>::value && ...));
@@ -39,90 +31,17 @@ class __promote {
3931
static double __test(unsigned long);
4032
static double __test(long long);
4133
static double __test(unsigned long long);
42-
# if _LIBCPP_HAS_INT128
34+
#if _LIBCPP_HAS_INT128
4335
static double __test(__int128_t);
4436
static double __test(__uint128_t);
45-
# endif
37+
#endif
4638
static double __test(double);
4739
static long double __test(long double);
4840

4941
public:
5042
using type = decltype((__test(_Args()) + ...));
5143
};
5244

53-
#else
54-
55-
template <class _Tp>
56-
struct __numeric_type {
57-
static void __test(...);
58-
static float __test(float);
59-
static double __test(char);
60-
static double __test(int);
61-
static double __test(unsigned);
62-
static double __test(long);
63-
static double __test(unsigned long);
64-
static double __test(long long);
65-
static double __test(unsigned long long);
66-
# if _LIBCPP_HAS_INT128
67-
static double __test(__int128_t);
68-
static double __test(__uint128_t);
69-
# endif
70-
static double __test(double);
71-
static long double __test(long double);
72-
73-
typedef decltype(__test(std::declval<_Tp>())) type;
74-
static const bool value = _IsNotSame<type, void>::value;
75-
};
76-
77-
template <>
78-
struct __numeric_type<void> {
79-
static const bool value = true;
80-
};
81-
82-
template <class _A1,
83-
class _A2 = void,
84-
class _A3 = void,
85-
bool = __numeric_type<_A1>::value && __numeric_type<_A2>::value && __numeric_type<_A3>::value>
86-
class __promote_imp {
87-
public:
88-
static const bool value = false;
89-
};
90-
91-
template <class _A1, class _A2, class _A3>
92-
class __promote_imp<_A1, _A2, _A3, true> {
93-
private:
94-
typedef typename __promote_imp<_A1>::type __type1;
95-
typedef typename __promote_imp<_A2>::type __type2;
96-
typedef typename __promote_imp<_A3>::type __type3;
97-
98-
public:
99-
typedef decltype(__type1() + __type2() + __type3()) type;
100-
static const bool value = true;
101-
};
102-
103-
template <class _A1, class _A2>
104-
class __promote_imp<_A1, _A2, void, true> {
105-
private:
106-
typedef typename __promote_imp<_A1>::type __type1;
107-
typedef typename __promote_imp<_A2>::type __type2;
108-
109-
public:
110-
typedef decltype(__type1() + __type2()) type;
111-
static const bool value = true;
112-
};
113-
114-
template <class _A1>
115-
class __promote_imp<_A1, void, void, true> {
116-
public:
117-
typedef typename __numeric_type<_A1>::type type;
118-
static const bool value = true;
119-
};
120-
121-
template <class _A1, class _A2 = void, class _A3 = void>
122-
class __promote : public __promote_imp<_A1, _A2, _A3> {};
123-
124-
#endif // !defined(_LIBCPP_CLANG_VER) || _LIBCPP_CLANG_VER >= 1700
125-
12645
_LIBCPP_END_NAMESPACE_STD
12746

12847
#endif // _LIBCPP___TYPE_TRAITS_PROMOTE_H

libcxx/src/experimental/time_zone.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ __format(const __tz::__continuation& __continuation, const string& __letters, se
199199
// active at the end. This should be determined separately.
200200
return chrono::seconds{0};
201201
else
202-
static_assert(sizeof(_Tp) == 0); // TODO TZDB static_assert(false); after droping clang-16 support
202+
static_assert(false);
203203

204204
std::__libcpp_unreachable();
205205
},
@@ -225,7 +225,7 @@ __format(const __tz::__continuation& __continuation, const string& __letters, se
225225
else if constexpr (same_as<_Tp, __tz::__constrained_weekday>)
226226
return __value(__year, __month);
227227
else
228-
static_assert(sizeof(_Tp) == 0); // TODO TZDB static_assert(false); after droping clang-16 support
228+
static_assert(false);
229229

230230
std::__libcpp_unreachable();
231231
},
@@ -688,7 +688,7 @@ __get_sys_info(sys_seconds __time,
688688
else if constexpr (same_as<_Tp, __tz::__save>)
689689
return chrono::__get_sys_info_basic(__time, __continuation_begin, __continuation, __value.__time);
690690
else
691-
static_assert(sizeof(_Tp) == 0); // TODO TZDB static_assert(false); after droping clang-16 support
691+
static_assert(false);
692692

693693
std::__libcpp_unreachable();
694694
},

libcxx/test/libcxx/atomics/diagnose_invalid_memory_order.verify.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
// This test fails with Clang <18 because diagnose_if doesn't emit all of the
10-
// diagnostics when -fdelayed-template-parsing is enabled, like it is in MSVC
11-
// mode.
12-
// XFAIL: msvc && clang-17
13-
149
// REQUIRES: diagnose-if-support
1510

1611
// <atomic>

libcxx/test/libcxx/clang_tidy.gen.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
// The GCC compiler flags are not always compatible with clang-tidy.
2727
// UNSUPPORTED: gcc
2828
29-
// Clang 17 has false positives.
30-
// UNSUPPORTED: clang-17
31-
3229
{lit_header_restrictions.get(header, '')}
3330
{lit_header_undeprecations.get(header, '')}
3431

libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// UNSUPPORTED: c++03
1313

1414
// TODO: Investigate these failures which break the CI.
15-
// UNSUPPORTED: clang-17, clang-18, clang-19
15+
// UNSUPPORTED: clang-18, clang-19, clang-20
1616

1717
// The Android libc++ tests are run on a non-Android host, connected to an
1818
// Android device over adb. gdb needs special support to make this work (e.g.

libcxx/test/libcxx/ranges/range.adaptors/range.lazy.split/no_unique_address.compile.pass.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//===----------------------------------------------------------------------===//
88

99
// UNSUPPORTED: c++03, c++11, c++14, c++17
10-
// XFAIL: msvc && clang-17
1110

1211
// class lazy_split_view {
1312
// _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();

libcxx/test/libcxx/ranges/range.adaptors/range.split/no_unique_address.compile.pass.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//===----------------------------------------------------------------------===//
88

99
// UNSUPPORTED: c++03, c++11, c++14, c++17
10-
// XFAIL: msvc && clang-17
1110

1211
// class split_view {
1312
// _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();

libcxx/test/libcxx/ranges/range.factories/range.istream.view/no_unique_address.compile.pass.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
// UNSUPPORTED: no-localization
1010
// UNSUPPORTED: c++03, c++11, c++14, c++17
11-
// XFAIL: msvc && clang-17
1211

1312
// Test the libc++ extension that the value stored in `std::ranges::istream_view` has been marked
1413
// as _LIBCPP_NO_UNIQUE_ADDRESS
@@ -21,4 +20,3 @@ struct Empty {
2120
};
2221

2322
static_assert(sizeof(std::ranges::istream_view<Empty>) == sizeof(void*));
24-

libcxx/test/std/atomics/atomics.types.generic/atomics.types.float/fetch_add.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// Older versions of clang have a bug with atomic builtins affecting double and long double.
1212
// Fixed by 5fdd0948.
13-
// XFAIL: target=powerpc-ibm-{{.*}} && (clang-17 || clang-18)
13+
// XFAIL: target=powerpc-ibm-{{.*}} && clang-18
1414

1515
// https://github.com/llvm/llvm-project/issues/72893
1616
// XFAIL: target={{x86_64-.*}} && tsan

libcxx/test/std/atomics/atomics.types.generic/atomics.types.float/fetch_sub.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// Older versions of clang have a bug with atomic builtins affecting double and long double.
1212
// Fixed by 5fdd0948.
13-
// XFAIL: target=powerpc-ibm-{{.*}} && (clang-17 || clang-18)
13+
// XFAIL: target=powerpc-ibm-{{.*}} && clang-18
1414

1515
// https://github.com/llvm/llvm-project/issues/72893
1616
// XFAIL: target={{x86_64-.*}} && tsan

libcxx/test/std/atomics/atomics.types.generic/atomics.types.float/operator.minus_equals.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// Older versions of clang have a bug with atomic builtins affecting double and long double.
1212
// Fixed by 5fdd0948.
13-
// XFAIL: target=powerpc-ibm-{{.*}} && (clang-17 || clang-18)
13+
// XFAIL: target=powerpc-ibm-{{.*}} && clang-18
1414

1515
// floating-point-type operator-=(floating-point-type) volatile noexcept;
1616
// floating-point-type operator-=(floating-point-type) noexcept;

libcxx/test/std/atomics/atomics.types.generic/atomics.types.float/operator.plus_equals.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// Older versions of clang have a bug with atomic builtins affecting double and long double.
1212
// Fixed by 5fdd0948.
13-
// XFAIL: target=powerpc-ibm-{{.*}} && (clang-17 || clang-18)
13+
// XFAIL: target=powerpc-ibm-{{.*}} && clang-18
1414

1515
// floating-point-type operator+=(floating-point-type) volatile noexcept;
1616
// floating-point-type operator+=(floating-point-type) noexcept;

libcxx/test/std/containers/views/mdspan/mdspan/index_operator.pass.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
#include "../ConvertibleToIntegral.h"
4040
#include "../CustomTestLayouts.h"
4141

42-
// Clang 16 does not support argument packs as input to operator []
43-
#if defined(__clang_major__) && __clang_major__ < 17
42+
// Apple Clang does not support argument packs as input to operator []
43+
#ifdef TEST_COMPILER_APPLE_CLANG
4444
template <class MDS>
4545
constexpr auto& access(MDS mds) {
4646
return mds[];
@@ -84,7 +84,7 @@ template <class MDS, class... Args>
8484
constexpr void iterate(MDS mds, Args... args) {
8585
constexpr int r = static_cast<int>(MDS::extents_type::rank()) - 1 - static_cast<int>(sizeof...(Args));
8686
if constexpr (-1 == r) {
87-
#if defined(__clang_major__) && __clang_major__ < 17
87+
#ifdef TEST_COMPILER_APPLE_CLANG
8888
int* ptr1 = &access(mds, args...);
8989
#else
9090
int* ptr1 = &mds[args...];

libcxx/test/std/containers/views/views.span/span.cons/array.pass.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,17 @@ constexpr bool testSpan()
9393
assert(s3.data() == val && s3.size() == 2);
9494
assert(s4.data() == val && s4.size() == 2);
9595

96-
std::span<const int> s5 = {{1,2}};
96+
TEST_DIAGNOSTIC_PUSH
97+
TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdangling")
98+
std::span<const int> s5 = {{1, 2}};
9799
#if TEST_STD_VER >= 26
98100
std::span<const int, 2> s6({1, 2});
99101
#else
100102
std::span<const int, 2> s6 = {{1,2}};
101103
#endif
102104
assert(s5.size() == 2); // and it dangles
103105
assert(s6.size() == 2); // and it dangles
106+
TEST_DIAGNOSTIC_POP
104107

105108
return true;
106109
}

libcxx/test/std/experimental/simd/simd.class/simd_copy.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// Older versions of clang may encounter a backend error (see 0295c2ad):
1212
// Pass-by-value arguments with alignment greater than register width are not supported.
13-
// XFAIL: target=powerpc{{.*}}-ibm-{{.*}} && (clang-17 || clang-18)
13+
// XFAIL: target=powerpc{{.*}}-ibm-{{.*}} && clang-18
1414

1515
// <experimental/simd>
1616
//

libcxx/test/std/experimental/simd/simd.class/simd_unary.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
// Older versions of clang may encounter a backend error (see 0295c2ad):
1212
// Pass-by-value arguments with alignment greater than register width are not supported.
13-
// XFAIL: target=powerpc{{.*}}-ibm-{{.*}} && (clang-17 || clang-18)
13+
// XFAIL: target=powerpc{{.*}}-ibm-{{.*}} && clang-18
1414

1515
// This test crashes AppleClang 15 but not later versions.
1616
// UNSUPPORTED: apple-clang-15

libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.array/sized_delete_array.pass.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// UNSUPPORTED: c++03, c++11
1212

1313
// These compiler versions and platforms don't enable sized deallocation by default.
14-
// ADDITIONAL_COMPILE_FLAGS(clang-17): -fsized-deallocation
1514
// ADDITIONAL_COMPILE_FLAGS(clang-18): -fsized-deallocation
1615
// ADDITIONAL_COMPILE_FLAGS(apple-clang-15): -fsized-deallocation
1716
// ADDITIONAL_COMPILE_FLAGS(apple-clang-16): -fsized-deallocation

libcxx/test/std/language.support/support.dynamic/new.delete/new.delete.single/sized_delete.pass.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// UNSUPPORTED: c++03, c++11
1212

1313
// These compiler versions and platforms don't enable sized deallocation by default.
14-
// ADDITIONAL_COMPILE_FLAGS(clang-17): -fsized-deallocation
1514
// ADDITIONAL_COMPILE_FLAGS(clang-18): -fsized-deallocation
1615
// ADDITIONAL_COMPILE_FLAGS(apple-clang-15): -fsized-deallocation
1716
// ADDITIONAL_COMPILE_FLAGS(apple-clang-16): -fsized-deallocation

libcxx/test/std/numerics/c.math/signbit.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// UNSUPPORTED: windows
1313

1414
// These compilers don't support constexpr `__builtin_signbit` yet.
15-
// UNSUPPORTED: clang-17, clang-18, clang-19, apple-clang-15, apple-clang-16
15+
// UNSUPPORTED: clang-18, clang-19, apple-clang-15, apple-clang-16
1616

1717
// XFAIL: FROZEN-CXX03-HEADERS-FIXME
1818

libcxx/test/std/utilities/expected/expected.expected/ctor/ctor.copy.pass.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ constexpr bool test() {
121121
}
122122

123123
{
124-
// TODO(LLVM 20): Remove once we drop support for Clang 17
125-
#if defined(TEST_CLANG_VER) && TEST_CLANG_VER >= 1800
124+
// TODO: Drop this once AppleClang is upgraded
125+
#ifndef TEST_COMPILER_APPLE_CLANG
126126
// https://github.com/llvm/llvm-project/issues/92676
127127
std::expected<Any, int> e1;
128128
auto e2 = e1;

0 commit comments

Comments
 (0)