mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-30 16:28:30 +00:00
Release Cosmopolitan v3.6.0
This release is an atomic upgrade to GCC 14.1.0 with C23 and C++23
This commit is contained in:
parent
62ace3623a
commit
5660ec4741
1585 changed files with 117353 additions and 271644 deletions
4
third_party/libcxx/__utility/as_const.h
vendored
4
third_party/libcxx/__utility/as_const.h
vendored
|
@ -22,7 +22,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
template <class _Tp>
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept { return __t; }
|
||||
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept {
|
||||
return __t;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
void as_const(const _Tp&&) = delete;
|
||||
|
|
37
third_party/libcxx/__utility/as_lvalue.h
vendored
Normal file
37
third_party/libcxx/__utility/as_lvalue.h
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___UTILITY_AS_LVALUE_H
|
||||
#define _LIBCPP___UTILITY_AS_LVALUE_H
|
||||
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr _Tp& __as_lvalue(_LIBCPP_LIFETIMEBOUND _Tp&& __t) {
|
||||
return static_cast<_Tp&>(__t);
|
||||
}
|
||||
|
||||
#endif // !_LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___UTILITY_AS_LVALUE_H
|
74
third_party/libcxx/__utility/cmp.h
vendored
74
third_party/libcxx/__utility/cmp.h
vendored
|
@ -9,14 +9,10 @@
|
|||
#ifndef _LIBCPP___UTILITY_CMP_H
|
||||
#define _LIBCPP___UTILITY_CMP_H
|
||||
|
||||
#include <__concepts/arithmetic.h>
|
||||
#include <__config>
|
||||
#include <__type_traits/disjunction.h>
|
||||
#include <__type_traits/is_integral.h>
|
||||
#include <__type_traits/is_same.h>
|
||||
#include <__type_traits/is_signed.h>
|
||||
#include <__type_traits/make_unsigned.h>
|
||||
#include <__utility/forward.h>
|
||||
#include <__utility/move.h>
|
||||
#include <limits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
|
@ -29,24 +25,9 @@ _LIBCPP_PUSH_MACROS
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if _LIBCPP_STD_VER >= 20
|
||||
template<class _Tp, class... _Up>
|
||||
struct _IsSameAsAny : _Or<_IsSame<_Tp, _Up>...> {};
|
||||
|
||||
template<class _Tp>
|
||||
concept __is_safe_integral_cmp = is_integral_v<_Tp> &&
|
||||
!_IsSameAsAny<_Tp, bool, char, char16_t, char32_t
|
||||
#ifndef _LIBCPP_HAS_NO_CHAR8_T
|
||||
, char8_t
|
||||
#endif
|
||||
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
|
||||
, wchar_t
|
||||
#endif
|
||||
>::value;
|
||||
|
||||
template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
bool cmp_equal(_Tp __t, _Up __u) noexcept
|
||||
{
|
||||
template <__libcpp_integer _Tp, __libcpp_integer _Up>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_equal(_Tp __t, _Up __u) noexcept {
|
||||
if constexpr (is_signed_v<_Tp> == is_signed_v<_Up>)
|
||||
return __t == __u;
|
||||
else if constexpr (is_signed_v<_Tp>)
|
||||
|
@ -55,17 +36,13 @@ bool cmp_equal(_Tp __t, _Up __u) noexcept
|
|||
return __u < 0 ? false : __t == make_unsigned_t<_Up>(__u);
|
||||
}
|
||||
|
||||
template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
bool cmp_not_equal(_Tp __t, _Up __u) noexcept
|
||||
{
|
||||
return !_VSTD::cmp_equal(__t, __u);
|
||||
template <__libcpp_integer _Tp, __libcpp_integer _Up>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_not_equal(_Tp __t, _Up __u) noexcept {
|
||||
return !std::cmp_equal(__t, __u);
|
||||
}
|
||||
|
||||
template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
bool cmp_less(_Tp __t, _Up __u) noexcept
|
||||
{
|
||||
template <__libcpp_integer _Tp, __libcpp_integer _Up>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_less(_Tp __t, _Up __u) noexcept {
|
||||
if constexpr (is_signed_v<_Tp> == is_signed_v<_Up>)
|
||||
return __t < __u;
|
||||
else if constexpr (is_signed_v<_Tp>)
|
||||
|
@ -74,34 +51,27 @@ bool cmp_less(_Tp __t, _Up __u) noexcept
|
|||
return __u < 0 ? false : __t < make_unsigned_t<_Up>(__u);
|
||||
}
|
||||
|
||||
template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
bool cmp_greater(_Tp __t, _Up __u) noexcept
|
||||
{
|
||||
return _VSTD::cmp_less(__u, __t);
|
||||
template <__libcpp_integer _Tp, __libcpp_integer _Up>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_greater(_Tp __t, _Up __u) noexcept {
|
||||
return std::cmp_less(__u, __t);
|
||||
}
|
||||
|
||||
template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
bool cmp_less_equal(_Tp __t, _Up __u) noexcept
|
||||
{
|
||||
return !_VSTD::cmp_greater(__t, __u);
|
||||
template <__libcpp_integer _Tp, __libcpp_integer _Up>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_less_equal(_Tp __t, _Up __u) noexcept {
|
||||
return !std::cmp_greater(__t, __u);
|
||||
}
|
||||
|
||||
template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
bool cmp_greater_equal(_Tp __t, _Up __u) noexcept
|
||||
{
|
||||
return !_VSTD::cmp_less(__t, __u);
|
||||
template <__libcpp_integer _Tp, __libcpp_integer _Up>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr bool cmp_greater_equal(_Tp __t, _Up __u) noexcept {
|
||||
return !std::cmp_less(__t, __u);
|
||||
}
|
||||
|
||||
template<__is_safe_integral_cmp _Tp, __is_safe_integral_cmp _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
bool in_range(_Up __u) noexcept
|
||||
{
|
||||
return _VSTD::cmp_less_equal(__u, numeric_limits<_Tp>::max()) &&
|
||||
_VSTD::cmp_greater_equal(__u, numeric_limits<_Tp>::min());
|
||||
template <__libcpp_integer _Tp, __libcpp_integer _Up>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr bool in_range(_Up __u) noexcept {
|
||||
return std::cmp_less_equal(__u, numeric_limits<_Tp>::max()) &&
|
||||
std::cmp_greater_equal(__u, numeric_limits<_Tp>::min());
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 20
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
|
|
@ -21,51 +21,47 @@
|
|||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
int __convert_to_integral(int __val) { return __val; }
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __convert_to_integral(int __val) { return __val; }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
unsigned __convert_to_integral(unsigned __val) { return __val; }
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unsigned __convert_to_integral(unsigned __val) { return __val; }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
long __convert_to_integral(long __val) { return __val; }
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long __convert_to_integral(long __val) { return __val; }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
unsigned long __convert_to_integral(unsigned long __val) { return __val; }
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unsigned long __convert_to_integral(unsigned long __val) {
|
||||
return __val;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
long long __convert_to_integral(long long __val) { return __val; }
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long long __convert_to_integral(long long __val) { return __val; }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
unsigned long long __convert_to_integral(unsigned long long __val) {return __val; }
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unsigned long long __convert_to_integral(unsigned long long __val) {
|
||||
return __val;
|
||||
}
|
||||
|
||||
template<typename _Fp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
typename enable_if<is_floating_point<_Fp>::value, long long>::type
|
||||
__convert_to_integral(_Fp __val) { return __val; }
|
||||
template <typename _Fp, __enable_if_t<is_floating_point<_Fp>::value, int> = 0>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long long __convert_to_integral(_Fp __val) {
|
||||
return __val;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_INT128
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
__int128_t __convert_to_integral(__int128_t __val) { return __val; }
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __int128_t __convert_to_integral(__int128_t __val) { return __val; }
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
__uint128_t __convert_to_integral(__uint128_t __val) { return __val; }
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __uint128_t __convert_to_integral(__uint128_t __val) { return __val; }
|
||||
#endif
|
||||
|
||||
template <class _Tp, bool = is_enum<_Tp>::value>
|
||||
struct __sfinae_underlying_type
|
||||
{
|
||||
typedef typename underlying_type<_Tp>::type type;
|
||||
typedef decltype(((type)1) + 0) __promoted_type;
|
||||
struct __sfinae_underlying_type {
|
||||
typedef typename underlying_type<_Tp>::type type;
|
||||
typedef decltype(((type)1) + 0) __promoted_type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __sfinae_underlying_type<_Tp, false> {};
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
typename __sfinae_underlying_type<_Tp>::__promoted_type
|
||||
__convert_to_integral(_Tp __val) { return __val; }
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR typename __sfinae_underlying_type<_Tp>::__promoted_type
|
||||
__convert_to_integral(_Tp __val) {
|
||||
return __val;
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
|
6
third_party/libcxx/__utility/declval.h
vendored
6
third_party/libcxx/__utility/declval.h
vendored
|
@ -27,7 +27,11 @@ _Tp __declval(long);
|
|||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
template <class _Tp>
|
||||
decltype(std::__declval<_Tp>(0)) declval() _NOEXCEPT;
|
||||
_LIBCPP_HIDE_FROM_ABI decltype(std::__declval<_Tp>(0)) declval() _NOEXCEPT {
|
||||
static_assert(!__is_same(_Tp, _Tp),
|
||||
"std::declval can only be used in an unevaluated context. "
|
||||
"It's likely that your current usage is trying to extract a value from the function.");
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
|
24
third_party/libcxx/__utility/empty.h
vendored
Normal file
24
third_party/libcxx/__utility/empty.h
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___UTILITY_EMPTY_H
|
||||
#define _LIBCPP___UTILITY_EMPTY_H
|
||||
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
struct __empty {};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___UTILITY_EMPTY_H
|
13
third_party/libcxx/__utility/exception_guard.h
vendored
13
third_party/libcxx/__utility/exception_guard.h
vendored
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include <__assert>
|
||||
#include <__config>
|
||||
#include <__type_traits/is_nothrow_move_constructible.h>
|
||||
#include <__type_traits/is_nothrow_constructible.h>
|
||||
#include <__utility/exchange.h>
|
||||
#include <__utility/move.h>
|
||||
|
||||
|
@ -19,6 +19,9 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// __exception_guard is a helper class for writing code with the strong exception guarantee.
|
||||
|
@ -93,8 +96,8 @@ _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(__exception_guard_exceptions);
|
|||
template <class _Rollback>
|
||||
struct __exception_guard_noexceptions {
|
||||
__exception_guard_noexceptions() = delete;
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
_LIBCPP_NODEBUG explicit __exception_guard_noexceptions(_Rollback) {}
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NODEBUG explicit __exception_guard_noexceptions(_Rollback) {}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NODEBUG
|
||||
__exception_guard_noexceptions(__exception_guard_noexceptions&& __other)
|
||||
|
@ -112,7 +115,7 @@ struct __exception_guard_noexceptions {
|
|||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NODEBUG ~__exception_guard_noexceptions() {
|
||||
_LIBCPP_ASSERT(__completed_, "__exception_guard not completed with exceptions disabled");
|
||||
_LIBCPP_ASSERT_INTERNAL(__completed_, "__exception_guard not completed with exceptions disabled");
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -136,4 +139,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __exception_guard<_Rollback> __make_exce
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___UTILITY_TRANSACTION_H
|
||||
|
|
21
third_party/libcxx/__utility/exchange.h
vendored
21
third_party/libcxx/__utility/exchange.h
vendored
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include <__config>
|
||||
#include <__type_traits/is_nothrow_assignable.h>
|
||||
#include <__type_traits/is_nothrow_move_constructible.h>
|
||||
#include <__type_traits/is_nothrow_constructible.h>
|
||||
#include <__utility/forward.h>
|
||||
#include <__utility/move.h>
|
||||
|
||||
|
@ -19,20 +19,23 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
template<class _T1, class _T2 = _T1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20
|
||||
_T1 exchange(_T1& __obj, _T2&& __new_value)
|
||||
noexcept(is_nothrow_move_constructible<_T1>::value && is_nothrow_assignable<_T1&, _T2>::value)
|
||||
{
|
||||
_T1 __old_value = _VSTD::move(__obj);
|
||||
__obj = _VSTD::forward<_T2>(__new_value);
|
||||
return __old_value;
|
||||
template <class _T1, class _T2 = _T1>
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _T1 exchange(_T1& __obj, _T2&& __new_value) noexcept(
|
||||
is_nothrow_move_constructible<_T1>::value && is_nothrow_assignable<_T1&, _T2>::value) {
|
||||
_T1 __old_value = std::move(__obj);
|
||||
__obj = std::forward<_T2>(__new_value);
|
||||
return __old_value;
|
||||
}
|
||||
#endif // _LIBCPP_STD_VER >= 14
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___UTILITY_EXCHANGE_H
|
||||
|
|
4
third_party/libcxx/__utility/forward.h
vendored
4
third_party/libcxx/__utility/forward.h
vendored
|
@ -21,13 +21,13 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp&&
|
||||
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp&&
|
||||
forward(_LIBCPP_LIFETIMEBOUND __libcpp_remove_reference_t<_Tp>& __t) _NOEXCEPT {
|
||||
return static_cast<_Tp&&>(__t);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp&&
|
||||
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp&&
|
||||
forward(_LIBCPP_LIFETIMEBOUND __libcpp_remove_reference_t<_Tp>&& __t) _NOEXCEPT {
|
||||
static_assert(!is_lvalue_reference<_Tp>::value, "cannot forward an rvalue as an lvalue");
|
||||
return static_cast<_Tp&&>(__t);
|
||||
|
|
4
third_party/libcxx/__utility/forward_like.h
vendored
4
third_party/libcxx/__utility/forward_like.h
vendored
|
@ -34,8 +34,8 @@ template <class _Ap, class _Bp>
|
|||
using _ForwardLike = _OverrideRef<_Ap&&, _CopyConst<remove_reference_t<_Ap>, remove_reference_t<_Bp>>>;
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto forward_like(_LIBCPP_LIFETIMEBOUND _Up&& __ux) noexcept
|
||||
-> _ForwardLike<_Tp, _Up> {
|
||||
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto
|
||||
forward_like(_LIBCPP_LIFETIMEBOUND _Up&& __ux) noexcept -> _ForwardLike<_Tp, _Up> {
|
||||
return static_cast<_ForwardLike<_Tp, _Up>>(__ux);
|
||||
}
|
||||
|
||||
|
|
14
third_party/libcxx/__utility/in_place.h
vendored
14
third_party/libcxx/__utility/in_place.h
vendored
|
@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
struct _LIBCPP_TYPE_VIS in_place_t {
|
||||
struct _LIBCPP_EXPORTED_FROM_ABI in_place_t {
|
||||
explicit in_place_t() = default;
|
||||
};
|
||||
inline constexpr in_place_t in_place{};
|
||||
|
@ -40,14 +40,18 @@ struct _LIBCPP_TEMPLATE_VIS in_place_index_t {
|
|||
template <size_t _Idx>
|
||||
inline constexpr in_place_index_t<_Idx> in_place_index{};
|
||||
|
||||
template <class _Tp> struct __is_inplace_type_imp : false_type {};
|
||||
template <class _Tp> struct __is_inplace_type_imp<in_place_type_t<_Tp>> : true_type {};
|
||||
template <class _Tp>
|
||||
struct __is_inplace_type_imp : false_type {};
|
||||
template <class _Tp>
|
||||
struct __is_inplace_type_imp<in_place_type_t<_Tp>> : true_type {};
|
||||
|
||||
template <class _Tp>
|
||||
using __is_inplace_type = __is_inplace_type_imp<__remove_cvref_t<_Tp>>;
|
||||
|
||||
template <class _Tp> struct __is_inplace_index_imp : false_type {};
|
||||
template <size_t _Idx> struct __is_inplace_index_imp<in_place_index_t<_Idx>> : true_type {};
|
||||
template <class _Tp>
|
||||
struct __is_inplace_index_imp : false_type {};
|
||||
template <size_t _Idx>
|
||||
struct __is_inplace_index_imp<in_place_index_t<_Idx>> : true_type {};
|
||||
|
||||
template <class _Tp>
|
||||
using __is_inplace_index = __is_inplace_index_imp<__remove_cvref_t<_Tp>>;
|
||||
|
|
117
third_party/libcxx/__utility/integer_sequence.h
vendored
117
third_party/libcxx/__utility/integer_sequence.h
vendored
|
@ -19,7 +19,8 @@
|
|||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <size_t...> struct __tuple_indices;
|
||||
template <size_t...>
|
||||
struct __tuple_indices;
|
||||
|
||||
template <class _IdxType, _IdxType... _Values>
|
||||
struct __integer_sequence {
|
||||
|
@ -30,119 +31,55 @@ struct __integer_sequence {
|
|||
using __to_tuple_indices = __tuple_indices<(_Values + _Sp)...>;
|
||||
};
|
||||
|
||||
#if !__has_builtin(__make_integer_seq) || defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE)
|
||||
|
||||
namespace __detail {
|
||||
|
||||
template<typename _Tp, size_t ..._Extra> struct __repeat;
|
||||
template<typename _Tp, _Tp ..._Np, size_t ..._Extra> struct __repeat<__integer_sequence<_Tp, _Np...>, _Extra...> {
|
||||
typedef _LIBCPP_NODEBUG __integer_sequence<_Tp,
|
||||
_Np...,
|
||||
sizeof...(_Np) + _Np...,
|
||||
2 * sizeof...(_Np) + _Np...,
|
||||
3 * sizeof...(_Np) + _Np...,
|
||||
4 * sizeof...(_Np) + _Np...,
|
||||
5 * sizeof...(_Np) + _Np...,
|
||||
6 * sizeof...(_Np) + _Np...,
|
||||
7 * sizeof...(_Np) + _Np...,
|
||||
_Extra...> type;
|
||||
};
|
||||
|
||||
template<size_t _Np> struct __parity;
|
||||
template<size_t _Np> struct __make : __parity<_Np % 8>::template __pmake<_Np> {};
|
||||
|
||||
template<> struct __make<0> { typedef __integer_sequence<size_t> type; };
|
||||
template<> struct __make<1> { typedef __integer_sequence<size_t, 0> type; };
|
||||
template<> struct __make<2> { typedef __integer_sequence<size_t, 0, 1> type; };
|
||||
template<> struct __make<3> { typedef __integer_sequence<size_t, 0, 1, 2> type; };
|
||||
template<> struct __make<4> { typedef __integer_sequence<size_t, 0, 1, 2, 3> type; };
|
||||
template<> struct __make<5> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4> type; };
|
||||
template<> struct __make<6> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4, 5> type; };
|
||||
template<> struct __make<7> { typedef __integer_sequence<size_t, 0, 1, 2, 3, 4, 5, 6> type; };
|
||||
|
||||
template<> struct __parity<0> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type> {}; };
|
||||
template<> struct __parity<1> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 1> {}; };
|
||||
template<> struct __parity<2> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 2, _Np - 1> {}; };
|
||||
template<> struct __parity<3> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 3, _Np - 2, _Np - 1> {}; };
|
||||
template<> struct __parity<4> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; };
|
||||
template<> struct __parity<5> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; };
|
||||
template<> struct __parity<6> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 6, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; };
|
||||
template<> struct __parity<7> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 7, _Np - 6, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; };
|
||||
|
||||
} // namespace detail
|
||||
|
||||
#endif
|
||||
|
||||
#if __has_builtin(__make_integer_seq)
|
||||
template <size_t _Ep, size_t _Sp>
|
||||
using __make_indices_imp =
|
||||
typename __make_integer_seq<__integer_sequence, size_t, _Ep - _Sp>::template
|
||||
__to_tuple_indices<_Sp>;
|
||||
#else
|
||||
typename __make_integer_seq<__integer_sequence, size_t, _Ep - _Sp>::template __to_tuple_indices<_Sp>;
|
||||
#elif __has_builtin(__integer_pack)
|
||||
template <size_t _Ep, size_t _Sp>
|
||||
using __make_indices_imp =
|
||||
typename __detail::__make<_Ep - _Sp>::type::template __to_tuple_indices<_Sp>;
|
||||
|
||||
typename __integer_sequence<size_t, __integer_pack(_Ep - _Sp)...>::template __to_tuple_indices<_Sp>;
|
||||
#else
|
||||
# error "No known way to get an integer pack from the compiler"
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
|
||||
template<class _Tp, _Tp... _Ip>
|
||||
struct _LIBCPP_TEMPLATE_VIS integer_sequence
|
||||
{
|
||||
typedef _Tp value_type;
|
||||
static_assert( is_integral<_Tp>::value,
|
||||
"std::integer_sequence can only be instantiated with an integral type" );
|
||||
static
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr
|
||||
size_t
|
||||
size() noexcept { return sizeof...(_Ip); }
|
||||
template <class _Tp, _Tp... _Ip>
|
||||
struct _LIBCPP_TEMPLATE_VIS integer_sequence {
|
||||
typedef _Tp value_type;
|
||||
static_assert(is_integral<_Tp>::value, "std::integer_sequence can only be instantiated with an integral type");
|
||||
static _LIBCPP_HIDE_FROM_ABI constexpr size_t size() noexcept { return sizeof...(_Ip); }
|
||||
};
|
||||
|
||||
template<size_t... _Ip>
|
||||
using index_sequence = integer_sequence<size_t, _Ip...>;
|
||||
template <size_t... _Ip>
|
||||
using index_sequence = integer_sequence<size_t, _Ip...>;
|
||||
|
||||
#if __has_builtin(__make_integer_seq) && !defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE)
|
||||
# if __has_builtin(__make_integer_seq)
|
||||
|
||||
template <class _Tp, _Tp _Ep>
|
||||
using __make_integer_sequence _LIBCPP_NODEBUG = __make_integer_seq<integer_sequence, _Tp, _Ep>;
|
||||
using make_integer_sequence _LIBCPP_NODEBUG = __make_integer_seq<integer_sequence, _Tp, _Ep>;
|
||||
|
||||
#else
|
||||
# elif __has_builtin(__integer_pack)
|
||||
|
||||
template<typename _Tp, _Tp _Np> using __make_integer_sequence_unchecked _LIBCPP_NODEBUG =
|
||||
typename __detail::__make<_Np>::type::template __convert<integer_sequence, _Tp>;
|
||||
template <class _Tp, _Tp _SequenceSize>
|
||||
using make_integer_sequence _LIBCPP_NODEBUG = integer_sequence<_Tp, __integer_pack(_SequenceSize)...>;
|
||||
|
||||
template <class _Tp, _Tp _Ep>
|
||||
struct __make_integer_sequence_checked
|
||||
{
|
||||
static_assert(is_integral<_Tp>::value,
|
||||
"std::make_integer_sequence can only be instantiated with an integral type" );
|
||||
static_assert(0 <= _Ep, "std::make_integer_sequence must have a non-negative sequence length");
|
||||
// Workaround GCC bug by preventing bad installations when 0 <= _Ep
|
||||
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68929
|
||||
typedef _LIBCPP_NODEBUG __make_integer_sequence_unchecked<_Tp, 0 <= _Ep ? _Ep : 0> type;
|
||||
};
|
||||
# else
|
||||
# error "No known way to get an integer pack from the compiler"
|
||||
# endif
|
||||
|
||||
template <class _Tp, _Tp _Ep>
|
||||
using __make_integer_sequence _LIBCPP_NODEBUG = typename __make_integer_sequence_checked<_Tp, _Ep>::type;
|
||||
template <size_t _Np>
|
||||
using make_index_sequence = make_integer_sequence<size_t, _Np>;
|
||||
|
||||
#endif
|
||||
|
||||
template<class _Tp, _Tp _Np>
|
||||
using make_integer_sequence = __make_integer_sequence<_Tp, _Np>;
|
||||
|
||||
template<size_t _Np>
|
||||
using make_index_sequence = make_integer_sequence<size_t, _Np>;
|
||||
|
||||
template<class... _Tp>
|
||||
using index_sequence_for = make_index_sequence<sizeof...(_Tp)>;
|
||||
template <class... _Tp>
|
||||
using index_sequence_for = make_index_sequence<sizeof...(_Tp)>;
|
||||
|
||||
# if _LIBCPP_STD_VER >= 20
|
||||
// Executes __func for every element in an index_sequence.
|
||||
template <size_t... _Index, class _Function>
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr void __for_each_index_sequence(index_sequence<_Index...>, _Function __func) {
|
||||
(__func.template operator()<_Index>(), ...);
|
||||
(__func.template operator()<_Index>(), ...);
|
||||
}
|
||||
# endif // _LIBCPP_STD_VER >= 20
|
||||
|
||||
|
|
62
third_party/libcxx/__utility/is_pointer_in_range.h
vendored
Normal file
62
third_party/libcxx/__utility/is_pointer_in_range.h
vendored
Normal file
|
@ -0,0 +1,62 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___UTILITY_IS_POINTER_IN_RANGE_H
|
||||
#define _LIBCPP___UTILITY_IS_POINTER_IN_RANGE_H
|
||||
|
||||
#include <__algorithm/comp.h>
|
||||
#include <__assert>
|
||||
#include <__config>
|
||||
#include <__type_traits/enable_if.h>
|
||||
#include <__type_traits/integral_constant.h>
|
||||
#include <__type_traits/is_constant_evaluated.h>
|
||||
#include <__type_traits/void_t.h>
|
||||
#include <__utility/declval.h>
|
||||
#include <__utility/is_valid_range.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp, class _Up, class = void>
|
||||
struct __is_less_than_comparable : false_type {};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __is_less_than_comparable<_Tp, _Up, __void_t<decltype(std::declval<_Tp>() < std::declval<_Up>())> > : true_type {
|
||||
};
|
||||
|
||||
template <class _Tp, class _Up, __enable_if_t<__is_less_than_comparable<const _Tp*, const _Up*>::value, int> = 0>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address") bool
|
||||
__is_pointer_in_range(const _Tp* __begin, const _Tp* __end, const _Up* __ptr) {
|
||||
_LIBCPP_ASSERT_VALID_INPUT_RANGE(std::__is_valid_range(__begin, __end), "[__begin, __end) is not a valid range");
|
||||
|
||||
if (__libcpp_is_constant_evaluated()) {
|
||||
// If this is not a constant during constant evaluation we know that __ptr is not part of the allocation where
|
||||
// [__begin, __end) is.
|
||||
if (!__builtin_constant_p(__begin <= __ptr && __ptr < __end))
|
||||
return false;
|
||||
}
|
||||
|
||||
return !__less<>()(__ptr, __begin) && __less<>()(__ptr, __end);
|
||||
}
|
||||
|
||||
template <class _Tp, class _Up, __enable_if_t<!__is_less_than_comparable<const _Tp*, const _Up*>::value, int> = 0>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address") bool
|
||||
__is_pointer_in_range(const _Tp* __begin, const _Tp* __end, const _Up* __ptr) {
|
||||
if (__libcpp_is_constant_evaluated())
|
||||
return false;
|
||||
|
||||
return reinterpret_cast<const char*>(__begin) <= reinterpret_cast<const char*>(__ptr) &&
|
||||
reinterpret_cast<const char*>(__ptr) < reinterpret_cast<const char*>(__end);
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___UTILITY_IS_POINTER_IN_RANGE_H
|
37
third_party/libcxx/__utility/is_valid_range.h
vendored
Normal file
37
third_party/libcxx/__utility/is_valid_range.h
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___UTILITY_IS_VALID_RANGE_H
|
||||
#define _LIBCPP___UTILITY_IS_VALID_RANGE_H
|
||||
|
||||
#include <__algorithm/comp.h>
|
||||
#include <__config>
|
||||
#include <__type_traits/is_constant_evaluated.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_NO_SANITIZE("address") bool
|
||||
__is_valid_range(const _Tp* __first, const _Tp* __last) {
|
||||
if (__libcpp_is_constant_evaluated()) {
|
||||
// If this is not a constant during constant evaluation, that is because __first and __last are not
|
||||
// part of the same allocation. If they are part of the same allocation, we must still make sure they
|
||||
// are ordered properly.
|
||||
return __builtin_constant_p(__first <= __last) && __first <= __last;
|
||||
}
|
||||
|
||||
return !__less<>()(__last, __first);
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___UTILITY_IS_VALID_RANGE_H
|
13
third_party/libcxx/__utility/move.h
vendored
13
third_party/libcxx/__utility/move.h
vendored
|
@ -12,18 +12,21 @@
|
|||
|
||||
#include <__config>
|
||||
#include <__type_traits/conditional.h>
|
||||
#include <__type_traits/is_copy_constructible.h>
|
||||
#include <__type_traits/is_nothrow_move_constructible.h>
|
||||
#include <__type_traits/is_constructible.h>
|
||||
#include <__type_traits/is_nothrow_constructible.h>
|
||||
#include <__type_traits/remove_reference.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __libcpp_remove_reference_t<_Tp>&&
|
||||
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __libcpp_remove_reference_t<_Tp>&&
|
||||
move(_LIBCPP_LIFETIMEBOUND _Tp&& __t) _NOEXCEPT {
|
||||
typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tp> _Up;
|
||||
return static_cast<_Up&&>(__t);
|
||||
|
@ -34,11 +37,13 @@ using __move_if_noexcept_result_t =
|
|||
__conditional_t<!is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value, const _Tp&, _Tp&&>;
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __move_if_noexcept_result_t<_Tp>
|
||||
_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __move_if_noexcept_result_t<_Tp>
|
||||
move_if_noexcept(_LIBCPP_LIFETIMEBOUND _Tp& __x) _NOEXCEPT {
|
||||
return std::move(__x);
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___UTILITY_MOVE_H
|
||||
|
|
54
third_party/libcxx/__utility/no_destroy.h
vendored
Normal file
54
third_party/libcxx/__utility/no_destroy.h
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___UTILITY_NO_DESTROY_H
|
||||
#define _LIBCPP___UTILITY_NO_DESTROY_H
|
||||
|
||||
#include <__config>
|
||||
#include <__type_traits/is_constant_evaluated.h>
|
||||
#include <__utility/forward.h>
|
||||
#include <new>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
struct __uninitialized_tag {};
|
||||
|
||||
// This class stores an object of type _Tp but never destroys it.
|
||||
//
|
||||
// This is akin to using __attribute__((no_destroy)), except that it is possible
|
||||
// to control the lifetime of the object with more flexibility by deciding e.g.
|
||||
// whether to initialize the object at construction or to defer to a later
|
||||
// initialization using __emplace.
|
||||
template <class _Tp>
|
||||
struct __no_destroy {
|
||||
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __no_destroy(__uninitialized_tag) : __obj_() {}
|
||||
|
||||
template <class... _Args>
|
||||
_LIBCPP_HIDE_FROM_ABI explicit __no_destroy(_Args&&... __args) {
|
||||
::new ((void*)__obj_) _Tp(std::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class... _Args>
|
||||
_LIBCPP_HIDE_FROM_ABI _Tp& __emplace(_Args&&... __args) {
|
||||
return *(::new ((void*)__obj_) _Tp(std::forward<_Args>(__args)...));
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI _Tp& __get() { return *reinterpret_cast<_Tp*>(__obj_); }
|
||||
_LIBCPP_HIDE_FROM_ABI _Tp const& __get() const { return *reinterpret_cast<const _Tp*>(__obj_); }
|
||||
|
||||
private:
|
||||
_ALIGNAS_TYPE(_Tp) char __obj_[sizeof(_Tp)];
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP___UTILITY_NO_DESTROY_H
|
1158
third_party/libcxx/__utility/pair.h
vendored
1158
third_party/libcxx/__utility/pair.h
vendored
File diff suppressed because it is too large
Load diff
|
@ -17,7 +17,9 @@
|
|||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t { explicit piecewise_construct_t() = default; };
|
||||
struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t {
|
||||
explicit piecewise_construct_t() = default;
|
||||
};
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
inline constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
|
||||
|
|
6
third_party/libcxx/__utility/priority_tag.h
vendored
6
third_party/libcxx/__utility/priority_tag.h
vendored
|
@ -18,8 +18,10 @@
|
|||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template<size_t _Ip> struct __priority_tag : __priority_tag<_Ip - 1> {};
|
||||
template<> struct __priority_tag<0> {};
|
||||
template <size_t _Ip>
|
||||
struct __priority_tag : __priority_tag<_Ip - 1> {};
|
||||
template <>
|
||||
struct __priority_tag<0> {};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
|
28
third_party/libcxx/__utility/private_constructor_tag.h
vendored
Normal file
28
third_party/libcxx/__utility/private_constructor_tag.h
vendored
Normal file
|
@ -0,0 +1,28 @@
|
|||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP__UTILITY_PRIVATE_CONSTRUCTOR_TAG_H
|
||||
#define _LIBCPP__UTILITY_PRIVATE_CONSTRUCTOR_TAG_H
|
||||
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// This tag allows defining non-standard exposition-only constructors while
|
||||
// preventing users from being able to use them, since this reserved-name tag
|
||||
// needs to be used.
|
||||
struct __private_constructor_tag {};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP__UTILITY_PRIVATE_CONSTRUCTOR_TAG_H
|
39
third_party/libcxx/__utility/rel_ops.h
vendored
39
third_party/libcxx/__utility/rel_ops.h
vendored
|
@ -17,39 +17,26 @@
|
|||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
namespace rel_ops
|
||||
{
|
||||
namespace rel_ops {
|
||||
|
||||
template<class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const _Tp& __x, const _Tp& __y)
|
||||
{
|
||||
return !(__x == __y);
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI bool operator!=(const _Tp& __x, const _Tp& __y) {
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator> (const _Tp& __x, const _Tp& __y)
|
||||
{
|
||||
return __y < __x;
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI bool operator>(const _Tp& __x, const _Tp& __y) {
|
||||
return __y < __x;
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<=(const _Tp& __x, const _Tp& __y)
|
||||
{
|
||||
return !(__y < __x);
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI bool operator<=(const _Tp& __x, const _Tp& __y) {
|
||||
return !(__y < __x);
|
||||
}
|
||||
|
||||
template<class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>=(const _Tp& __x, const _Tp& __y)
|
||||
{
|
||||
return !(__x < __y);
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI bool operator>=(const _Tp& __x, const _Tp& __y) {
|
||||
return !(__x < __y);
|
||||
}
|
||||
|
||||
} // namespace rel_ops
|
||||
|
|
99
third_party/libcxx/__utility/small_buffer.h
vendored
Normal file
99
third_party/libcxx/__utility/small_buffer.h
vendored
Normal file
|
@ -0,0 +1,99 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___UTILITY_SMALL_BUFFER_H
|
||||
#define _LIBCPP___UTILITY_SMALL_BUFFER_H
|
||||
|
||||
#include <__config>
|
||||
#include <__memory/construct_at.h>
|
||||
#include <__type_traits/decay.h>
|
||||
#include <__type_traits/is_trivially_constructible.h>
|
||||
#include <__type_traits/is_trivially_destructible.h>
|
||||
#include <__utility/exception_guard.h>
|
||||
#include <__utility/forward.h>
|
||||
#include <cstddef>
|
||||
#include <new>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER >= 23
|
||||
|
||||
// __small_buffer is a helper class to perform the well known SBO (small buffer optimization). It is mainly useful to
|
||||
// allow type-erasing classes like move_only_function to store small objects in a local buffer without requiring an
|
||||
// allocation.
|
||||
//
|
||||
// This small buffer class only allows storing trivially relocatable objects inside the local storage to allow
|
||||
// __small_buffer to be trivially relocatable itself. Since the buffer doesn't know what's stored inside it, the user
|
||||
// has to manage the object's lifetime, in particular the destruction of the object.
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <size_t _BufferSize, size_t _BufferAlignment>
|
||||
requires(_BufferSize > 0 && _BufferAlignment > 0)
|
||||
class __small_buffer {
|
||||
public:
|
||||
template <class _Tp, class _Decayed = decay_t<_Tp>>
|
||||
static constexpr bool __fits_in_buffer =
|
||||
is_trivially_move_constructible_v<_Decayed> && is_trivially_destructible_v<_Decayed> &&
|
||||
sizeof(_Decayed) <= _BufferSize && alignof(_Decayed) <= _BufferAlignment;
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI __small_buffer() = default;
|
||||
__small_buffer(const __small_buffer&) = delete;
|
||||
__small_buffer& operator=(const __small_buffer&) = delete;
|
||||
_LIBCPP_HIDE_FROM_ABI ~__small_buffer() = default;
|
||||
|
||||
// Relocates the buffer - __delete() should never be called on a moved-from __small_buffer
|
||||
_LIBCPP_HIDE_FROM_ABI __small_buffer(__small_buffer&&) = default;
|
||||
_LIBCPP_HIDE_FROM_ABI __small_buffer& operator=(__small_buffer&&) = default;
|
||||
|
||||
template <class _Stored>
|
||||
_LIBCPP_HIDE_FROM_ABI _Stored* __get() {
|
||||
if constexpr (__fits_in_buffer<_Stored>)
|
||||
return std::launder(reinterpret_cast<_Stored*>(__buffer_));
|
||||
else
|
||||
return *std::launder(reinterpret_cast<_Stored**>(__buffer_));
|
||||
}
|
||||
|
||||
template <class _Stored>
|
||||
_LIBCPP_HIDE_FROM_ABI _Stored* __alloc() {
|
||||
if constexpr (__fits_in_buffer<_Stored>) {
|
||||
return std::launder(reinterpret_cast<_Stored*>(__buffer_));
|
||||
} else {
|
||||
byte* __allocation = static_cast<byte*>(::operator new[](sizeof(_Stored), align_val_t{alignof(_Stored)}));
|
||||
std::construct_at(reinterpret_cast<byte**>(__buffer_), __allocation);
|
||||
return std::launder(reinterpret_cast<_Stored*>(__allocation));
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Stored>
|
||||
_LIBCPP_HIDE_FROM_ABI void __dealloc() noexcept {
|
||||
if constexpr (!__fits_in_buffer<_Stored>)
|
||||
::operator delete[](*reinterpret_cast<void**>(__buffer_), sizeof(_Stored), align_val_t{alignof(_Stored)});
|
||||
}
|
||||
|
||||
template <class _Stored, class... _Args>
|
||||
_LIBCPP_HIDE_FROM_ABI void __construct(_Args&&... __args) {
|
||||
_Stored* __buffer = __alloc<_Stored>();
|
||||
auto __guard = std::__make_exception_guard([&] { __dealloc<_Stored>(); });
|
||||
std::construct_at(__buffer, std::forward<_Args>(__args)...);
|
||||
__guard.__complete();
|
||||
}
|
||||
|
||||
private:
|
||||
alignas(_BufferAlignment) byte __buffer_[_BufferSize];
|
||||
};
|
||||
|
||||
# undef _LIBCPP_SMALL_BUFFER_TRIVIAL_ABI
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 23
|
||||
|
||||
#endif // _LIBCPP___UTILITY_SMALL_BUFFER_H
|
29
third_party/libcxx/__utility/swap.h
vendored
29
third_party/libcxx/__utility/swap.h
vendored
|
@ -10,10 +10,10 @@
|
|||
#define _LIBCPP___UTILITY_SWAP_H
|
||||
|
||||
#include <__config>
|
||||
#include <__type_traits/is_move_assignable.h>
|
||||
#include <__type_traits/is_move_constructible.h>
|
||||
#include <__type_traits/is_nothrow_move_assignable.h>
|
||||
#include <__type_traits/is_nothrow_move_constructible.h>
|
||||
#include <__type_traits/is_assignable.h>
|
||||
#include <__type_traits/is_constructible.h>
|
||||
#include <__type_traits/is_nothrow_assignable.h>
|
||||
#include <__type_traits/is_nothrow_constructible.h>
|
||||
#include <__type_traits/is_swappable.h>
|
||||
#include <__utility/declval.h>
|
||||
#include <__utility/move.h>
|
||||
|
@ -23,27 +23,30 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp>
|
||||
using __swap_result_t = typename enable_if<is_move_constructible<_Tp>::value && is_move_assignable<_Tp>::value>::type;
|
||||
using __swap_result_t = __enable_if_t<is_move_constructible<_Tp>::value && is_move_assignable<_Tp>::value>;
|
||||
#else
|
||||
template <class>
|
||||
using __swap_result_t = void;
|
||||
#endif
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY __swap_result_t<_Tp> _LIBCPP_CONSTEXPR_SINCE_CXX20 swap(_Tp& __x, _Tp& __y)
|
||||
inline _LIBCPP_HIDE_FROM_ABI __swap_result_t<_Tp> _LIBCPP_CONSTEXPR_SINCE_CXX20 swap(_Tp& __x, _Tp& __y)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<_Tp>::value&& is_nothrow_move_assignable<_Tp>::value) {
|
||||
_Tp __t(_VSTD::move(__x));
|
||||
__x = _VSTD::move(__y);
|
||||
__y = _VSTD::move(__t);
|
||||
_Tp __t(std::move(__x));
|
||||
__x = std::move(__y);
|
||||
__y = std::move(__t);
|
||||
}
|
||||
|
||||
template <class _Tp, size_t _Np>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 typename enable_if<__is_swappable<_Tp>::value>::type
|
||||
swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) {
|
||||
template <class _Tp, size_t _Np, __enable_if_t<__is_swappable_v<_Tp>, int> >
|
||||
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np])
|
||||
_NOEXCEPT_(__is_nothrow_swappable_v<_Tp>) {
|
||||
for (size_t __i = 0; __i != _Np; ++__i) {
|
||||
swap(__a[__i], __b[__i]);
|
||||
}
|
||||
|
@ -51,4 +54,6 @@ swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::v
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___UTILITY_SWAP_H
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___UTILITY_TERMINATE_ON_EXCEPTION_H
|
||||
#define _LIBCPP___UTILITY_TERMINATE_ON_EXCEPTION_H
|
||||
|
||||
#include <__config>
|
||||
#include <__exception/terminate.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
# ifndef _LIBCPP_HAS_NO_EXCEPTIONS
|
||||
|
||||
template <class _Func>
|
||||
_LIBCPP_HIDE_FROM_ABI auto __terminate_on_exception(_Func __func) {
|
||||
try {
|
||||
return __func();
|
||||
} catch (...) {
|
||||
std::terminate();
|
||||
}
|
||||
}
|
||||
|
||||
# else // _LIBCPP_HAS_NO_EXCEPTIONS
|
||||
|
||||
template <class _Func>
|
||||
_LIBCPP_HIDE_FROM_ABI auto __terminate_on_exception(_Func __func) {
|
||||
return __func();
|
||||
}
|
||||
|
||||
# endif // _LIBCPP_HAS_NO_EXCEPTIONS
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 17
|
||||
|
||||
#endif // _LIBCPP___UTILITY_TERMINATE_ON_EXCEPTION_H
|
8
third_party/libcxx/__utility/to_underlying.h
vendored
8
third_party/libcxx/__utility/to_underlying.h
vendored
|
@ -21,17 +21,15 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr typename underlying_type<_Tp>::type
|
||||
__to_underlying(_Tp __val) noexcept {
|
||||
_LIBCPP_HIDE_FROM_ABI constexpr typename underlying_type<_Tp>::type __to_underlying(_Tp __val) noexcept {
|
||||
return static_cast<typename underlying_type<_Tp>::type>(__val);
|
||||
}
|
||||
#endif // !_LIBCPP_CXX03_LANG
|
||||
|
||||
#if _LIBCPP_STD_VER >= 23
|
||||
template <class _Tp>
|
||||
_LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY constexpr underlying_type_t<_Tp>
|
||||
to_underlying(_Tp __val) noexcept {
|
||||
return _VSTD::__to_underlying(__val);
|
||||
[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr underlying_type_t<_Tp> to_underlying(_Tp __val) noexcept {
|
||||
return std::__to_underlying(__val);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
4
third_party/libcxx/__utility/unreachable.h
vendored
4
third_party/libcxx/__utility/unreachable.h
vendored
|
@ -19,8 +19,8 @@
|
|||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __libcpp_unreachable() {
|
||||
_LIBCPP_ASSERT(false, "std::unreachable() was reached");
|
||||
__builtin_unreachable();
|
||||
_LIBCPP_ASSERT_INTERNAL(false, "std::unreachable() was reached");
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER >= 23
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue