Upgrade to 2022-era LLVM LIBCXX

This commit is contained in:
Justine Tunney 2024-05-27 02:12:27 -07:00
parent 2f4ca71f26
commit 8e68384e15
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
2078 changed files with 165657 additions and 65010 deletions

View file

@ -1,5 +1,5 @@
// -*- C++ -*-
//===---------------------------- ratio -----------------------------------===//
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@ -10,21 +10,6 @@
#ifndef _LIBCPP_RATIO
#define _LIBCPP_RATIO
#include "third_party/libcxx/__config"
#include "third_party/libcxx/cstdint"
#include "third_party/libcxx/climits"
#include "third_party/libcxx/type_traits"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
/*
ratio synopsis
@ -92,6 +77,23 @@ typedef ratio<1000000000000000000000000, 1> yotta; // not supported
}
*/
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
#include <__type_traits/integral_constant.h>
#include <climits>
#include <cstdint>
#include <version>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include <__undef_macros>
_LIBCPP_BEGIN_NAMESPACE_STD
// __static_gcd
template <intmax_t _Xp, intmax_t _Yp>
@ -312,7 +314,7 @@ template <class _R1, class _R2>
struct _LIBCPP_TEMPLATE_VIS ratio_multiply
: public __ratio_multiply<_R1, _R2>::type {};
#endif // _LIBCPP_CXX03_LANG
#endif // _LIBCPP_CXX03_LANG
template <class _R1, class _R2>
struct __ratio_divide
@ -339,7 +341,7 @@ template <class _R1, class _R2>
struct _LIBCPP_TEMPLATE_VIS ratio_divide
: public __ratio_divide<_R1, _R2>::type {};
#endif // _LIBCPP_CXX03_LANG
#endif // _LIBCPP_CXX03_LANG
template <class _R1, class _R2>
struct __ratio_add
@ -374,7 +376,7 @@ template <class _R1, class _R2>
struct _LIBCPP_TEMPLATE_VIS ratio_add
: public __ratio_add<_R1, _R2>::type {};
#endif // _LIBCPP_CXX03_LANG
#endif // _LIBCPP_CXX03_LANG
template <class _R1, class _R2>
struct __ratio_subtract
@ -409,17 +411,17 @@ template <class _R1, class _R2>
struct _LIBCPP_TEMPLATE_VIS ratio_subtract
: public __ratio_subtract<_R1, _R2>::type {};
#endif // _LIBCPP_CXX03_LANG
#endif // _LIBCPP_CXX03_LANG
// ratio_equal
template <class _R1, class _R2>
struct _LIBCPP_TEMPLATE_VIS ratio_equal
: public _LIBCPP_BOOL_CONSTANT((_R1::num == _R2::num && _R1::den == _R2::den)) {};
: _BoolConstant<(_R1::num == _R2::num && _R1::den == _R2::den)> {};
template <class _R1, class _R2>
struct _LIBCPP_TEMPLATE_VIS ratio_not_equal
: public _LIBCPP_BOOL_CONSTANT((!ratio_equal<_R1, _R2>::value)) {};
: _BoolConstant<!ratio_equal<_R1, _R2>::value> {};
// ratio_less
@ -478,19 +480,19 @@ struct __ratio_less<_R1, _R2, -1LL, -1LL>
template <class _R1, class _R2>
struct _LIBCPP_TEMPLATE_VIS ratio_less
: public _LIBCPP_BOOL_CONSTANT((__ratio_less<_R1, _R2>::value)) {};
: _BoolConstant<__ratio_less<_R1, _R2>::value> {};
template <class _R1, class _R2>
struct _LIBCPP_TEMPLATE_VIS ratio_less_equal
: public _LIBCPP_BOOL_CONSTANT((!ratio_less<_R2, _R1>::value)) {};
: _BoolConstant<!ratio_less<_R2, _R1>::value> {};
template <class _R1, class _R2>
struct _LIBCPP_TEMPLATE_VIS ratio_greater
: public _LIBCPP_BOOL_CONSTANT((ratio_less<_R2, _R1>::value)) {};
: _BoolConstant<ratio_less<_R2, _R1>::value> {};
template <class _R1, class _R2>
struct _LIBCPP_TEMPLATE_VIS ratio_greater_equal
: public _LIBCPP_BOOL_CONSTANT((!ratio_less<_R1, _R2>::value)) {};
: _BoolConstant<!ratio_less<_R1, _R2>::value> {};
template <class _R1, class _R2>
struct __ratio_gcd
@ -499,34 +501,32 @@ struct __ratio_gcd
__static_lcm<_R1::den, _R2::den>::value> type;
};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
#if _LIBCPP_STD_VER >= 17
template <class _R1, class _R2>
_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool ratio_equal_v
= ratio_equal<_R1, _R2>::value;
inline constexpr bool ratio_equal_v = ratio_equal<_R1, _R2>::value;
template <class _R1, class _R2>
_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool ratio_not_equal_v
= ratio_not_equal<_R1, _R2>::value;
inline constexpr bool ratio_not_equal_v = ratio_not_equal<_R1, _R2>::value;
template <class _R1, class _R2>
_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool ratio_less_v
= ratio_less<_R1, _R2>::value;
inline constexpr bool ratio_less_v = ratio_less<_R1, _R2>::value;
template <class _R1, class _R2>
_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool ratio_less_equal_v
= ratio_less_equal<_R1, _R2>::value;
inline constexpr bool ratio_less_equal_v = ratio_less_equal<_R1, _R2>::value;
template <class _R1, class _R2>
_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool ratio_greater_v
= ratio_greater<_R1, _R2>::value;
inline constexpr bool ratio_greater_v = ratio_greater<_R1, _R2>::value;
template <class _R1, class _R2>
_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool ratio_greater_equal_v
= ratio_greater_equal<_R1, _R2>::value;
inline constexpr bool ratio_greater_equal_v = ratio_greater_equal<_R1, _R2>::value;
#endif
_LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS
#endif // _LIBCPP_RATIO
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <type_traits>
#endif
#endif // _LIBCPP_RATIO