Skip to content

Commit

Permalink
[libc++][CI] Update to Clang-20
Browse files Browse the repository at this point in the history
  • Loading branch information
robincaloudis committed Sep 15, 2024
1 parent 7048857 commit 7c9c19a
Show file tree
Hide file tree
Showing 38 changed files with 128 additions and 258 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/libcxx-build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ env:
# LLVM POST-BRANCH bump version
# LLVM POST-BRANCH add compiler test for ToT - 1, e.g. "Clang 17"
# LLVM RELEASE bump remove compiler ToT - 3, e.g. "Clang 15"
LLVM_HEAD_VERSION: "19" # Used compiler, update POST-BRANCH.
LLVM_PREVIOUS_VERSION: "18"
LLVM_OLDEST_VERSION: "17"
LLVM_HEAD_VERSION: "20" # Used compiler, update POST-BRANCH.
LLVM_PREVIOUS_VERSION: "19"
LLVM_OLDEST_VERSION: "18"
GCC_STABLE_VERSION: "13"
LLVM_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer-19"
LLVM_SYMBOLIZER_PATH: "/usr/bin/llvm-symbolizer-20"
CLANG_CRASH_DIAGNOSTICS_DIR: "crash_diagnostics"


Expand All @@ -59,8 +59,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 @@ -97,18 +97,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 @@ -179,8 +179,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/docs/ReleaseNotes/20.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ Deprecations and Removals
removed in language modes prior to C++20. If you are using these features prior to C++20, you will need to
update to ``-std=c++20``.

- TODO: The relational operators for ``std::chrono::weekday`` will be removed entirely, and the
``_LIBCPP_ENABLE_REMOVED_WEEKDAY_RELATIONAL_OPERATORS`` macro that was used to re-enable this extension will be
- The relational operators for ``std::chrono::weekday`` are removed entirely, and the
``_LIBCPP_ENABLE_REMOVED_WEEKDAY_RELATIONAL_OPERATORS`` macro that was used to re-enable this extension is
ignored in LLVM 20.

- The ``_LIBCPP_ENABLE_REMOVED_ALLOCATOR_CONST`` macro no longer has any effect. ``std::allocator<const T>`` is not
Expand Down
2 changes: 1 addition & 1 deletion libcxx/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ velocity, libc++ drops support for older compilers as newer ones are released.
============ =============== ========================== =====================
Compiler Versions Restrictions Support policy
============ =============== ========================== =====================
Clang 17, 18, 19-git latest two stable releases per `LLVM's release page <https://releases.llvm.org>`_ and the development version
Clang 18, 19, 20-git latest two stable releases per `LLVM's release page <https://releases.llvm.org>`_ and the development version
AppleClang 15 latest stable release per `Xcode's release page <https://developer.apple.com/documentation/xcode-release-notes>`_
Open XL 17.1 (AIX) latest stable release per `Open XL's documentation page <https://www.ibm.com/docs/en/openxl-c-and-cpp-aix>`_
GCC 14 In C++11 or later only latest stable release per `GCC's release page <https://gcc.gnu.org/releases.html>`_
Expand Down
19 changes: 0 additions & 19 deletions libcxx/include/__chrono/weekday.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,25 +79,6 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr bool operator==(const weekday& __lhs, con
return __lhs.c_encoding() == __rhs.c_encoding();
}

// TODO(LLVM 20): Remove the escape hatch
# ifdef _LIBCPP_ENABLE_REMOVED_WEEKDAY_RELATIONAL_OPERATORS
_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator<(const weekday& __lhs, const weekday& __rhs) noexcept {
return __lhs.c_encoding() < __rhs.c_encoding();
}

_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator>(const weekday& __lhs, const weekday& __rhs) noexcept {
return __rhs < __lhs;
}

_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator<=(const weekday& __lhs, const weekday& __rhs) noexcept {
return !(__rhs < __lhs);
}

_LIBCPP_HIDE_FROM_ABI inline constexpr bool operator>=(const weekday& __lhs, const weekday& __rhs) noexcept {
return !(__lhs < __rhs);
}
# endif // _LIBCPP_ENABLE_REMOVED_WEEKDAY_RELATIONAL_OPERATORS

_LIBCPP_HIDE_FROM_ABI inline constexpr weekday operator+(const weekday& __lhs, const days& __rhs) noexcept {
auto const __mu = static_cast<long long>(__lhs.c_encoding()) + __rhs.count();
auto const __yr = (__mu >= 0 ? __mu : __mu - 6) / 7;
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
81 changes: 0 additions & 81 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 @@ -50,79 +42,6 @@ class __promote {
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);
# ifndef _LIBCPP_HAS_NO_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
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// 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
// XFAIL: msvc

// REQUIRES: diagnose-if-support

Expand Down
9 changes: 4 additions & 5 deletions libcxx/test/libcxx/clang_tidy.gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,21 @@
from libcxx.header_information import lit_header_restrictions, public_headers

for header in public_headers:
print(f"""\
print(
f"""\
//--- {header}.sh.cpp
// REQUIRES: has-clang-tidy
// 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, '')}
// TODO: run clang-tidy with modules enabled once they are supported
// RUN: %{{clang-tidy}} %s --warnings-as-errors=* -header-filter=.* --checks='-*,libcpp-*' --load=%{{test-tools-dir}}/clang_tidy_checks/libcxx-tidy.plugin -- %{{compile_flags}} -fno-modules
// RUN: %{{clang-tidy}} %s --warnings-as-errors=* -header-filter=.* --config-file=%{{libcxx-dir}}/.clang-tidy -- -Wweak-vtables %{{compile_flags}} -fno-modules
#include <{header}>
""")
"""
)
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

// 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,7 @@
//===----------------------------------------------------------------------===//

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

// 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,7 @@
//===----------------------------------------------------------------------===//

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

// 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,7 @@

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

// Test the libc++ extension that the value stored in `std::ranges::istream_view` has been marked
// as _LIBCPP_NO_UNIQUE_ADDRESS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
//
//===----------------------------------------------------------------------===//

// Clang-18 fixed some spurious clang diagnostics. Once clang-18 is the
// minimum required version these obsolete tests can be removed.
// TODO(LLVM-20) remove spurious clang diagnostic tests.

// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20

// With clang-cl, some warnings have a 'which is a Microsoft extension' suffix
Expand Down Expand Up @@ -59,12 +55,12 @@ void test() {
{
std::expected<int, int> e;
e.transform_error(return_unexpected<int&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
// expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
// expected-error-re@*:* {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
// expected-error-re@*:* {{static assertion failed {{.*}}[expected.object.general] A program that instantiates the definition of template expected<T, E> for {{.*}} is ill-formed.}}
// expected-error-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}}}

e.transform_error(return_no_object<int&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
// expected-error-re@*:* 0-1 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
// expected-error-re@*:* {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
// expected-error-re@*:* {{static assertion failed {{.*}}[expected.object.general] A program that instantiates the definition of template expected<T, E> for {{.*}} is ill-formed.}}
// expected-warning-re@*:* 0-1 {{union member {{.*}} has reference type {{.*}}, which is a Microsoft extension}}
}
Expand All @@ -73,27 +69,27 @@ void test() {
{
const std::expected<int, int> e;
e.transform_error(return_unexpected<const int &>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
// expected-error-re@*:* 0-2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
// expected-error-re@*:* 2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
e.transform_error(return_no_object<const int &>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
// expected-error-re@*:* 0-2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
// expected-error-re@*:* 2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
}

// Test && overload
{
std::expected<int, int> e;
std::move(e).transform_error(return_unexpected<int&&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
// expected-error-re@*:* 0-2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
// expected-error-re@*:* 2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
std::move(e).transform_error(return_no_object<int&&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
// expected-error-re@*:* 0-2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
// expected-error-re@*:* 2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
}

// Test const&& overload
{
const std::expected<int, int> e;
std::move(e).transform_error(return_unexpected<const int&&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
// expected-error-re@*:* 0-2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
// expected-error-re@*:* 2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
std::move(e).transform_error(return_no_object<const int&&>); // expected-error-re@*:* {{static assertion failed {{.*}}The result of {{.*}} must be a valid template argument for unexpected}}
// expected-error-re@*:* 0-2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
// expected-error-re@*:* 2 {{{{(excess elements in struct initializer|no matching constructor for initialization of)}}{{.*}}}}
}
}
// clang-format on
Loading

0 comments on commit 7c9c19a

Please sign in to comment.