Skip to content

[libc++] Update the CI to Clang-20 and drop Clang-17 support #117429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/libcxx-build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ jobs:
'generic-cxx26',
'generic-modules'
]
cc: [ 'clang-19' ]
cxx: [ 'clang++-19' ]
cc: [ 'clang-20' ]
cxx: [ 'clang++-20' ]
include:
- config: 'generic-gcc'
cc: 'gcc-14'
Expand Down Expand Up @@ -88,18 +88,18 @@ jobs:
'generic-cxx20',
'generic-cxx23'
]
cc: [ 'clang-19' ]
cxx: [ 'clang++-19' ]
cc: [ 'clang-20' ]
cxx: [ 'clang++-20' ]
include:
- config: 'generic-gcc-cxx11'
cc: 'gcc-14'
cxx: 'g++-14'
- config: 'generic-cxx23'
cc: 'clang-17'
cxx: 'clang++-17'
- config: 'generic-cxx26'
cc: 'clang-18'
cxx: 'clang++-18'
- config: 'generic-cxx26'
cc: 'clang-19'
cxx: 'clang++-19'
steps:
- uses: actions/checkout@v4
- name: ${{ matrix.config }}
Expand Down Expand Up @@ -169,8 +169,8 @@ jobs:
- name: ${{ matrix.config }}
run: libcxx/utils/ci/run-buildbot ${{ matrix.config }}
env:
CC: clang-19
CXX: clang++-19
CC: clang-20
CXX: clang++-20
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0
if: always()
with:
Expand Down
4 changes: 2 additions & 2 deletions libcxx/include/__configuration/compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
// Warn if a compiler version is used that is not supported anymore
// LLVM RELEASE Update the minimum compiler versions
# if defined(_LIBCPP_CLANG_VER)
# if _LIBCPP_CLANG_VER < 1700
# warning "Libc++ only supports Clang 17 and later"
# if _LIBCPP_CLANG_VER < 1800
# warning "Libc++ only supports Clang 18 and later"
# endif
# elif defined(_LIBCPP_APPLE_CLANG_VER)
# if _LIBCPP_APPLE_CLANG_VER < 1500
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,8 @@ __uninitialized_allocator_relocate(_Alloc& __alloc, _Tp* __first, _Tp* __last, _
__guard.__complete();
std::__allocator_destroy(__alloc, __first, __last);
} else {
__builtin_memcpy(const_cast<__remove_const_t<_Tp>*>(__result), __first, sizeof(_Tp) * (__last - __first));
// Casting to void* to suppress clang complaining that this is technically UB.
__builtin_memcpy(static_cast<void*>(__result), __first, sizeof(_Tp) * (__last - __first));
}
}

Expand Down
85 changes: 2 additions & 83 deletions libcxx/include/__type_traits/promote.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,12 @@
#include <__type_traits/integral_constant.h>
#include <__type_traits/is_arithmetic.h>

#if defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER == 1700
# include <__type_traits/is_same.h>
# include <__utility/declval.h>
#endif

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif

_LIBCPP_BEGIN_NAMESPACE_STD

// TODO(LLVM-20): Remove this workaround
#if !defined(_LIBCPP_CLANG_VER) || _LIBCPP_CLANG_VER != 1700

template <class... _Args>
class __promote {
static_assert((is_arithmetic<_Args>::value && ...));
Expand All @@ -39,90 +31,17 @@ class __promote {
static double __test(unsigned long);
static double __test(long long);
static double __test(unsigned long long);
# if _LIBCPP_HAS_INT128
#if _LIBCPP_HAS_INT128
static double __test(__int128_t);
static double __test(__uint128_t);
# endif
#endif
static double __test(double);
static long double __test(long double);

public:
using type = decltype((__test(_Args()) + ...));
};

#else

template <class _Tp>
struct __numeric_type {
static void __test(...);
static float __test(float);
static double __test(char);
static double __test(int);
static double __test(unsigned);
static double __test(long);
static double __test(unsigned long);
static double __test(long long);
static double __test(unsigned long long);
# if _LIBCPP_HAS_INT128
static double __test(__int128_t);
static double __test(__uint128_t);
# endif
static double __test(double);
static long double __test(long double);

typedef decltype(__test(std::declval<_Tp>())) type;
static const bool value = _IsNotSame<type, void>::value;
};

template <>
struct __numeric_type<void> {
static const bool value = true;
};

template <class _A1,
class _A2 = void,
class _A3 = void,
bool = __numeric_type<_A1>::value && __numeric_type<_A2>::value && __numeric_type<_A3>::value>
class __promote_imp {
public:
static const bool value = false;
};

template <class _A1, class _A2, class _A3>
class __promote_imp<_A1, _A2, _A3, true> {
private:
typedef typename __promote_imp<_A1>::type __type1;
typedef typename __promote_imp<_A2>::type __type2;
typedef typename __promote_imp<_A3>::type __type3;

public:
typedef decltype(__type1() + __type2() + __type3()) type;
static const bool value = true;
};

template <class _A1, class _A2>
class __promote_imp<_A1, _A2, void, true> {
private:
typedef typename __promote_imp<_A1>::type __type1;
typedef typename __promote_imp<_A2>::type __type2;

public:
typedef decltype(__type1() + __type2()) type;
static const bool value = true;
};

template <class _A1>
class __promote_imp<_A1, void, void, true> {
public:
typedef typename __numeric_type<_A1>::type type;
static const bool value = true;
};

template <class _A1, class _A2 = void, class _A3 = void>
class __promote : public __promote_imp<_A1, _A2, _A3> {};

#endif // !defined(_LIBCPP_CLANG_VER) || _LIBCPP_CLANG_VER >= 1700

_LIBCPP_END_NAMESPACE_STD

#endif // _LIBCPP___TYPE_TRAITS_PROMOTE_H
6 changes: 3 additions & 3 deletions libcxx/src/experimental/time_zone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ __format(const __tz::__continuation& __continuation, const string& __letters, se
// active at the end. This should be determined separately.
return chrono::seconds{0};
else
static_assert(sizeof(_Tp) == 0); // TODO TZDB static_assert(false); after droping clang-16 support
static_assert(false);

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

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

std::__libcpp_unreachable();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
//
//===----------------------------------------------------------------------===//

// This test fails with Clang <18 because diagnose_if doesn't emit all of the
// diagnostics when -fdelayed-template-parsing is enabled, like it is in MSVC
// mode.
// XFAIL: msvc && clang-17

// REQUIRES: diagnose-if-support

// <atomic>
Expand Down
3 changes: 0 additions & 3 deletions libcxx/test/libcxx/clang_tidy.gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
// The GCC compiler flags are not always compatible with clang-tidy.
// UNSUPPORTED: gcc

// Clang 17 has false positives.
// UNSUPPORTED: clang-17

{lit_header_restrictions.get(header, '')}
{lit_header_undeprecations.get(header, '')}

Expand Down
2 changes: 1 addition & 1 deletion libcxx/test/libcxx/gdb/gdb_pretty_printer_test.sh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// UNSUPPORTED: c++03

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

// The Android libc++ tests are run on a non-Android host, connected to an
// Android device over adb. gdb needs special support to make this work (e.g.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//

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

// class lazy_split_view {
// _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//===----------------------------------------------------------------------===//

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

// class split_view {
// _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

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

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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

// https://github.com/llvm/llvm-project/issues/72893
// XFAIL: target={{x86_64-.*}} && tsan
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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

// https://github.com/llvm/llvm-project/issues/72893
// XFAIL: target={{x86_64-.*}} && tsan
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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

// floating-point-type operator-=(floating-point-type) volatile noexcept;
// floating-point-type operator-=(floating-point-type) noexcept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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

// floating-point-type operator+=(floating-point-type) volatile noexcept;
// floating-point-type operator+=(floating-point-type) noexcept;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
#include "../ConvertibleToIntegral.h"
#include "../CustomTestLayouts.h"

// Clang 16 does not support argument packs as input to operator []
#if defined(__clang_major__) && __clang_major__ < 17
// Apple Clang does not support argument packs as input to operator []
#ifdef TEST_COMPILER_APPLE_CLANG
template <class MDS>
constexpr auto& access(MDS mds) {
return mds[];
Expand Down Expand Up @@ -84,7 +84,7 @@ template <class MDS, class... Args>
constexpr void iterate(MDS mds, Args... args) {
constexpr int r = static_cast<int>(MDS::extents_type::rank()) - 1 - static_cast<int>(sizeof...(Args));
if constexpr (-1 == r) {
#if defined(__clang_major__) && __clang_major__ < 17
#ifdef TEST_COMPILER_APPLE_CLANG
int* ptr1 = &access(mds, args...);
#else
int* ptr1 = &mds[args...];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,17 @@ constexpr bool testSpan()
assert(s3.data() == val && s3.size() == 2);
assert(s4.data() == val && s4.size() == 2);

std::span<const int> s5 = {{1,2}};
TEST_DIAGNOSTIC_PUSH
TEST_CLANG_DIAGNOSTIC_IGNORED("-Wdangling")
std::span<const int> s5 = {{1, 2}};
#if TEST_STD_VER >= 26
std::span<const int, 2> s6({1, 2});
#else
std::span<const int, 2> s6 = {{1,2}};
#endif
assert(s5.size() == 2); // and it dangles
assert(s6.size() == 2); // and it dangles
TEST_DIAGNOSTIC_POP

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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

// <experimental/simd>
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

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

// This test crashes AppleClang 15 but not later versions.
// UNSUPPORTED: apple-clang-15
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
// UNSUPPORTED: c++03, c++11

// These compiler versions and platforms don't enable sized deallocation by default.
// ADDITIONAL_COMPILE_FLAGS(clang-17): -fsized-deallocation
// ADDITIONAL_COMPILE_FLAGS(clang-18): -fsized-deallocation
// ADDITIONAL_COMPILE_FLAGS(apple-clang-15): -fsized-deallocation
// ADDITIONAL_COMPILE_FLAGS(apple-clang-16): -fsized-deallocation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
// UNSUPPORTED: c++03, c++11

// These compiler versions and platforms don't enable sized deallocation by default.
// ADDITIONAL_COMPILE_FLAGS(clang-17): -fsized-deallocation
// ADDITIONAL_COMPILE_FLAGS(clang-18): -fsized-deallocation
// ADDITIONAL_COMPILE_FLAGS(apple-clang-15): -fsized-deallocation
// ADDITIONAL_COMPILE_FLAGS(apple-clang-16): -fsized-deallocation
Expand Down
2 changes: 1 addition & 1 deletion libcxx/test/std/numerics/c.math/signbit.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// UNSUPPORTED: windows

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

// XFAIL: FROZEN-CXX03-HEADERS-FIXME

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ constexpr bool test() {
}

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