Import Cobalt 24.master.0.1033952
diff --git a/third_party/llvm-project/libcxx/include/CMakeLists.txt b/third_party/llvm-project/libcxx/include/CMakeLists.txt index a12aa1d..439cddd 100644 --- a/third_party/llvm-project/libcxx/include/CMakeLists.txt +++ b/third_party/llvm-project/libcxx/include/CMakeLists.txt
@@ -44,6 +44,7 @@ __algorithm/iter_swap.h __algorithm/iterator_operations.h __algorithm/lexicographical_compare.h + __algorithm/lexicographical_compare_three_way.h __algorithm/lower_bound.h __algorithm/make_heap.h __algorithm/make_projected.h @@ -183,6 +184,7 @@ __algorithm/stable_partition.h __algorithm/stable_sort.h __algorithm/swap_ranges.h + __algorithm/three_way_comp_ref_type.h __algorithm/transform.h __algorithm/uniform_random_bit_generator_adaptor.h __algorithm/unique.h @@ -191,6 +193,20 @@ __algorithm/unwrap_range.h __algorithm/upper_bound.h __assert + __atomic/aliases.h + __atomic/atomic.h + __atomic/atomic_base.h + __atomic/atomic_flag.h + __atomic/atomic_init.h + __atomic/atomic_lock_free.h + __atomic/atomic_sync.h + __atomic/check_memory_order.h + __atomic/contention_t.h + __atomic/cxx_atomic_impl.h + __atomic/fence.h + __atomic/is_always_lock_free.h + __atomic/kill_dependency.h + __atomic/memory_order.h __availability __bit/bit_cast.h __bit/bit_ceil.h @@ -209,11 +225,17 @@ __bsd_locale_defaults.h __bsd_locale_fallbacks.h __charconv/chars_format.h + __charconv/from_chars_integral.h __charconv/from_chars_result.h __charconv/tables.h + __charconv/to_chars.h __charconv/to_chars_base_10.h + __charconv/to_chars_floating_point.h + __charconv/to_chars_integral.h __charconv/to_chars_result.h + __charconv/traits.h __chrono/calendar.h + __chrono/concepts.h __chrono/convert_to_timespec.h __chrono/convert_to_tm.h __chrono/day.h @@ -272,6 +294,7 @@ __concepts/semiregular.h __concepts/swappable.h __concepts/totally_ordered.h + __condition_variable/condition_variable.h __config __coroutine/coroutine_handle.h __coroutine/coroutine_traits.h @@ -279,7 +302,11 @@ __coroutine/trivial_awaitables.h __debug __debug_utils/randomize_range.h - __errc + __exception/exception.h + __exception/exception_ptr.h + __exception/nested_exception.h + __exception/operations.h + __exception/terminate.h __expected/bad_expected_access.h __expected/expected.h __expected/unexpect.h @@ -414,6 +441,7 @@ __mbstate_t.h __memory/addressof.h __memory/align.h + __memory/aligned_alloc.h __memory/allocate_at_least.h __memory/allocation_guard.h __memory/allocator.h @@ -446,7 +474,10 @@ __memory_resource/pool_options.h __memory_resource/synchronized_pool_resource.h __memory_resource/unsynchronized_pool_resource.h - __mutex_base + __mutex/lock_guard.h + __mutex/mutex.h + __mutex/tag_types.h + __mutex/unique_lock.h __node_handle __numeric/accumulate.h __numeric/adjacent_difference.h @@ -537,8 +568,8 @@ __ranges/views.h __ranges/zip_view.h __split_buffer - __std_stream __string/char_traits.h + __string/constexpr_c_functions.h __string/extern_template_lists.h __support/android/locale_bionic.h __support/fuchsia/xlocale.h @@ -556,20 +587,25 @@ __support/xlocale/__nop_locale_mgmt.h __support/xlocale/__posix_l_fallback.h __support/xlocale/__strtonum_fallback.h + __system_error/errc.h + __system_error/error_category.h + __system_error/error_code.h + __system_error/error_condition.h + __system_error/system_error.h __thread/poll_with_backoff.h __thread/timed_backoff_policy.h __threading_support __tree - __tuple_dir/apply_cv.h - __tuple_dir/make_tuple_types.h - __tuple_dir/pair_like.h - __tuple_dir/sfinae_helpers.h - __tuple_dir/tuple_element.h - __tuple_dir/tuple_indices.h - __tuple_dir/tuple_like.h - __tuple_dir/tuple_like_ext.h - __tuple_dir/tuple_size.h - __tuple_dir/tuple_types.h + __tuple/apply_cv.h + __tuple/make_tuple_types.h + __tuple/pair_like.h + __tuple/sfinae_helpers.h + __tuple/tuple_element.h + __tuple/tuple_indices.h + __tuple/tuple_like.h + __tuple/tuple_like_ext.h + __tuple/tuple_size.h + __tuple/tuple_types.h __type_traits/add_const.h __type_traits/add_cv.h __type_traits/add_lvalue_reference.h @@ -619,6 +655,7 @@ __type_traits/is_destructible.h __type_traits/is_empty.h __type_traits/is_enum.h + __type_traits/is_equality_comparable.h __type_traits/is_final.h __type_traits/is_floating_point.h __type_traits/is_function.h @@ -683,6 +720,7 @@ __type_traits/nat.h __type_traits/negation.h __type_traits/noexcept_move_assign_container.h + __type_traits/predicate_traits.h __type_traits/promote.h __type_traits/rank.h __type_traits/remove_all_extents.h @@ -771,11 +809,8 @@ expected experimental/__config experimental/__memory - experimental/algorithm - experimental/coroutine experimental/deque experimental/forward_list - experimental/functional experimental/iterator experimental/list experimental/map
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/clamp.h b/third_party/llvm-project/libcxx/include/__algorithm/clamp.h index 30ddbdc..336b93f 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/clamp.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/clamp.h
@@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template<class _Tp, class _Compare> _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY constexpr
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/comp.h b/third_party/llvm-project/libcxx/include/__algorithm/comp.h index af8eb7b..1001e42 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/comp.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/comp.h
@@ -10,6 +10,8 @@ #define _LIBCPP___ALGORITHM_COMP_H #include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/predicate_traits.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -24,6 +26,9 @@ } }; +template <class _Lhs, class _Rhs> +struct __is_trivial_equality_predicate<__equal_to, _Lhs, _Rhs> : true_type {}; + template <class _T1, class _T2 = _T1> struct __less {
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/copy_n.h b/third_party/llvm-project/libcxx/include/__algorithm/copy_n.h index b08bbdf..7089ef3 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/copy_n.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/copy_n.h
@@ -12,8 +12,8 @@ #include <__algorithm/copy.h> #include <__config> #include <__iterator/iterator_traits.h> +#include <__type_traits/enable_if.h> #include <__utility/convert_to_integral.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/equal.h b/third_party/llvm-project/libcxx/include/__algorithm/equal.h index cf37f46..a26299a 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/equal.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/equal.h
@@ -11,9 +11,20 @@ #define _LIBCPP___ALGORITHM_EQUAL_H #include <__algorithm/comp.h> +#include <__algorithm/unwrap_iter.h> #include <__config> +#include <__functional/identity.h> +#include <__functional/invoke.h> #include <__iterator/distance.h> #include <__iterator/iterator_traits.h> +#include <__string/constexpr_c_functions.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_constant_evaluated.h> +#include <__type_traits/is_equality_comparable.h> +#include <__type_traits/is_volatile.h> +#include <__type_traits/predicate_traits.h> +#include <__utility/move.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -22,23 +33,42 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate> -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool -equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) { +_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal_iter_impl( + _InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate& __pred) { for (; __first1 != __last1; ++__first1, (void)++__first2) if (!__pred(*__first1, *__first2)) return false; return true; } +template < + class _Tp, + class _Up, + class _BinaryPredicate, + __enable_if_t<__is_trivial_equality_predicate<_BinaryPredicate, _Tp, _Up>::value && !is_volatile<_Tp>::value && + !is_volatile<_Up>::value && __libcpp_is_trivially_equality_comparable<_Tp, _Up>::value, + int> = 0> +_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +__equal_iter_impl(_Tp* __first1, _Tp* __last1, _Up* __first2, _BinaryPredicate&) { + return std::__constexpr_memcmp(__first1, __first2, (__last1 - __first1) * sizeof(_Tp)) == 0; +} + +template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate> +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _BinaryPredicate __pred) { + return std::__equal_iter_impl( + std::__unwrap_iter(__first1), std::__unwrap_iter(__last1), std::__unwrap_iter(__first2), __pred); +} + template <class _InputIterator1, class _InputIterator2> -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2) { return std::equal(__first1, __last1, __first2, __equal_to()); } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _BinaryPredicate, class _InputIterator1, class _InputIterator2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _BinaryPredicate __pred, input_iterator_tag, input_iterator_tag) { for (; __first1 != __last1 && __first2 != __last2; ++__first1, (void)++__first2) @@ -47,19 +77,52 @@ return __first1 == __last1 && __first2 == __last2; } +template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class _Pred, class _Proj1, class _Proj2> +_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal_impl( + _Iter1 __first1, _Sent1 __last1, _Iter2 __first2, _Sent2 __last2, _Pred& __comp, _Proj1& __proj1, _Proj2& __proj2) { + while (__first1 != __last1 && __first2 != __last2) { + if (!std::__invoke(__comp, std::__invoke(__proj1, *__first1), std::__invoke(__proj2, *__first2))) + return false; + ++__first1; + ++__first2; + } + return __first1 == __last1 && __first2 == __last2; +} + +template <class _Tp, + class _Up, + class _Pred, + class _Proj1, + class _Proj2, + __enable_if_t<__is_trivial_equality_predicate<_Pred, _Tp, _Up>::value && __is_identity<_Proj1>::value && + __is_identity<_Proj2>::value && !is_volatile<_Tp>::value && !is_volatile<_Up>::value && + __libcpp_is_trivially_equality_comparable<_Tp, _Up>::value, + int> = 0> +_LIBCPP_NODISCARD inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal_impl( + _Tp* __first1, _Tp* __last1, _Up* __first2, _Up*, _Pred&, _Proj1&, _Proj2&) { + return std::__constexpr_memcmp(__first1, __first2, (__last1 - __first1) * sizeof(_Tp)) == 0; +} + template <class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool __equal(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1, _RandomAccessIterator2 __first2, _RandomAccessIterator2 __last2, _BinaryPredicate __pred, random_access_iterator_tag, random_access_iterator_tag) { if (_VSTD::distance(__first1, __last1) != _VSTD::distance(__first2, __last2)) return false; - return _VSTD::equal<_RandomAccessIterator1, _RandomAccessIterator2, - _BinaryPredicate&>(__first1, __last1, __first2, __pred); + __identity __proj; + return std::__equal_impl( + std::__unwrap_iter(__first1), + std::__unwrap_iter(__last1), + std::__unwrap_iter(__first2), + std::__unwrap_iter(__last2), + __pred, + __proj, + __proj); } template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate> -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _BinaryPredicate __pred) { return _VSTD::__equal<_BinaryPredicate&>( @@ -68,7 +131,7 @@ } template <class _InputIterator1, class _InputIterator2> -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 bool +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) { return std::__equal( __first1,
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/fill.h b/third_party/llvm-project/libcxx/include/__algorithm/fill.h index 76cf4a1..0753c42 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/fill.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/fill.h
@@ -12,7 +12,6 @@ #include <__algorithm/fill_n.h> #include <__config> #include <__iterator/iterator_traits.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/fill_n.h b/third_party/llvm-project/libcxx/include/__algorithm/fill_n.h index fe58c8d..e7863ac 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/fill_n.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/fill_n.h
@@ -12,7 +12,6 @@ #include <__config> #include <__iterator/iterator_traits.h> #include <__utility/convert_to_integral.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/find_end.h b/third_party/llvm-project/libcxx/include/__algorithm/find_end.h index e2fee6b..edb9891 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/find_end.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/find_end.h
@@ -15,12 +15,12 @@ #include <__algorithm/search.h> #include <__config> #include <__functional/identity.h> +#include <__functional/invoke.h> #include <__iterator/advance.h> #include <__iterator/iterator_traits.h> #include <__iterator/next.h> #include <__iterator/reverse_iterator.h> #include <__utility/pair.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/for_each_n.h b/third_party/llvm-project/libcxx/include/__algorithm/for_each_n.h index 38d204a..5bd7318 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/for_each_n.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/for_each_n.h
@@ -12,7 +12,6 @@ #include <__config> #include <__utility/convert_to_integral.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -20,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _InputIterator, class _Size, class _Function> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _InputIterator for_each_n(_InputIterator __first,
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/generate_n.h b/third_party/llvm-project/libcxx/include/__algorithm/generate_n.h index 4525998..ff5c82d 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/generate_n.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/generate_n.h
@@ -11,7 +11,6 @@ #include <__config> #include <__utility/convert_to_integral.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/half_positive.h b/third_party/llvm-project/libcxx/include/__algorithm/half_positive.h index 74aede2..5a0f4ba 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/half_positive.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/half_positive.h
@@ -10,7 +10,9 @@ #define _LIBCPP___ALGORITHM_HALF_POSITIVE_H #include <__config> -#include <type_traits> +#include <__type_traits/enable_if.h> +#include <__type_traits/is_integral.h> +#include <__type_traits/make_unsigned.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/in_found_result.h b/third_party/llvm-project/libcxx/include/__algorithm/in_found_result.h index 3134d6e..d9ca287 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/in_found_result.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/in_found_result.h
@@ -18,7 +18,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -44,6 +44,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_IN_FOUND_RESULT_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/in_fun_result.h b/third_party/llvm-project/libcxx/include/__algorithm/in_fun_result.h index 3cbb9e1..33374ed 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/in_fun_result.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/in_fun_result.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { template <class _InIter1, class _Func1> @@ -42,7 +42,7 @@ }; } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/in_in_out_result.h b/third_party/llvm-project/libcxx/include/__algorithm/in_in_out_result.h index 3e747be..6b50e0e 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/in_in_out_result.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/in_in_out_result.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { @@ -49,7 +49,7 @@ } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/in_in_result.h b/third_party/llvm-project/libcxx/include/__algorithm/in_in_result.h index 2098c18..1eceb9d 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/in_in_result.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/in_in_result.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { @@ -46,7 +46,7 @@ } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/in_out_out_result.h b/third_party/llvm-project/libcxx/include/__algorithm/in_out_out_result.h index 4046eee..2f7a09b 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/in_out_out_result.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/in_out_out_result.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { template <class _InIter1, class _OutIter1, class _OutIter2> @@ -47,7 +47,7 @@ }; } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/in_out_result.h b/third_party/llvm-project/libcxx/include/__algorithm/in_out_result.h index 7f5a027..158b355 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/in_out_result.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/in_out_result.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { @@ -46,7 +46,7 @@ } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/is_permutation.h b/third_party/llvm-project/libcxx/include/__algorithm/is_permutation.h index 0054456..2a7c606 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/is_permutation.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/is_permutation.h
@@ -19,8 +19,8 @@ #include <__iterator/distance.h> #include <__iterator/iterator_traits.h> #include <__iterator/next.h> +#include <__type_traits/is_callable.h> #include <__utility/move.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -31,7 +31,7 @@ template <class _Iter1, class _Sent1, class _Iter2, class _Sent2, class = void> struct _ConstTimeDistance : false_type {}; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Iter1, class _Sent1, class _Iter2, class _Sent2> struct _ConstTimeDistance<_Iter1, _Sent1, _Iter2, _Sent2, __enable_if_t< @@ -47,7 +47,7 @@ is_same<typename iterator_traits<_Iter2>::iterator_category, random_access_iterator_tag>::value > > : true_type {}; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 // Internal functions @@ -202,7 +202,7 @@ return std::is_permutation(__first1, __last1, __first2, __equal_to()); } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 // 2+2 iterators template <class _ForwardIterator1, class _ForwardIterator2> @@ -231,7 +231,7 @@ __pred, __identity(), __identity()); } -#endif // _LIBCPP_STD_VER > 11 +#endif // _LIBCPP_STD_VER >= 14 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/iterator_operations.h b/third_party/llvm-project/libcxx/include/__algorithm/iterator_operations.h index bd3e6f1..2bdc0ac 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/iterator_operations.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/iterator_operations.h
@@ -37,7 +37,7 @@ template <class _AlgPolicy> struct _IterOps; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 struct _RangeAlgPolicy {}; template <>
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/lexicographical_compare_three_way.h b/third_party/llvm-project/libcxx/include/__algorithm/lexicographical_compare_three_way.h new file mode 100644 index 0000000..377c8d2 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__algorithm/lexicographical_compare_three_way.h
@@ -0,0 +1,125 @@ +//===----------------------------------------------------------------------===// +// +// 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___ALGORITHM_LEXICOGRAPHICAL_COMPARE_THREE_WAY_H +#define _LIBCPP___ALGORITHM_LEXICOGRAPHICAL_COMPARE_THREE_WAY_H + +#include <__algorithm/min.h> +#include <__algorithm/three_way_comp_ref_type.h> +#include <__compare/compare_three_way.h> +#include <__compare/ordering.h> +#include <__concepts/arithmetic.h> +#include <__config> +#include <__iterator/iterator_traits.h> +#include <__type_traits/common_type.h> +#include <__type_traits/is_copy_constructible.h> +#include <__utility/move.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER >= 20 + +// Fast path for random access iterators which computes the number of loop iterations up-front and +// then skips the iterator comparisons inside the loop. +template <class _InputIterator1, class _InputIterator2, class _Cmp> +_LIBCPP_HIDE_FROM_ABI constexpr auto __lexicographical_compare_three_way_fast_path( + _InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _Cmp& __comp) + -> decltype(__comp(*__first1, *__first2)) { + static_assert( + signed_integral<__iter_diff_t<_InputIterator1>>, "Using a non-integral difference_type is undefined behavior."); + static_assert( + signed_integral<__iter_diff_t<_InputIterator2>>, "Using a non-integral difference_type is undefined behavior."); + + using _Len1 = __iter_diff_t<_InputIterator1>; + using _Len2 = __iter_diff_t<_InputIterator2>; + using _Common = common_type_t<_Len1, _Len2>; + + _Len1 __len1 = __last1 - __first1; + _Len2 __len2 = __last2 - __first2; + _Common __min_len = std::min<_Common>(__len1, __len2); + + for (_Common __i = 0; __i < __min_len; ++__i) { + auto __c = __comp(*__first1, *__first2); + if (__c != 0) { + return __c; + } + ++__first1; + ++__first2; + } + + return __len1 <=> __len2; +} + +// Unoptimized implementation which compares the iterators against the end in every loop iteration +template <class _InputIterator1, class _InputIterator2, class _Cmp> +_LIBCPP_HIDE_FROM_ABI constexpr auto __lexicographical_compare_three_way_slow_path( + _InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _Cmp& __comp) + -> decltype(__comp(*__first1, *__first2)) { + while (true) { + bool __exhausted1 = __first1 == __last1; + bool __exhausted2 = __first2 == __last2; + + if (__exhausted1 || __exhausted2) { + if (!__exhausted1) + return strong_ordering::greater; + if (!__exhausted2) + return strong_ordering::less; + return strong_ordering::equal; + } + + auto __c = __comp(*__first1, *__first2); + if (__c != 0) { + return __c; + } + + ++__first1; + ++__first2; + } +} + +template <class _InputIterator1, class _InputIterator2, class _Cmp> +_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr auto lexicographical_compare_three_way( + _InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2, _Cmp __comp) + -> decltype(__comp(*__first1, *__first2)) { + static_assert(__comparison_category<decltype(__comp(*__first1, *__first2))>, + "The comparator passed to lexicographical_compare_three_way must return a comparison category type."); + static_assert(std::is_copy_constructible_v<_InputIterator1>, "Iterators must be copy constructible."); + static_assert(std::is_copy_constructible_v<_InputIterator2>, "Iterators must be copy constructible."); + __three_way_comp_ref_type<_Cmp> __wrapped_comp_ref(__comp); + if constexpr (__is_cpp17_random_access_iterator<_InputIterator1>::value && + __is_cpp17_random_access_iterator<_InputIterator2>::value) { + return std::__lexicographical_compare_three_way_fast_path( + std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __wrapped_comp_ref); + } else { + // Unoptimized implementation which compares the iterators against the end in every loop iteration + return std::__lexicographical_compare_three_way_slow_path( + std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), __wrapped_comp_ref); + } +} + +template <class _InputIterator1, class _InputIterator2> +_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr auto lexicographical_compare_three_way( + _InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2) { + return std::lexicographical_compare_three_way( + std::move(__first1), std::move(__last1), std::move(__first2), std::move(__last2), std::compare_three_way()); +} + +#endif // _LIBCPP_STD_VER >= 20 + +_LIBCPP_END_NAMESPACE_STD + +_LIBCPP_POP_MACROS + +#endif // _LIBCPP___ALGORITHM_LEXICOGRAPHICAL_COMPARE_THREE_WAY_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/lower_bound.h b/third_party/llvm-project/libcxx/include/__algorithm/lower_bound.h index 2648982..8109393 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/lower_bound.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/lower_bound.h
@@ -20,7 +20,6 @@ #include <__iterator/iterator_traits.h> #include <__type_traits/is_callable.h> #include <__type_traits/remove_reference.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/make_projected.h b/third_party/llvm-project/libcxx/include/__algorithm/make_projected.h index 87d4d59..defda46 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/make_projected.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/make_projected.h
@@ -55,25 +55,12 @@ }; -template <class _Pred, class _Proj, class = void> -struct __can_use_pristine_comp : false_type {}; - -template <class _Pred, class _Proj> -struct __can_use_pristine_comp<_Pred, _Proj, __enable_if_t< - !is_member_pointer<typename decay<_Pred>::type>::value && ( -#if _LIBCPP_STD_VER > 17 - is_same<typename decay<_Proj>::type, identity>::value || -#endif - is_same<typename decay<_Proj>::type, __identity>::value - ) -> > : true_type {}; - -template <class _Pred, class _Proj> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static -__enable_if_t< - !__can_use_pristine_comp<_Pred, _Proj>::value, - _ProjectedPred<_Pred, _Proj> -> +template <class _Pred, + class _Proj, + __enable_if_t<!(!is_member_pointer<__decay_t<_Pred> >::value && + __is_identity<__decay_t<_Proj> >::value), + int> = 0> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _ProjectedPred<_Pred, _Proj> __make_projected(_Pred& __pred, _Proj& __proj) { return _ProjectedPred<_Pred, _Proj>(__pred, __proj); } @@ -81,28 +68,27 @@ // Avoid creating the functor and just use the pristine comparator -- for certain algorithms, this would enable // optimizations that rely on the type of the comparator. Additionally, this results in less layers of indirection in // the call stack when the comparator is invoked, even in an unoptimized build. -template <class _Pred, class _Proj> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static -__enable_if_t< - __can_use_pristine_comp<_Pred, _Proj>::value, - _Pred& -> -__make_projected(_Pred& __pred, _Proj&) { +template <class _Pred, + class _Proj, + __enable_if_t<!is_member_pointer<__decay_t<_Pred> >::value && + __is_identity<__decay_t<_Proj> >::value, + int> = 0> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Pred& __make_projected(_Pred& __pred, _Proj&) { return __pred; } _LIBCPP_END_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { template <class _Comp, class _Proj1, class _Proj2> -_LIBCPP_HIDE_FROM_ABI constexpr static +_LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) __make_projected_comp(_Comp& __comp, _Proj1& __proj1, _Proj2& __proj2) { - if constexpr (same_as<decay_t<_Proj1>, identity> && same_as<decay_t<_Proj2>, identity> && + if constexpr (__is_identity<decay_t<_Proj1>>::value && __is_identity<decay_t<_Proj2>>::value && !is_member_pointer_v<decay_t<_Comp>>) { // Avoid creating the lambda and just use the pristine comparator -- for certain algorithms, this would enable // optimizations that rely on the type of the comparator. @@ -121,6 +107,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_MAKE_PROJECTED_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/max.h b/third_party/llvm-project/libcxx/include/__algorithm/max.h index a08a3fc..97f61f2 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/max.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/max.h
@@ -28,7 +28,7 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& -max(const _Tp& __a, const _Tp& __b, _Compare __comp) +max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp) { return __comp(__a, __b) ? __b : __a; } @@ -37,7 +37,7 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& -max(const _Tp& __a, const _Tp& __b) +max(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b) { return _VSTD::max(__a, __b, __less<_Tp>()); }
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/min.h b/third_party/llvm-project/libcxx/include/__algorithm/min.h index 2882485..d073a16 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/min.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/min.h
@@ -28,7 +28,7 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& -min(const _Tp& __a, const _Tp& __b, _Compare __comp) +min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp) { return __comp(__b, __a) ? __b : __a; } @@ -37,7 +37,7 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 const _Tp& -min(const _Tp& __a, const _Tp& __b) +min(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b) { return _VSTD::min(__a, __b, __less<_Tp>()); }
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/min_max_result.h b/third_party/llvm-project/libcxx/include/__algorithm/min_max_result.h index 4be3999..ef2d990 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/min_max_result.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/min_max_result.h
@@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { @@ -47,7 +47,7 @@ } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/minmax.h b/third_party/llvm-project/libcxx/include/__algorithm/minmax.h index 6ef0a77..f486de2 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/minmax.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/minmax.h
@@ -27,7 +27,7 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<const _Tp&, const _Tp&> -minmax(const _Tp& __a, const _Tp& __b, _Compare __comp) +minmax(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b, _Compare __comp) { return __comp(__b, __a) ? pair<const _Tp&, const _Tp&>(__b, __a) : pair<const _Tp&, const _Tp&>(__a, __b); @@ -37,7 +37,7 @@ _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<const _Tp&, const _Tp&> -minmax(const _Tp& __a, const _Tp& __b) +minmax(_LIBCPP_LIFETIMEBOUND const _Tp& __a, _LIBCPP_LIFETIMEBOUND const _Tp& __b) { return std::minmax(__a, __b, __less<_Tp>()); }
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/minmax_element.h b/third_party/llvm-project/libcxx/include/__algorithm/minmax_element.h index caa963e..1ac4078 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/minmax_element.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/minmax_element.h
@@ -12,9 +12,10 @@ #include <__algorithm/comp.h> #include <__config> #include <__functional/identity.h> +#include <__functional/invoke.h> #include <__iterator/iterator_traits.h> +#include <__type_traits/is_callable.h> #include <__utility/pair.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/mismatch.h b/third_party/llvm-project/libcxx/include/__algorithm/mismatch.h index 600e2cd..e5b014f 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/mismatch.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/mismatch.h
@@ -38,7 +38,7 @@ return std::mismatch(__first1, __last1, __first2, __equal_to()); } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate> _LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 pair<_InputIterator1, _InputIterator2>
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/partial_sort.h b/third_party/llvm-project/libcxx/include/__algorithm/partial_sort.h index e0812af..4b8e0e7 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/partial_sort.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/partial_sort.h
@@ -19,8 +19,9 @@ #include <__debug> #include <__debug_utils/randomize_range.h> #include <__iterator/iterator_traits.h> +#include <__type_traits/is_copy_assignable.h> +#include <__type_traits/is_copy_constructible.h> #include <__utility/move.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/partition.h b/third_party/llvm-project/libcxx/include/__algorithm/partition.h index 0e094bf8..a58dd64 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/partition.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/partition.h
@@ -14,7 +14,6 @@ #include <__iterator/iterator_traits.h> #include <__utility/move.h> #include <__utility/pair.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/pop_heap.h b/third_party/llvm-project/libcxx/include/__algorithm/pop_heap.h index 94d32a4..4187523 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/pop_heap.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/pop_heap.h
@@ -17,8 +17,9 @@ #include <__assert> #include <__config> #include <__iterator/iterator_traits.h> +#include <__type_traits/is_copy_assignable.h> +#include <__type_traits/is_copy_constructible.h> #include <__utility/move.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/push_heap.h b/third_party/llvm-project/libcxx/include/__algorithm/push_heap.h index 9068495..e831162 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/push_heap.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/push_heap.h
@@ -14,8 +14,9 @@ #include <__algorithm/iterator_operations.h> #include <__config> #include <__iterator/iterator_traits.h> +#include <__type_traits/is_copy_assignable.h> +#include <__type_traits/is_copy_constructible.h> #include <__utility/move.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_adjacent_find.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_adjacent_find.h index d338d13..e3de36b 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_adjacent_find.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_adjacent_find.h
@@ -24,7 +24,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -73,6 +73,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_ADJACENT_FIND_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_all_of.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_all_of.h index e45c4e5..494a77d 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_all_of.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_all_of.h
@@ -22,7 +22,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -63,6 +63,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_ALL_OF_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_any_of.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_any_of.h index e7d1e72..eb102bd 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_any_of.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_any_of.h
@@ -22,7 +22,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -63,6 +63,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_ANY_OF_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_binary_search.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_binary_search.h index b2a8977..d89597e 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_binary_search.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_binary_search.h
@@ -24,7 +24,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -36,7 +36,7 @@ _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Iter __first, _Sent __last, const _Type& __value, _Comp __comp = {}, _Proj __proj = {}) const { auto __ret = std::__lower_bound_impl<_RangeAlgPolicy>(__first, __last, __value, __comp, __proj); - return __ret != __last && !std::invoke(__comp, __value, std::invoke(__proj, *__first)); + return __ret != __last && !std::invoke(__comp, __value, std::invoke(__proj, *__ret)); } template <forward_range _Range, class _Type, class _Proj = identity, @@ -46,7 +46,7 @@ auto __first = ranges::begin(__r); auto __last = ranges::end(__r); auto __ret = std::__lower_bound_impl<_RangeAlgPolicy>(__first, __last, __value, __comp, __proj); - return __ret != __last && !std::invoke(__comp, __value, std::invoke(__proj, *__first)); + return __ret != __last && !std::invoke(__comp, __value, std::invoke(__proj, *__ret)); } }; } // namespace __binary_search @@ -58,6 +58,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_BINARY_SEARCH_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_clamp.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_clamp.h index 09a97fc..45a8464 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_clamp.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_clamp.h
@@ -22,7 +22,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -60,6 +60,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_CLAMP_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy.h index bb02c84..f5700c3 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy.h
@@ -25,7 +25,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -62,6 +62,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_COPY_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_backward.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_backward.h index f41af66..b7b5b88 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_backward.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_backward.h
@@ -23,7 +23,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -60,6 +60,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_COPY_BACKWARD_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_if.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_if.h index dba41c3..b714e4c 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_if.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_if.h
@@ -24,7 +24,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -76,6 +76,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_COPY_IF_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_n.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_n.h index 04bb80b..30ee019 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_n.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_copy_n.h
@@ -27,7 +27,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { @@ -70,7 +70,7 @@ } // namespace __cpo } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_count.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_count.h index 527dd06..677ee38 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_count.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_count.h
@@ -25,7 +25,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -57,6 +57,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_COUNT_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_count_if.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_count_if.h index 931618b..48c4370 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_count_if.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_count_if.h
@@ -25,7 +25,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -67,6 +67,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_COUNT_IF_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_equal.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_equal.h index 3c417f0..8754453 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_equal.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_equal.h
@@ -9,6 +9,8 @@ #ifndef _LIBCPP___ALGORITHM_RANGES_EQUAL_H #define _LIBCPP___ALGORITHM_RANGES_EQUAL_H +#include <__algorithm/equal.h> +#include <__algorithm/unwrap_range.h> #include <__config> #include <__functional/identity.h> #include <__functional/invoke.h> @@ -24,36 +26,13 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { namespace __equal { struct __fn { -private: - template <class _Iter1, class _Sent1, - class _Iter2, class _Sent2, - class _Pred, - class _Proj1, - class _Proj2> - _LIBCPP_HIDE_FROM_ABI constexpr static - bool __equal_impl(_Iter1 __first1, _Sent1 __last1, - _Iter2 __first2, _Sent2 __last2, - _Pred& __pred, - _Proj1& __proj1, - _Proj2& __proj2) { - while (__first1 != __last1 && __first2 != __last2) { - if (!std::invoke(__pred, std::invoke(__proj1, *__first1), std::invoke(__proj2, *__first2))) - return false; - ++__first1; - ++__first2; - } - return __first1 == __last1 && __first2 == __last2; - } - -public: - template <input_iterator _Iter1, sentinel_for<_Iter1> _Sent1, input_iterator _Iter2, sentinel_for<_Iter2> _Sent2, class _Pred = ranges::equal_to, @@ -70,11 +49,13 @@ if (__last1 - __first1 != __last2 - __first2) return false; } - return __equal_impl(std::move(__first1), std::move(__last1), - std::move(__first2), std::move(__last2), - __pred, - __proj1, - __proj2); + auto __unwrapped1 = std::__unwrap_range(std::move(__first1), std::move(__last1)); + auto __unwrapped2 = std::__unwrap_range(std::move(__first2), std::move(__last2)); + return std::__equal_impl(std::move(__unwrapped1.first), std::move(__unwrapped1.second), + std::move(__unwrapped2.first), std::move(__unwrapped2.second), + __pred, + __proj1, + __proj2); } template <input_range _Range1, @@ -93,11 +74,13 @@ if (ranges::distance(__range1) != ranges::distance(__range2)) return false; } - return __equal_impl(ranges::begin(__range1), ranges::end(__range1), - ranges::begin(__range2), ranges::end(__range2), - __pred, - __proj1, - __proj2); + auto __unwrapped1 = std::__unwrap_range(ranges::begin(__range1), ranges::end(__range1)); + auto __unwrapped2 = std::__unwrap_range(ranges::begin(__range2), ranges::end(__range2)); + return std::__equal_impl(std::move(__unwrapped1.first), std::move(__unwrapped1.second), + std::move(__unwrapped2.first), std::move(__unwrapped2.second), + __pred, + __proj1, + __proj2); return false; } }; @@ -110,6 +93,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_EQUAL_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_equal_range.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_equal_range.h index 94dc058..075634a 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_equal_range.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_equal_range.h
@@ -30,7 +30,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -73,6 +73,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_EQUAL_RANGE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_fill.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_fill.h index 6ebc2bd..4e0594c 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_fill.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_fill.h
@@ -20,7 +20,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -54,6 +54,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_FILL_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_fill_n.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_fill_n.h index a2660e8..c5f7e6e 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_fill_n.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_fill_n.h
@@ -17,7 +17,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -43,6 +43,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_FILL_N_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_find.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_find.h index 580c2a1..87f25d1 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_find.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_find.h
@@ -26,7 +26,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -58,6 +58,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_FIND_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_end.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_end.h index ea36f4d..2d46e8c 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_end.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_end.h
@@ -27,7 +27,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -93,6 +93,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_FIND_END_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_first_of.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_first_of.h index 9d66e75..5699583 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_first_of.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_first_of.h
@@ -24,7 +24,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -96,6 +96,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_FIND_FIRST_OF_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_if.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_if.h index 45ce6e4..6e2bd4c 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_if.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_if.h
@@ -24,14 +24,14 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { template <class _Ip, class _Sp, class _Pred, class _Proj> -_LIBCPP_HIDE_FROM_ABI static constexpr +_LIBCPP_HIDE_FROM_ABI constexpr _Ip __find_if_impl(_Ip __first, _Sp __last, _Pred& __pred, _Proj& __proj) { for (; __first != __last; ++__first) { if (std::invoke(__pred, std::invoke(__proj, *__first))) @@ -66,6 +66,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_FIND_IF_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_if_not.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_if_not.h index 3dd1213..e60ee2b 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_if_not.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_find_if_not.h
@@ -26,7 +26,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -58,6 +58,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_FIND_IF_NOT_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_for_each.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_for_each.h index 0c70c05..a72f779 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_for_each.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_for_each.h
@@ -24,7 +24,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -73,6 +73,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_FOR_EACH_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_for_each_n.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_for_each_n.h index 261816a..daf0a5d 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_for_each_n.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_for_each_n.h
@@ -24,7 +24,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -61,6 +61,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_FOR_EACH_N_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_generate.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_generate.h index ae486ae..de0db16 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_generate.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_generate.h
@@ -24,7 +24,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -68,6 +68,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_GENERATE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_generate_n.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_generate_n.h index e625e3a..122cd8d 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_generate_n.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_generate_n.h
@@ -25,7 +25,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -57,6 +57,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_GENERATE_N_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_includes.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_includes.h index 8438117..314a923 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_includes.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_includes.h
@@ -27,7 +27,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -90,6 +90,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_INCLUDES_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_inplace_merge.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_inplace_merge.h index 88171a6..8f78975 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_inplace_merge.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_inplace_merge.h
@@ -31,7 +31,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -80,6 +80,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_INPLACE_MERGE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_heap.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_heap.h index a16c075..9c77e0c 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_heap.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_heap.h
@@ -26,7 +26,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -69,6 +69,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_IS_HEAP_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_heap_until.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_heap_until.h index 8c8dac5..3b1fec7 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_heap_until.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_heap_until.h
@@ -27,7 +27,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -70,6 +70,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_IS_HEAP_UNTIL_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_partitioned.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_partitioned.h index b903953..6782717 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_partitioned.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_partitioned.h
@@ -23,7 +23,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -76,6 +76,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_IS_PARTITIONED_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_permutation.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_permutation.h index b617500..95a0a82 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_permutation.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_permutation.h
@@ -25,7 +25,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -84,6 +84,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_IS_PERMUTATION_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_sorted.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_sorted.h index ce3032f..50c97ba 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_sorted.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_sorted.h
@@ -23,7 +23,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -56,6 +56,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP__ALGORITHM_RANGES_IS_SORTED_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_sorted_until.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_sorted_until.h index 17fc42e..f139d03 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_sorted_until.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_is_sorted_until.h
@@ -24,7 +24,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -71,6 +71,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP__ALGORITHM_RANGES_IS_SORTED_UNTIL_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_iterator_concept.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_iterator_concept.h index 3ac6b31..9a92030 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_iterator_concept.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_iterator_concept.h
@@ -18,7 +18,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -46,6 +46,6 @@ } // namespace ranges _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_ITERATOR_CONCEPT_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_lexicographical_compare.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_lexicographical_compare.h index 2972e32..c51f4d7 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_lexicographical_compare.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_lexicographical_compare.h
@@ -23,7 +23,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -93,6 +93,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_LEXICOGRAPHICAL_COMPARE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_lower_bound.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_lower_bound.h index 78cbb6d..7435639 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_lower_bound.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_lower_bound.h
@@ -27,7 +27,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -61,6 +61,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_LOWER_BOUND_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_make_heap.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_make_heap.h index f25c7ab..7f92fa3 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_make_heap.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_make_heap.h
@@ -32,7 +32,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -75,6 +75,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_MAKE_HEAP_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_max.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_max.h index 55aef99..2fd2970 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_max.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_max.h
@@ -20,6 +20,7 @@ #include <__iterator/projected.h> #include <__ranges/access.h> #include <__ranges/concepts.h> +#include <__type_traits/is_trivially_copyable.h> #include <__utility/move.h> #include <initializer_list> @@ -27,7 +28,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_PUSH_MACROS #include <__undef_macros> @@ -40,7 +41,10 @@ template <class _Tp, class _Proj = identity, indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less> _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr - const _Tp& operator()(const _Tp& __a, const _Tp& __b, _Comp __comp = {}, _Proj __proj = {}) const { + const _Tp& operator()(_LIBCPP_LIFETIMEBOUND const _Tp& __a, + _LIBCPP_LIFETIMEBOUND const _Tp& __b, + _Comp __comp = {}, + _Proj __proj = {}) const { return std::invoke(__comp, std::invoke(__proj, __a), std::invoke(__proj, __b)) ? __b : __a; } @@ -64,7 +68,7 @@ _LIBCPP_ASSERT(__first != __last, "range must contain at least one element"); - if constexpr (forward_range<_Rp>) { + if constexpr (forward_range<_Rp> && !__is_cheap_to_copy<range_value_t<_Rp>>) { auto __comp_lhs_rhs_swapped = [&](auto&& __lhs, auto&& __rhs) { return std::invoke(__comp, __rhs, __lhs); }; return *ranges::__min_element_impl(std::move(__first), std::move(__last), __comp_lhs_rhs_swapped, __proj); } else { @@ -88,6 +92,6 @@ _LIBCPP_POP_MACROS -#endif // _LIBCPP_STD_VER > 17 && +#endif // _LIBCPP_STD_VER >= 20 && #endif // _LIBCPP___ALGORITHM_RANGES_MAX_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_max_element.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_max_element.h index 490f320..39e86d3 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_max_element.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_max_element.h
@@ -24,7 +24,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -56,6 +56,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_MAX_ELEMENT_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_merge.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_merge.h index b36a05a..c5797b0 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_merge.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_merge.h
@@ -20,14 +20,14 @@ #include <__ranges/access.h> #include <__ranges/concepts.h> #include <__ranges/dangling.h> +#include <__type_traits/remove_cvref.h> #include <__utility/move.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -137,6 +137,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_MERGE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_min.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_min.h index 0e31f57..5e941a1 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_min.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_min.h
@@ -20,13 +20,14 @@ #include <__iterator/projected.h> #include <__ranges/access.h> #include <__ranges/concepts.h> +#include <__type_traits/is_trivially_copyable.h> #include <initializer_list> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_PUSH_MACROS #include <__undef_macros> @@ -39,7 +40,10 @@ template <class _Tp, class _Proj = identity, indirect_strict_weak_order<projected<const _Tp*, _Proj>> _Comp = ranges::less> _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr - const _Tp& operator()(const _Tp& __a, const _Tp& __b, _Comp __comp = {}, _Proj __proj = {}) const { + const _Tp& operator()(_LIBCPP_LIFETIMEBOUND const _Tp& __a, + _LIBCPP_LIFETIMEBOUND const _Tp& __b, + _Comp __comp = {}, + _Proj __proj = {}) const { return std::invoke(__comp, std::invoke(__proj, __b), std::invoke(__proj, __a)) ? __b : __a; } @@ -58,10 +62,8 @@ range_value_t<_Rp> operator()(_Rp&& __r, _Comp __comp = {}, _Proj __proj = {}) const { auto __first = ranges::begin(__r); auto __last = ranges::end(__r); - _LIBCPP_ASSERT(__first != __last, "range must contain at least one element"); - - if constexpr (forward_range<_Rp>) { + if constexpr (forward_range<_Rp> && !__is_cheap_to_copy<range_value_t<_Rp>>) { return *ranges::__min_element_impl(__first, __last, __comp, __proj); } else { range_value_t<_Rp> __result = *__first; @@ -84,6 +86,6 @@ _LIBCPP_POP_MACROS -#endif // _LIBCPP_STD_VER > 17 && +#endif // _LIBCPP_STD_VER >= 20 && #endif // _LIBCPP___ALGORITHM_RANGES_MIN_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_min_element.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_min_element.h index 1751874..4c58adb 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_min_element.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_min_element.h
@@ -24,7 +24,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -32,7 +32,7 @@ // TODO(ranges): `ranges::min_element` can now simply delegate to `std::__min_element`. template <class _Ip, class _Sp, class _Proj, class _Comp> -_LIBCPP_HIDE_FROM_ABI static constexpr +_LIBCPP_HIDE_FROM_ABI constexpr _Ip __min_element_impl(_Ip __first, _Sp __last, _Comp& __comp, _Proj& __proj) { if (__first == __last) return __first; @@ -69,6 +69,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_MIN_ELEMENT_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_minmax.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_minmax.h index f82e005..86540cc 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_minmax.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_minmax.h
@@ -13,11 +13,13 @@ #include <__algorithm/minmax_element.h> #include <__assert> #include <__concepts/copyable.h> +#include <__concepts/same_as.h> #include <__config> #include <__functional/identity.h> #include <__functional/invoke.h> #include <__functional/ranges_operations.h> #include <__iterator/concepts.h> +#include <__iterator/next.h> #include <__iterator/projected.h> #include <__ranges/access.h> #include <__ranges/concepts.h> @@ -30,7 +32,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_PUSH_MACROS #include <__undef_macros> @@ -46,7 +48,10 @@ template <class _Type, class _Proj = identity, indirect_strict_weak_order<projected<const _Type*, _Proj>> _Comp = ranges::less> _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr ranges::minmax_result<const _Type&> - operator()(const _Type& __a, const _Type& __b, _Comp __comp = {}, _Proj __proj = {}) const { + operator()(_LIBCPP_LIFETIMEBOUND const _Type& __a, + _LIBCPP_LIFETIMEBOUND const _Type& __b, + _Comp __comp = {}, + _Proj __proj = {}) const { if (std::invoke(__comp, std::invoke(__proj, __b), std::invoke(__proj, __a))) return {__b, __a}; return {__a, __b}; @@ -73,6 +78,18 @@ _LIBCPP_ASSERT(__first != __last, "range has to contain at least one element"); if constexpr (forward_range<_Range>) { + // Special-case the one element case. Avoid repeatedly initializing objects from the result of an iterator + // dereference when doing so might not be idempotent. The `if constexpr` avoids the extra branch in cases where + // it's not needed. + if constexpr (!same_as<remove_cvref_t<range_reference_t<_Range>>, _ValueT> || + is_rvalue_reference_v<range_reference_t<_Range>>) { + if (ranges::next(__first) == __last) { + // During initialization, members are allowed to refer to already initialized members + // (see http://eel.is/c++draft/dcl.init.aggr#6) + minmax_result<_ValueT> __result = {*__first, __result.min}; + return __result; + } + } auto __result = std::__minmax_element_impl(__first, __last, __comp, __proj); return {*__result.first, *__result.second}; } else { @@ -83,6 +100,8 @@ std::invoke(__proj, std::forward<decltype(__b)>(__b))); }; + // During initialization, members are allowed to refer to already initialized members + // (see http://eel.is/c++draft/dcl.init.aggr#6) ranges::minmax_result<_ValueT> __result = {*__first, __result.min}; if (__first == __last || ++__first == __last) return __result; @@ -129,6 +148,6 @@ _LIBCPP_POP_MACROS -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_MINMAX_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_minmax_element.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_minmax_element.h index 6699f96..cbf3505 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_minmax_element.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_minmax_element.h
@@ -23,13 +23,12 @@ #include <__utility/forward.h> #include <__utility/move.h> #include <__utility/pair.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -67,6 +66,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_MINMAX_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_mismatch.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_mismatch.h index 4fd0517..098c415 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_mismatch.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_mismatch.h
@@ -27,7 +27,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { @@ -78,7 +78,7 @@ } // namespace __cpo } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_move.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_move.h index 46a0970..5e06e90 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_move.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_move.h
@@ -23,7 +23,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -66,6 +66,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_MOVE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_move_backward.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_move_backward.h index d4e8eb1..95c2c66 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_move_backward.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_move_backward.h
@@ -25,7 +25,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -68,6 +68,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_MOVE_BACKWARD_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_next_permutation.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_next_permutation.h index 6c8e8e1..9ebab3e 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_next_permutation.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_next_permutation.h
@@ -28,7 +28,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -68,6 +68,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_NEXT_PERMUTATION_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_none_of.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_none_of.h index b39e570..39940ad 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_none_of.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_none_of.h
@@ -22,7 +22,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -63,6 +63,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_NONE_OF_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_nth_element.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_nth_element.h index d9ec4f1..96bf33b 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_nth_element.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_nth_element.h
@@ -31,7 +31,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -75,6 +75,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_NTH_ELEMENT_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_partial_sort.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_partial_sort.h index 3ea0a7f..4562c35 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_partial_sort.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_partial_sort.h
@@ -33,7 +33,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -73,6 +73,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_PARTIAL_SORT_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_partial_sort_copy.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_partial_sort_copy.h index 212db55..5401a37 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_partial_sort_copy.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_partial_sort_copy.h
@@ -30,7 +30,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -87,6 +87,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_PARTIAL_SORT_COPY_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition.h index 8b3aae5..de839de 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition.h
@@ -27,13 +27,12 @@ #include <__utility/forward.h> #include <__utility/move.h> #include <__utility/pair.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -78,6 +77,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_PARTITION_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition_copy.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition_copy.h index e7a9a34..a271428 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition_copy.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition_copy.h
@@ -20,13 +20,12 @@ #include <__ranges/concepts.h> #include <__ranges/dangling.h> #include <__utility/move.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -93,6 +92,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_PARTITION_COPY_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition_point.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition_point.h index 2bd118d..129ebb6 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition_point.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_partition_point.h
@@ -27,7 +27,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -83,6 +83,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_PARTITION_POINT_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_pop_heap.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_pop_heap.h index 65beec8..54ea97d 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_pop_heap.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_pop_heap.h
@@ -32,7 +32,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -76,6 +76,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_POP_HEAP_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_prev_permutation.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_prev_permutation.h index 6866d90..bf06287 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_prev_permutation.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_prev_permutation.h
@@ -28,7 +28,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -72,6 +72,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_PREV_PERMUTATION_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_push_heap.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_push_heap.h index a1f4347..6e65d11 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_push_heap.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_push_heap.h
@@ -32,7 +32,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -75,6 +75,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_PUSH_HEAP_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove.h index dd5c5fb..6dd48e0 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove.h
@@ -25,7 +25,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -59,6 +59,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_REMOVE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_copy.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_copy.h index 2102228..a9a19c1 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_copy.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_copy.h
@@ -26,7 +26,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -71,6 +71,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_REMOVE_COPY_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_copy_if.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_copy_if.h index 4fc6745..e6d043e 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_copy_if.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_copy_if.h
@@ -29,7 +29,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -85,6 +85,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_REMOVE_COPY_IF_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_if.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_if.h index 1f17467..7507c21 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_if.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_remove_if.h
@@ -27,7 +27,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -80,6 +80,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_REMOVE_IF_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace.h index 8b12bea..258e25d 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace.h
@@ -24,7 +24,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -69,6 +69,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_REPLACE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_copy.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_copy.h index f87a236..79eaebb 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_copy.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_copy.h
@@ -26,7 +26,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -86,6 +86,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_REPLACE_COPY_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_copy_if.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_copy_if.h index b8741ec..8ff2eba 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_copy_if.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_copy_if.h
@@ -24,7 +24,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -88,6 +88,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_REPLACE_COPY_IF_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_if.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_if.h index 65be3c7..2b7dda9 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_if.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_replace_if.h
@@ -23,7 +23,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -72,6 +72,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_REPLACE_IF_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_reverse.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_reverse.h index e2a5d9a..801fccb 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_reverse.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_reverse.h
@@ -22,7 +22,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -78,6 +78,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_REVERSE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_reverse_copy.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_reverse_copy.h index a84b1ad..c230399 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_reverse_copy.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_reverse_copy.h
@@ -25,7 +25,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -62,6 +62,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_REVERSE_COPY_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_rotate.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_rotate.h index 91ed402..99e6ca6 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_rotate.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_rotate.h
@@ -25,7 +25,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -66,6 +66,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_ROTATE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_rotate_copy.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_rotate_copy.h index 52f403c..5b9321f 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_rotate_copy.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_rotate_copy.h
@@ -23,7 +23,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -63,6 +63,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_ROTATE_COPY_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_sample.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_sample.h index a37cb64..a5ff2d0 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_sample.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_sample.h
@@ -19,15 +19,15 @@ #include <__random/uniform_random_bit_generator.h> #include <__ranges/access.h> #include <__ranges/concepts.h> +#include <__type_traits/remove_reference.h> #include <__utility/forward.h> #include <__utility/move.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -69,6 +69,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_SAMPLE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_search.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_search.h index 388d5af..6d3e318 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_search.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_search.h
@@ -28,7 +28,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -130,6 +130,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_SEARCH_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_search_n.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_search_n.h index 56ec8f3..ed5ec34 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_search_n.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_search_n.h
@@ -31,7 +31,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -112,6 +112,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_SEARCH_N_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_difference.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_difference.h index 607dd68..6b9af87 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_difference.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_difference.h
@@ -30,7 +30,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -102,5 +102,5 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_SET_DIFFERENCE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_intersection.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_intersection.h index aa9fd24..5848656 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_intersection.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_intersection.h
@@ -28,7 +28,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -113,5 +113,5 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_SET_INTERSECTION_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_symmetric_difference.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_symmetric_difference.h index bc4a906..f8bcf37 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_symmetric_difference.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_symmetric_difference.h
@@ -28,7 +28,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -113,5 +113,5 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_SET_SYMMETRIC_DIFFERENCE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_union.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_union.h index f8cd45c..bc669cc 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_union.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_set_union.h
@@ -31,7 +31,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -116,6 +116,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_SET_UNION_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_shuffle.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_shuffle.h index a2f2c0e..2f45fb0 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_shuffle.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_shuffle.h
@@ -23,15 +23,15 @@ #include <__ranges/access.h> #include <__ranges/concepts.h> #include <__ranges/dangling.h> +#include <__type_traits/remove_reference.h> #include <__utility/forward.h> #include <__utility/move.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -66,6 +66,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_SHUFFLE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_sort.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_sort.h index 32391df..60305b1 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_sort.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_sort.h
@@ -31,7 +31,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -74,6 +74,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_SORT_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_sort_heap.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_sort_heap.h index 9feb0f6..b40eef9 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_sort_heap.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_sort_heap.h
@@ -32,7 +32,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -75,6 +75,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_SORT_HEAP_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_stable_partition.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_stable_partition.h index c3469f1..77bef85 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_stable_partition.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_stable_partition.h
@@ -26,15 +26,15 @@ #include <__ranges/concepts.h> #include <__ranges/dangling.h> #include <__ranges/subrange.h> +#include <__type_traits/remove_cvref.h> #include <__utility/forward.h> #include <__utility/move.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -83,6 +83,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_STABLE_PARTITION_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_stable_sort.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_stable_sort.h index d3c48dd..b823e3b 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_stable_sort.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_stable_sort.h
@@ -31,7 +31,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -74,6 +74,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_STABLE_SORT_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_swap_ranges.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_swap_ranges.h index 552fd55..34124db 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_swap_ranges.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_swap_ranges.h
@@ -24,7 +24,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -63,6 +63,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_SWAP_RANGES_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_transform.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_transform.h index c0981a0..1bba756 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_transform.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_transform.h
@@ -26,7 +26,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -165,6 +165,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_TRANSFORM_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_unique.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_unique.h index be427cc..9e05c09 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_unique.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_unique.h
@@ -32,7 +32,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -74,6 +74,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_UNIQUE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_unique_copy.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_unique_copy.h index 3ad47b0..2aaa879 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_unique_copy.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_unique_copy.h
@@ -33,7 +33,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -111,6 +111,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_UNIQUE_COPY_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/ranges_upper_bound.h b/third_party/llvm-project/libcxx/include/__algorithm/ranges_upper_bound.h index a134080..43ce89b 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/ranges_upper_bound.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/ranges_upper_bound.h
@@ -25,7 +25,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -70,6 +70,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_UPPER_BOUND_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/rotate.h b/third_party/llvm-project/libcxx/include/__algorithm/rotate.h index 8934ce0..7ed6f18 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/rotate.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/rotate.h
@@ -15,9 +15,9 @@ #include <__algorithm/swap_ranges.h> #include <__config> #include <__iterator/iterator_traits.h> +#include <__type_traits/is_trivially_move_assignable.h> #include <__utility/move.h> #include <__utility/pair.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/sample.h b/third_party/llvm-project/libcxx/include/__algorithm/sample.h index f403ba6..7a05e45 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/sample.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/sample.h
@@ -16,8 +16,8 @@ #include <__iterator/distance.h> #include <__iterator/iterator_traits.h> #include <__random/uniform_int_distribution.h> +#include <__type_traits/common_type.h> #include <__utility/move.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -88,7 +88,7 @@ __g, _PopIterCategory()); } -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _PopulationIterator, class _SampleIterator, class _Distance, class _UniformRandomNumberGenerator> inline _LIBCPP_INLINE_VISIBILITY @@ -103,7 +103,7 @@ std::move(__first), std::move(__last), std::move(__output_iter), __n, __g); } -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/search.h b/third_party/llvm-project/libcxx/include/__algorithm/search.h index 93771be..c9012d7 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/search.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/search.h
@@ -14,12 +14,13 @@ #include <__algorithm/iterator_operations.h> #include <__config> #include <__functional/identity.h> +#include <__functional/invoke.h> #include <__iterator/advance.h> #include <__iterator/concepts.h> #include <__iterator/iterator_traits.h> +#include <__type_traits/enable_if.h> #include <__type_traits/is_callable.h> #include <__utility/pair.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -187,7 +188,7 @@ return std::search(__first1, __last1, __first2, __last2, __equal_to()); } -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _ForwardIterator, class _Searcher> _LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher& __s) {
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/search_n.h b/third_party/llvm-project/libcxx/include/__algorithm/search_n.h index 60a0735..06962be 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/search_n.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/search_n.h
@@ -14,14 +14,15 @@ #include <__algorithm/iterator_operations.h> #include <__config> #include <__functional/identity.h> +#include <__functional/invoke.h> #include <__iterator/advance.h> #include <__iterator/concepts.h> #include <__iterator/distance.h> #include <__iterator/iterator_traits.h> #include <__ranges/concepts.h> +#include <__type_traits/is_callable.h> #include <__utility/convert_to_integral.h> #include <__utility/pair.h> -#include <type_traits> // __convert_to_integral #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/set_difference.h b/third_party/llvm-project/libcxx/include/__algorithm/set_difference.h index cffdc8f..5a7d3bc 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/set_difference.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/set_difference.h
@@ -17,9 +17,9 @@ #include <__functional/identity.h> #include <__functional/invoke.h> #include <__iterator/iterator_traits.h> +#include <__type_traits/remove_cvref.h> #include <__utility/move.h> #include <__utility/pair.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/shift_left.h b/third_party/llvm-project/libcxx/include/__algorithm/shift_left.h index 33f06d5..403317e 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/shift_left.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/shift_left.h
@@ -12,7 +12,6 @@ #include <__algorithm/move.h> #include <__config> #include <__iterator/iterator_traits.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -20,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _ForwardIterator> inline _LIBCPP_INLINE_VISIBILITY constexpr @@ -49,7 +48,7 @@ return _VSTD::move(__m, __last, __first); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/shift_right.h b/third_party/llvm-project/libcxx/include/__algorithm/shift_right.h index 14bc761..751e690 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/shift_right.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/shift_right.h
@@ -15,7 +15,6 @@ #include <__config> #include <__iterator/iterator_traits.h> #include <__utility/swap.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -23,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _ForwardIterator> inline _LIBCPP_INLINE_VISIBILITY constexpr @@ -95,7 +94,7 @@ } } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/sort.h b/third_party/llvm-project/libcxx/include/__algorithm/sort.h index a7d2d55..f870612 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/sort.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/sort.h
@@ -26,9 +26,8 @@ #include <__functional/operations.h> #include <__functional/ranges_operations.h> #include <__iterator/iterator_traits.h> -#include <__memory/destruct_n.h> -#include <__memory/unique_ptr.h> #include <__type_traits/conditional.h> +#include <__type_traits/disjunction.h> #include <__type_traits/is_arithmetic.h> #include <__utility/move.h> #include <__utility/pair.h> @@ -41,52 +40,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD -// Wraps an algorithm policy tag and a comparator in a single struct, used to pass the policy tag around without -// changing the number of template arguments (to keep the ABI stable). This is only used for the "range" policy tag. -// -// To create an object of this type, use `_WrapAlgPolicy<T, C>::type` -- see the specialization below for the rationale. -template <class _PolicyT, class _CompT, class = void> -struct _WrapAlgPolicy { - using type = _WrapAlgPolicy; - - using _AlgPolicy = _PolicyT; - using _Comp = _CompT; - _Comp& __comp; - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 - _WrapAlgPolicy(_Comp& __c) : __comp(__c) {} -}; - -// Specialization for the "classic" policy tag that avoids creating a struct and simply defines an alias for the -// comparator. When unwrapping, a pristine comparator is always considered to have the "classic" tag attached. Passing -// the pristine comparator where possible allows using template instantiations from the dylib. -template <class _PolicyT, class _CompT> -struct _WrapAlgPolicy<_PolicyT, _CompT, __enable_if_t<std::is_same<_PolicyT, _ClassicAlgPolicy>::value> > { - using type = _CompT; -}; - -// Unwraps a pristine functor (e.g. `std::less`) as if it were wrapped using `_WrapAlgPolicy`. The policy tag is always -// set to "classic". -template <class _CompT> -struct _UnwrapAlgPolicy { - using _AlgPolicy = _ClassicAlgPolicy; - using _Comp = _CompT; - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static - _Comp __get_comp(_Comp __comp) { return __comp; } -}; - -// Unwraps a `_WrapAlgPolicy` struct. -template <class... _Ts> -struct _UnwrapAlgPolicy<_WrapAlgPolicy<_Ts...> > { - using _Wrapped = _WrapAlgPolicy<_Ts...>; - using _AlgPolicy = typename _Wrapped::_AlgPolicy; - using _Comp = typename _Wrapped::_Comp; - - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 static - _Comp __get_comp(_Wrapped& __w) { return __w.__comp; } -}; - // stable, 2-3 compares, 0-2 swaps template <class _AlgPolicy, class _Compare, class _ForwardIterator> @@ -130,65 +83,41 @@ template <class _AlgPolicy, class _Compare, class _ForwardIterator> _LIBCPP_HIDE_FROM_ABI -unsigned __sort4(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, _ForwardIterator __x4, +void __sort4(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, _ForwardIterator __x4, _Compare __c) { using _Ops = _IterOps<_AlgPolicy>; - unsigned __r = std::__sort3<_AlgPolicy, _Compare>(__x1, __x2, __x3, __c); + std::__sort3<_AlgPolicy, _Compare>(__x1, __x2, __x3, __c); if (__c(*__x4, *__x3)) { _Ops::iter_swap(__x3, __x4); - ++__r; if (__c(*__x3, *__x2)) { _Ops::iter_swap(__x2, __x3); - ++__r; if (__c(*__x2, *__x1)) { _Ops::iter_swap(__x1, __x2); - ++__r; } } } - return __r; } // stable, 4-10 compares, 0-9 swaps -template <class _WrappedComp, class _ForwardIterator> -_LIBCPP_HIDDEN unsigned __sort5(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, - _ForwardIterator __x4, _ForwardIterator __x5, _WrappedComp __wrapped_comp) { - using _Unwrap = _UnwrapAlgPolicy<_WrappedComp>; - using _AlgPolicy = typename _Unwrap::_AlgPolicy; +template <class _AlgPolicy, class _Comp, class _ForwardIterator> +_LIBCPP_HIDE_FROM_ABI void __sort5(_ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, + _ForwardIterator __x4, _ForwardIterator __x5, _Comp __comp) { using _Ops = _IterOps<_AlgPolicy>; - using _Compare = typename _Unwrap::_Comp; - _Compare __c = _Unwrap::__get_comp(__wrapped_comp); - - unsigned __r = std::__sort4<_AlgPolicy, _Compare>(__x1, __x2, __x3, __x4, __c); - if (__c(*__x5, *__x4)) { + std::__sort4<_AlgPolicy, _Comp>(__x1, __x2, __x3, __x4, __comp); + if (__comp(*__x5, *__x4)) { _Ops::iter_swap(__x4, __x5); - ++__r; - if (__c(*__x4, *__x3)) { + if (__comp(*__x4, *__x3)) { _Ops::iter_swap(__x3, __x4); - ++__r; - if (__c(*__x3, *__x2)) { + if (__comp(*__x3, *__x2)) { _Ops::iter_swap(__x2, __x3); - ++__r; - if (__c(*__x2, *__x1)) { + if (__comp(*__x2, *__x1)) { _Ops::iter_swap(__x1, __x2); - ++__r; } } } } - return __r; -} - -template <class _AlgPolicy, class _Compare, class _ForwardIterator> -_LIBCPP_HIDE_FROM_ABI unsigned __sort5_wrap_policy( - _ForwardIterator __x1, _ForwardIterator __x2, _ForwardIterator __x3, _ForwardIterator __x4, _ForwardIterator __x5, - _Compare __c) { - using _WrappedComp = typename _WrapAlgPolicy<_AlgPolicy, _Compare>::type; - _WrappedComp __wrapped_comp(__c); - return std::__sort5<_WrappedComp, _ForwardIterator>( - std::move(__x1), std::move(__x2), std::move(__x3), std::move(__x4), std::move(__x5), __wrapped_comp); } // The comparator being simple is a prerequisite for using the branchless optimization. @@ -200,7 +129,7 @@ struct __is_simple_comparator<less<_Tp>&> : true_type {}; template <class _Tp> struct __is_simple_comparator<greater<_Tp>&> : true_type {}; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <> struct __is_simple_comparator<ranges::less&> : true_type {}; template <> @@ -299,7 +228,8 @@ inline _LIBCPP_HIDE_FROM_ABI __enable_if_t<!__use_branchless_sort<_Compare, _RandomAccessIterator>::value, void> __sort5_maybe_branchless(_RandomAccessIterator __x1, _RandomAccessIterator __x2, _RandomAccessIterator __x3, _RandomAccessIterator __x4, _RandomAccessIterator __x5, _Compare __c) { - std::__sort5_wrap_policy<_AlgPolicy, _Compare>(__x1, __x2, __x3, __x4, __x5, __c); + std::__sort5<_AlgPolicy, _Compare, _RandomAccessIterator>( + std::move(__x1), std::move(__x2), std::move(__x3), std::move(__x4), std::move(__x5), __c); } // Assumes size > 0 @@ -344,7 +274,7 @@ // Sort the iterator range [__first, __last) using the comparator __comp using // the insertion sort algorithm. Insertion sort has two loops, outer and inner. -// The implementation below has not bounds check (unguarded) for the inner loop. +// The implementation below has no bounds check (unguarded) for the inner loop. // Assumes that there is an element in the position (__first - 1) and that each // element in the input range is greater or equal to the element at __first - 1. template <class _AlgPolicy, class _Compare, class _RandomAccessIterator> @@ -370,16 +300,11 @@ } } -template <class _WrappedComp, class _RandomAccessIterator> -_LIBCPP_HIDDEN bool __insertion_sort_incomplete( - _RandomAccessIterator __first, _RandomAccessIterator __last, _WrappedComp __wrapped_comp) { - using _Unwrap = _UnwrapAlgPolicy<_WrappedComp>; - using _AlgPolicy = typename _Unwrap::_AlgPolicy; +template <class _AlgPolicy, class _Comp, class _RandomAccessIterator> +_LIBCPP_HIDE_FROM_ABI bool __insertion_sort_incomplete( + _RandomAccessIterator __first, _RandomAccessIterator __last, _Comp __comp) { using _Ops = _IterOps<_AlgPolicy>; - using _Compare = typename _Unwrap::_Comp; - _Compare __comp = _Unwrap::__get_comp(__wrapped_comp); - typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; switch (__last - __first) { case 0: @@ -390,21 +315,21 @@ _Ops::iter_swap(__first, __last); return true; case 3: - std::__sort3_maybe_branchless<_AlgPolicy, _Compare>(__first, __first + difference_type(1), --__last, __comp); + std::__sort3_maybe_branchless<_AlgPolicy, _Comp>(__first, __first + difference_type(1), --__last, __comp); return true; case 4: - std::__sort4_maybe_branchless<_AlgPolicy, _Compare>( + std::__sort4_maybe_branchless<_AlgPolicy, _Comp>( __first, __first + difference_type(1), __first + difference_type(2), --__last, __comp); return true; case 5: - std::__sort5_maybe_branchless<_AlgPolicy, _Compare>( + std::__sort5_maybe_branchless<_AlgPolicy, _Comp>( __first, __first + difference_type(1), __first + difference_type(2), __first + difference_type(3), --__last, __comp); return true; } typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; _RandomAccessIterator __j = __first + difference_type(2); - std::__sort3_maybe_branchless<_AlgPolicy, _Compare>(__first, __first + difference_type(1), __j, __comp); + std::__sort3_maybe_branchless<_AlgPolicy, _Comp>(__first, __first + difference_type(1), __j, __comp); const unsigned __limit = 8; unsigned __count = 0; for (_RandomAccessIterator __i = __j + difference_type(1); __i != __last; ++__i) { @@ -425,37 +350,6 @@ return true; } -template <class _AlgPolicy, class _Compare, class _BidirectionalIterator> -_LIBCPP_HIDE_FROM_ABI -void __insertion_sort_move(_BidirectionalIterator __first1, _BidirectionalIterator __last1, - typename iterator_traits<_BidirectionalIterator>::value_type* __first2, _Compare __comp) { - using _Ops = _IterOps<_AlgPolicy>; - - typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type; - if (__first1 != __last1) { - __destruct_n __d(0); - unique_ptr<value_type, __destruct_n&> __h(__first2, __d); - value_type* __last2 = __first2; - ::new ((void*)__last2) value_type(_Ops::__iter_move(__first1)); - __d.template __incr<value_type>(); - for (++__last2; ++__first1 != __last1; ++__last2) { - value_type* __j2 = __last2; - value_type* __i2 = __j2; - if (__comp(*__first1, *--__i2)) { - ::new ((void*)__j2) value_type(std::move(*__i2)); - __d.template __incr<value_type>(); - for (--__j2; __i2 != __first2 && __comp(*__first1, *--__i2); --__j2) - *__j2 = std::move(*__i2); - *__j2 = _Ops::__iter_move(__first1); - } else { - ::new ((void*)__j2) value_type(_Ops::__iter_move(__first1)); - __d.template __incr<value_type>(); - } - } - __h.release(); - } -} - template <class _AlgPolicy, class _RandomAccessIterator> inline _LIBCPP_HIDE_FROM_ABI void __swap_bitmap_pos( _RandomAccessIterator __first, _RandomAccessIterator __last, uint64_t& __left_bitset, uint64_t& __right_bitset) { @@ -464,11 +358,11 @@ // Swap one pair on each iteration as long as both bitsets have at least one // element for swapping. while (__left_bitset != 0 && __right_bitset != 0) { - difference_type tz_left = __libcpp_ctz(__left_bitset); - __left_bitset = __libcpp_blsr(__left_bitset); - difference_type tz_right = __libcpp_ctz(__right_bitset); - __right_bitset = __libcpp_blsr(__right_bitset); - _Ops::iter_swap(__first + tz_left, __last - tz_right); + difference_type __tz_left = __libcpp_ctz(__left_bitset); + __left_bitset = __libcpp_blsr(__left_bitset); + difference_type __tz_right = __libcpp_ctz(__right_bitset); + __right_bitset = __libcpp_blsr(__right_bitset); + _Ops::iter_swap(__first + __tz_left, __last - __tz_right); } } @@ -533,9 +427,9 @@ // Record the comparison outcomes for the elements currently on the left side. if (__left_bitset == 0) { _RandomAccessIterator __iter = __first; - for (int j = 0; j < __l_size; j++) { + for (int __j = 0; __j < __l_size; __j++) { bool __comp_result = !__comp(*__iter, __pivot); - __left_bitset |= (static_cast<uint64_t>(__comp_result) << j); + __left_bitset |= (static_cast<uint64_t>(__comp_result) << __j); ++__iter; } } @@ -543,9 +437,9 @@ // side. if (__right_bitset == 0) { _RandomAccessIterator __iter = __lm1; - for (int j = 0; j < __r_size; j++) { + for (int __j = 0; __j < __r_size; __j++) { bool __comp_result = __comp(*__iter, __pivot); - __right_bitset |= (static_cast<uint64_t>(__comp_result) << j); + __right_bitset |= (static_cast<uint64_t>(__comp_result) << __j); --__iter; } } @@ -565,9 +459,9 @@ while (__left_bitset != 0) { difference_type __tz_left = __detail::__block_size - 1 - __libcpp_clz(__left_bitset); __left_bitset &= (static_cast<uint64_t>(1) << __tz_left) - 1; - _RandomAccessIterator it = __first + __tz_left; - if (it != __lm1) { - _Ops::iter_swap(it, __lm1); + _RandomAccessIterator __it = __first + __tz_left; + if (__it != __lm1) { + _Ops::iter_swap(__it, __lm1); } --__lm1; } @@ -578,9 +472,9 @@ while (__right_bitset != 0) { difference_type __tz_right = __detail::__block_size - 1 - __libcpp_clz(__right_bitset); __right_bitset &= (static_cast<uint64_t>(1) << __tz_right) - 1; - _RandomAccessIterator it = __lm1 - __tz_right; - if (it != __first) { - _Ops::iter_swap(it, __first); + _RandomAccessIterator __it = __lm1 - __tz_right; + if (__it != __first) { + _Ops::iter_swap(__it, __first); } ++__first; } @@ -862,10 +756,8 @@ // [__first, __i) < *__i and *__i <= [__i+1, __last) // If we were given a perfect partition, see if insertion sort is quick... if (__ret.second) { - using _WrappedComp = typename _WrapAlgPolicy<_AlgPolicy, _Compare>::type; - _WrappedComp __wrapped_comp(__comp); - bool __fs = std::__insertion_sort_incomplete<_WrappedComp>(__first, __i, __wrapped_comp); - if (std::__insertion_sort_incomplete<_WrappedComp>(__i + difference_type(1), __last, __wrapped_comp)) { + bool __fs = std::__insertion_sort_incomplete<_AlgPolicy, _Compare>(__first, __i, __comp); + if (std::__insertion_sort_incomplete<_AlgPolicy, _Compare>(__i + difference_type(1), __last, __comp)) { if (__fs) return; __last = __i; @@ -904,30 +796,8 @@ return __log2; } -template <class _WrappedComp, class _RandomAccessIterator> -_LIBCPP_HIDDEN void __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _WrappedComp __wrapped_comp) { - typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; - difference_type __depth_limit = 2 * std::__log2i(__last - __first); - - using _Unwrap = _UnwrapAlgPolicy<_WrappedComp>; - using _AlgPolicy = typename _Unwrap::_AlgPolicy; - using _Compare = typename _Unwrap::_Comp; - _Compare __comp = _Unwrap::__get_comp(__wrapped_comp); - // Only use bitset partitioning for arithmetic types. We should also check - // that the default comparator is in use so that we are sure that there are no - // branches in the comparator. - std::__introsort<_AlgPolicy, - _Compare, - _RandomAccessIterator, - __use_branchless_sort<_Compare, _RandomAccessIterator>::value>( - __first, __last, __comp, __depth_limit); -} - -template <class _Compare, class _Tp> -inline _LIBCPP_INLINE_VISIBILITY void __sort(_Tp** __first, _Tp** __last, __less<_Tp*>&) { - __less<uintptr_t> __comp; - std::__sort<__less<uintptr_t>&, uintptr_t*>((uintptr_t*)__first, (uintptr_t*)__last, __comp); -} +template <class _Comp, class _RandomAccessIterator> +void __sort(_RandomAccessIterator, _RandomAccessIterator, _Comp); extern template _LIBCPP_FUNC_VIS void __sort<__less<char>&, char*>(char*, char*, __less<char>&); #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS @@ -947,40 +817,83 @@ extern template _LIBCPP_FUNC_VIS void __sort<__less<double>&, double*>(double*, double*, __less<double>&); extern template _LIBCPP_FUNC_VIS void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&); -extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<char>&, char*>(char*, char*, __less<char>&); -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&); -#endif -extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&); -extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&); -extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<short>&, short*>(short*, short*, __less<short>&); -extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&); -extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<int>&, int*>(int*, int*, __less<int>&); -extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&); -extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long>&, long*>(long*, long*, __less<long>&); -extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&); -extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long long>&, long long*>(long long*, long long*, __less<long long>&); -extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&); -extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<float>&, float*>(float*, float*, __less<float>&); -extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<double>&, double*>(double*, double*, __less<double>&); -extern template _LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long double>&, long double*>(long double*, long double*, __less<long double>&); +template <class _AlgPolicy, class _RandomAccessIterator, class _Comp> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void +__sort_dispatch(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp& __comp) { + typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; + difference_type __depth_limit = 2 * std::__log2i(__last - __first); -extern template _LIBCPP_FUNC_VIS unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&); + // Only use bitset partitioning for arithmetic types. We should also check + // that the default comparator is in use so that we are sure that there are no + // branches in the comparator. + std::__introsort<_AlgPolicy, + _Comp&, + _RandomAccessIterator, + __use_branchless_sort<_Comp, _RandomAccessIterator>::value>( + __first, __last, __comp, __depth_limit); +} + +template <class _Type, class... _Options> +using __is_any_of = _Or<is_same<_Type, _Options>...>; + +template <class _Type> +using __sort_is_specialized_in_library = __is_any_of< + _Type, + char, +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS + wchar_t, +#endif + signed char, + unsigned char, + short, + unsigned short, + int, + unsigned int, + long, + unsigned long, + long long, + unsigned long long, + float, + double, + long double>; + +template <class _AlgPolicy, class _Type, __enable_if_t<__sort_is_specialized_in_library<_Type>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI void __sort_dispatch(_Type* __first, _Type* __last, __less<_Type>& __comp) { + std::__sort<__less<_Type>&, _Type*>(__first, __last, __comp); +} + +template <class _AlgPolicy, class _Type, __enable_if_t<__sort_is_specialized_in_library<_Type>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI void __sort_dispatch(_Type* __first, _Type* __last, less<_Type>&) { + __less<_Type> __comp; + std::__sort<__less<_Type>&, _Type*>(__first, __last, __comp); +} + +#if _LIBCPP_STD_VER >= 14 +template <class _AlgPolicy, class _Type, __enable_if_t<__sort_is_specialized_in_library<_Type>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI void __sort_dispatch(_Type* __first, _Type* __last, less<>&) { + __less<_Type> __comp; + std::__sort<__less<_Type>&, _Type*>(__first, __last, __comp); +} +#endif + +#if _LIBCPP_STD_VER >= 20 +template <class _AlgPolicy, class _Type, __enable_if_t<__sort_is_specialized_in_library<_Type>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI void __sort_dispatch(_Type* __first, _Type* __last, ranges::less&) { + __less<_Type> __comp; + std::__sort<__less<_Type>&, _Type*>(__first, __last, __comp); +} +#endif template <class _AlgPolicy, class _RandomAccessIterator, class _Comp> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __sort_impl(_RandomAccessIterator __first, _RandomAccessIterator __last, _Comp& __comp) { std::__debug_randomize_range<_AlgPolicy>(__first, __last); - using _Comp_ref = __comp_ref_type<_Comp>; if (__libcpp_is_constant_evaluated()) { - std::__partial_sort<_AlgPolicy>(__first, __last, __last, __comp); - + std::__partial_sort<_AlgPolicy>( + std::__unwrap_iter(__first), std::__unwrap_iter(__last), std::__unwrap_iter(__last), __comp); } else { - using _WrappedComp = typename _WrapAlgPolicy<_AlgPolicy, _Comp_ref>::type; - _Comp_ref __comp_ref(__comp); - _WrappedComp __wrapped_comp(__comp_ref); - std::__sort<_WrappedComp>(std::__unwrap_iter(__first), std::__unwrap_iter(__last), __wrapped_comp); + std::__sort_dispatch<_AlgPolicy>(std::__unwrap_iter(__first), std::__unwrap_iter(__last), __comp); } }
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/sort_heap.h b/third_party/llvm-project/libcxx/include/__algorithm/sort_heap.h index 8249407..0dc9acc 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/sort_heap.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/sort_heap.h
@@ -15,8 +15,9 @@ #include <__algorithm/pop_heap.h> #include <__config> #include <__iterator/iterator_traits.h> +#include <__type_traits/is_copy_assignable.h> +#include <__type_traits/is_copy_constructible.h> #include <__utility/move.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/stable_partition.h b/third_party/llvm-project/libcxx/include/__algorithm/stable_partition.h index a49de6d..3b68bd3 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/stable_partition.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/stable_partition.h
@@ -21,7 +21,6 @@ #include <__utility/move.h> #include <__utility/pair.h> #include <new> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/stable_sort.h b/third_party/llvm-project/libcxx/include/__algorithm/stable_sort.h index 8e70978..0c9daa2 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/stable_sort.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/stable_sort.h
@@ -19,10 +19,10 @@ #include <__memory/destruct_n.h> #include <__memory/temporary_buffer.h> #include <__memory/unique_ptr.h> +#include <__type_traits/is_trivially_copy_assignable.h> #include <__utility/move.h> #include <__utility/pair.h> #include <new> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -30,6 +30,37 @@ _LIBCPP_BEGIN_NAMESPACE_STD +template <class _AlgPolicy, class _Compare, class _BidirectionalIterator> +_LIBCPP_HIDE_FROM_ABI +void __insertion_sort_move(_BidirectionalIterator __first1, _BidirectionalIterator __last1, + typename iterator_traits<_BidirectionalIterator>::value_type* __first2, _Compare __comp) { + using _Ops = _IterOps<_AlgPolicy>; + + typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type; + if (__first1 != __last1) { + __destruct_n __d(0); + unique_ptr<value_type, __destruct_n&> __h(__first2, __d); + value_type* __last2 = __first2; + ::new ((void*)__last2) value_type(_Ops::__iter_move(__first1)); + __d.template __incr<value_type>(); + for (++__last2; ++__first1 != __last1; ++__last2) { + value_type* __j2 = __last2; + value_type* __i2 = __j2; + if (__comp(*__first1, *--__i2)) { + ::new ((void*)__j2) value_type(std::move(*__i2)); + __d.template __incr<value_type>(); + for (--__j2; __i2 != __first2 && __comp(*__first1, *--__i2); --__j2) + *__j2 = std::move(*__i2); + *__j2 = _Ops::__iter_move(__first1); + } else { + ::new ((void*)__j2) value_type(_Ops::__iter_move(__first1)); + __d.template __incr<value_type>(); + } + } + __h.release(); + } +} + template <class _AlgPolicy, class _Compare, class _InputIterator1, class _InputIterator2> _LIBCPP_HIDE_FROM_ABI void __merge_move_construct(_InputIterator1 __first1, _InputIterator1 __last1,
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/three_way_comp_ref_type.h b/third_party/llvm-project/libcxx/include/__algorithm/three_way_comp_ref_type.h new file mode 100644 index 0000000..10396e0 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__algorithm/three_way_comp_ref_type.h
@@ -0,0 +1,70 @@ +//===----------------------------------------------------------------------===// +// +// 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___ALGORITHM_THREE_WAY_COMP_REF_TYPE_H +#define _LIBCPP___ALGORITHM_THREE_WAY_COMP_REF_TYPE_H + +#include <__compare/ordering.h> +#include <__config> +#include <__debug> +#include <__utility/declval.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER >= 20 + +template <class _Comp> +struct __debug_three_way_comp { + _Comp& __comp_; + _LIBCPP_HIDE_FROM_ABI constexpr __debug_three_way_comp(_Comp& __c) : __comp_(__c) {} + + template <class _Tp, class _Up> + _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp& __x, _Up& __y) { + auto __r = __comp_(__x, __y); + __do_compare_assert(0, __y, __x, __r); + return __r; + } + + template <class _LHS, class _RHS, class _Order> + _LIBCPP_HIDE_FROM_ABI constexpr inline void __do_compare_assert(int, _LHS& __l, _RHS& __r, _Order __o) + requires __comparison_category<decltype(std::declval<_Comp&>()(std::declval<_LHS&>(), std::declval<_RHS&>()))> + { + _Order __expected = __o; + if (__o == _Order::less) + __expected = _Order::greater; + if (__o == _Order::greater) + __expected = _Order::less; + _LIBCPP_DEBUG_ASSERT(__comp_(__l, __r) == __expected, "Comparator does not induce a strict weak ordering"); + (void)__l; + (void)__r; + (void)__expected; + } + + template <class _LHS, class _RHS, class _Order> + _LIBCPP_HIDE_FROM_ABI constexpr inline void __do_compare_assert(long, _LHS&, _RHS&, _Order) {} +}; + +// Pass the comparator by lvalue reference. Or in debug mode, using a +// debugging wrapper that stores a reference. +# ifndef _LIBCPP_ENABLE_DEBUG_MODE +template <class _Comp> +using __three_way_comp_ref_type = __debug_three_way_comp<_Comp>; +# else +template <class _Comp> +using __three_way_comp_ref_type = _Comp&; +# endif + +#endif // _LIBCPP_STD_VER >= 20 + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___ALGORITHM_THREE_WAY_COMP_REF_TYPE_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h b/third_party/llvm-project/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h index 1e86074..1f20399 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/uniform_random_bit_generator_adaptor.h
@@ -11,13 +11,13 @@ #include <__config> #include <__functional/invoke.h> -#include <type_traits> +#include <__type_traits/remove_cvref.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_PUSH_MACROS #include <__undef_macros> @@ -57,6 +57,6 @@ _LIBCPP_POP_MACROS -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___ALGORITHM_RANGES_UNIFORM_RANDOM_BIT_GENERATOR_ADAPTOR_H
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/unwrap_iter.h b/third_party/llvm-project/libcxx/include/__algorithm/unwrap_iter.h index 0f661e1..81f2942 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/unwrap_iter.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/unwrap_iter.h
@@ -64,6 +64,14 @@ return _Impl::__unwrap(__i); } +// Allow input_iterators to be passed to __unwrap_iter (but not __rewrap_iter) +#if _LIBCPP_STD_VER >= 20 +template <class _Iter, __enable_if_t<!is_copy_constructible<_Iter>::value, int> = 0> +inline _LIBCPP_HIDE_FROM_ABI constexpr _Iter __unwrap_iter(_Iter __i) noexcept { + return __i; +} +#endif + template <class _OrigIter, class _Iter, class _Impl = __unwrap_iter_impl<_OrigIter> > _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _OrigIter __rewrap_iter(_OrigIter __orig_iter, _Iter __iter) _NOEXCEPT { return _Impl::__rewrap(std::move(__orig_iter), std::move(__iter));
diff --git a/third_party/llvm-project/libcxx/include/__algorithm/unwrap_range.h b/third_party/llvm-project/libcxx/include/__algorithm/unwrap_range.h index 2c5d23e..2c75c8f 100644 --- a/third_party/llvm-project/libcxx/include/__algorithm/unwrap_range.h +++ b/third_party/llvm-project/libcxx/include/__algorithm/unwrap_range.h
@@ -28,7 +28,7 @@ // __unwrap_iter and __rewrap_iter don't work for this, because they assume that the iterator and sentinel have // the same type. __unwrap_range tries to get two iterators and then forward to __unwrap_iter. -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Iter, class _Sent> struct __unwrap_range_impl { _LIBCPP_HIDE_FROM_ABI static constexpr auto __unwrap(_Iter __first, _Sent __sent) @@ -43,7 +43,7 @@ } _LIBCPP_HIDE_FROM_ABI static constexpr auto - __rewrap(_Iter __orig_iter, decltype(std::__unwrap_iter(__orig_iter)) __iter) + __rewrap(_Iter __orig_iter, decltype(std::__unwrap_iter(std::move(__orig_iter))) __iter) requires random_access_iterator<_Iter> && sized_sentinel_for<_Sent, _Iter> { return std::__rewrap_iter(std::move(__orig_iter), std::move(__iter)); @@ -80,7 +80,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr _Iter __rewrap_range(_Iter __orig_iter, _Unwrapped __iter) { return __unwrap_range_impl<_Iter, _Sent>::__rewrap(std::move(__orig_iter), std::move(__iter)); } -#else // _LIBCPP_STD_VER > 17 +#else // _LIBCPP_STD_VER >= 20 template <class _Iter, class _Unwrapped = decltype(std::__unwrap_iter(std::declval<_Iter>()))> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR pair<_Unwrapped, _Unwrapped> __unwrap_range(_Iter __first, _Iter __last) { return std::make_pair(std::__unwrap_iter(std::move(__first)), std::__unwrap_iter(std::move(__last))); @@ -90,7 +90,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Iter __rewrap_range(_Iter __orig_iter, _Unwrapped __iter) { return std::__rewrap_iter(std::move(__orig_iter), std::move(__iter)); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__assert b/third_party/llvm-project/libcxx/include/__assert index 9c0cd1b..e20ee50 100644 --- a/third_party/llvm-project/libcxx/include/__assert +++ b/third_party/llvm-project/libcxx/include/__assert
@@ -17,39 +17,33 @@ # pragma GCC system_header #endif -// TODO: Remove in LLVM 17. -#if defined(_LIBCPP_DEBUG) -# error "Defining _LIBCPP_DEBUG is not supported anymore. Please use _LIBCPP_ENABLE_DEBUG_MODE instead." -#endif - // Automatically enable assertions when the debug mode is enabled. #if defined(_LIBCPP_ENABLE_DEBUG_MODE) -# ifndef _LIBCPP_ENABLE_ASSERTIONS -# define _LIBCPP_ENABLE_ASSERTIONS 1 -# endif +# ifndef _LIBCPP_ENABLE_ASSERTIONS +# define _LIBCPP_ENABLE_ASSERTIONS 1 +# endif #endif #ifndef _LIBCPP_ENABLE_ASSERTIONS -# define _LIBCPP_ENABLE_ASSERTIONS _LIBCPP_ENABLE_ASSERTIONS_DEFAULT +# define _LIBCPP_ENABLE_ASSERTIONS _LIBCPP_ENABLE_ASSERTIONS_DEFAULT #endif #if _LIBCPP_ENABLE_ASSERTIONS != 0 && _LIBCPP_ENABLE_ASSERTIONS != 1 -# error "_LIBCPP_ENABLE_ASSERTIONS must be set to 0 or 1" +# error "_LIBCPP_ENABLE_ASSERTIONS must be set to 0 or 1" #endif #if _LIBCPP_ENABLE_ASSERTIONS -# define _LIBCPP_ASSERT(expression, message) \ - (__builtin_expect(static_cast<bool>(expression), 1) ? \ - (void)0 : \ - _LIBCPP_VERBOSE_ABORT("%s:%d: assertion %s failed: %s", __FILE__, __LINE__, #expression, message)) +# define _LIBCPP_ASSERT(expression, message) \ + (__builtin_expect(static_cast<bool>(expression), 1) \ + ? (void)0 \ + : _LIBCPP_VERBOSE_ABORT( \ + "%s:%d: assertion %s failed: %s", __builtin_FILE(), __builtin_LINE(), #expression, message)) #elif !defined(_LIBCPP_ASSERTIONS_DISABLE_ASSUME) && __has_builtin(__builtin_assume) -# define _LIBCPP_ASSERT(expression, message) \ - (_LIBCPP_DIAGNOSTIC_PUSH \ - _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wassume") \ - __builtin_assume(static_cast<bool>(expression)) \ - _LIBCPP_DIAGNOSTIC_POP) +# define _LIBCPP_ASSERT(expression, message) \ + (_LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wassume") \ + __builtin_assume(static_cast<bool>(expression)) _LIBCPP_DIAGNOSTIC_POP) #else -# define _LIBCPP_ASSERT(expression, message) ((void)0) +# define _LIBCPP_ASSERT(expression, message) ((void)0) #endif #endif // _LIBCPP___ASSERT
diff --git a/third_party/llvm-project/libcxx/include/__atomic/aliases.h b/third_party/llvm-project/libcxx/include/__atomic/aliases.h new file mode 100644 index 0000000..806589b --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__atomic/aliases.h
@@ -0,0 +1,116 @@ +//===----------------------------------------------------------------------===// +// +// 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___ATOMIC_ALIASES_H +#define _LIBCPP___ATOMIC_ALIASES_H + +#include <__atomic/atomic.h> +#include <__atomic/atomic_lock_free.h> +#include <__atomic/contention_t.h> +#include <__atomic/is_always_lock_free.h> +#include <__config> +#include <__type_traits/conditional.h> +#include <cstddef> +#include <cstdint> +#include <cstdlib> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +using atomic_bool = atomic<bool>; +using atomic_char = atomic<char>; +using atomic_schar = atomic<signed char>; +using atomic_uchar = atomic<unsigned char>; +using atomic_short = atomic<short>; +using atomic_ushort = atomic<unsigned short>; +using atomic_int = atomic<int>; +using atomic_uint = atomic<unsigned int>; +using atomic_long = atomic<long>; +using atomic_ulong = atomic<unsigned long>; +using atomic_llong = atomic<long long>; +using atomic_ullong = atomic<unsigned long long>; +#ifndef _LIBCPP_HAS_NO_CHAR8_T +using atomic_char8_t = atomic<char8_t>; +#endif +using atomic_char16_t = atomic<char16_t>; +using atomic_char32_t = atomic<char32_t>; +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +using atomic_wchar_t = atomic<wchar_t>; +#endif + +using atomic_int_least8_t = atomic<int_least8_t>; +using atomic_uint_least8_t = atomic<uint_least8_t>; +using atomic_int_least16_t = atomic<int_least16_t>; +using atomic_uint_least16_t = atomic<uint_least16_t>; +using atomic_int_least32_t = atomic<int_least32_t>; +using atomic_uint_least32_t = atomic<uint_least32_t>; +using atomic_int_least64_t = atomic<int_least64_t>; +using atomic_uint_least64_t = atomic<uint_least64_t>; + +using atomic_int_fast8_t = atomic<int_fast8_t>; +using atomic_uint_fast8_t = atomic<uint_fast8_t>; +using atomic_int_fast16_t = atomic<int_fast16_t>; +using atomic_uint_fast16_t = atomic<uint_fast16_t>; +using atomic_int_fast32_t = atomic<int_fast32_t>; +using atomic_uint_fast32_t = atomic<uint_fast32_t>; +using atomic_int_fast64_t = atomic<int_fast64_t>; +using atomic_uint_fast64_t = atomic<uint_fast64_t>; + +using atomic_int8_t = atomic< int8_t>; +using atomic_uint8_t = atomic<uint8_t>; +using atomic_int16_t = atomic< int16_t>; +using atomic_uint16_t = atomic<uint16_t>; +using atomic_int32_t = atomic< int32_t>; +using atomic_uint32_t = atomic<uint32_t>; +using atomic_int64_t = atomic< int64_t>; +using atomic_uint64_t = atomic<uint64_t>; + +using atomic_intptr_t = atomic<intptr_t>; +using atomic_uintptr_t = atomic<uintptr_t>; +using atomic_size_t = atomic<size_t>; +using atomic_ptrdiff_t = atomic<ptrdiff_t>; +using atomic_intmax_t = atomic<intmax_t>; +using atomic_uintmax_t = atomic<uintmax_t>; + +// atomic_*_lock_free : prefer the contention type most highly, then the largest lock-free type + +#ifdef __cpp_lib_atomic_is_always_lock_free +# define _LIBCPP_CONTENTION_LOCK_FREE ::std::__libcpp_is_always_lock_free<__cxx_contention_t>::__value +#else +# define _LIBCPP_CONTENTION_LOCK_FREE false +#endif + +#if ATOMIC_LLONG_LOCK_FREE == 2 +using __libcpp_signed_lock_free = __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, long long>; +using __libcpp_unsigned_lock_free = + __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned long long>; +#elif ATOMIC_INT_LOCK_FREE == 2 +using __libcpp_signed_lock_free = __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, int>; +using __libcpp_unsigned_lock_free = __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned int>; +#elif ATOMIC_SHORT_LOCK_FREE == 2 +using __libcpp_signed_lock_free = __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, short>; +using __libcpp_unsigned_lock_free = __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned short>; +#elif ATOMIC_CHAR_LOCK_FREE == 2 +using __libcpp_signed_lock_free = __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, char>; +using __libcpp_unsigned_lock_free = __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned char>; +#else +// No signed/unsigned lock-free types +# define _LIBCPP_NO_LOCK_FREE_TYPES +#endif + +#if !defined(_LIBCPP_NO_LOCK_FREE_TYPES) +using atomic_signed_lock_free = atomic<__libcpp_signed_lock_free>; +using atomic_unsigned_lock_free = atomic<__libcpp_unsigned_lock_free>; +#endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___ATOMIC_ALIASES_H
diff --git a/third_party/llvm-project/libcxx/include/__atomic/atomic.h b/third_party/llvm-project/libcxx/include/__atomic/atomic.h new file mode 100644 index 0000000..68df7f1 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__atomic/atomic.h
@@ -0,0 +1,664 @@ +//===----------------------------------------------------------------------===// +// +// 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___ATOMIC_ATOMIC_H +#define _LIBCPP___ATOMIC_ATOMIC_H + +#include <__atomic/atomic_base.h> +#include <__atomic/check_memory_order.h> +#include <__atomic/cxx_atomic_impl.h> +#include <__atomic/memory_order.h> +#include <__config> +#include <__memory/addressof.h> +#include <__type_traits/is_function.h> +#include <__type_traits/is_same.h> +#include <__type_traits/remove_pointer.h> +#include <cstddef> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> +struct atomic + : public __atomic_base<_Tp> +{ + using __base = __atomic_base<_Tp>; + using value_type = _Tp; + using difference_type = value_type; + +#if _LIBCPP_STD_VER >= 20 + _LIBCPP_HIDE_FROM_ABI + atomic() = default; +#else + _LIBCPP_HIDE_FROM_ABI + atomic() _NOEXCEPT = default; +#endif + + _LIBCPP_HIDE_FROM_ABI + _LIBCPP_CONSTEXPR atomic(_Tp __d) _NOEXCEPT : __base(__d) {} + + _LIBCPP_HIDE_FROM_ABI + _Tp operator=(_Tp __d) volatile _NOEXCEPT + {__base::store(__d); return __d;} + _LIBCPP_HIDE_FROM_ABI + _Tp operator=(_Tp __d) _NOEXCEPT + {__base::store(__d); return __d;} + + atomic& operator=(const atomic&) = delete; + atomic& operator=(const atomic&) volatile = delete; +}; + +// atomic<T*> + +template <class _Tp> +struct atomic<_Tp*> + : public __atomic_base<_Tp*> +{ + using __base = __atomic_base<_Tp*>; + using value_type = _Tp*; + using difference_type = ptrdiff_t; + + _LIBCPP_HIDE_FROM_ABI + atomic() _NOEXCEPT = default; + + _LIBCPP_HIDE_FROM_ABI + _LIBCPP_CONSTEXPR atomic(_Tp* __d) _NOEXCEPT : __base(__d) {} + + _LIBCPP_HIDE_FROM_ABI + _Tp* operator=(_Tp* __d) volatile _NOEXCEPT + {__base::store(__d); return __d;} + _LIBCPP_HIDE_FROM_ABI + _Tp* operator=(_Tp* __d) _NOEXCEPT + {__base::store(__d); return __d;} + + _LIBCPP_HIDE_FROM_ABI + _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT { + // __atomic_fetch_add accepts function pointers, guard against them. + static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed"); + return std::__cxx_atomic_fetch_add(std::addressof(this->__a_), __op, __m); + } + + _LIBCPP_HIDE_FROM_ABI + _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT { + // __atomic_fetch_add accepts function pointers, guard against them. + static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed"); + return std::__cxx_atomic_fetch_add(std::addressof(this->__a_), __op, __m); + } + + _LIBCPP_HIDE_FROM_ABI + _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT { + // __atomic_fetch_add accepts function pointers, guard against them. + static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed"); + return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m); + } + + _LIBCPP_HIDE_FROM_ABI + _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT { + // __atomic_fetch_add accepts function pointers, guard against them. + static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed"); + return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m); + } + + _LIBCPP_HIDE_FROM_ABI + _Tp* operator++(int) volatile _NOEXCEPT {return fetch_add(1);} + _LIBCPP_HIDE_FROM_ABI + _Tp* operator++(int) _NOEXCEPT {return fetch_add(1);} + _LIBCPP_HIDE_FROM_ABI + _Tp* operator--(int) volatile _NOEXCEPT {return fetch_sub(1);} + _LIBCPP_HIDE_FROM_ABI + _Tp* operator--(int) _NOEXCEPT {return fetch_sub(1);} + _LIBCPP_HIDE_FROM_ABI + _Tp* operator++() volatile _NOEXCEPT {return fetch_add(1) + 1;} + _LIBCPP_HIDE_FROM_ABI + _Tp* operator++() _NOEXCEPT {return fetch_add(1) + 1;} + _LIBCPP_HIDE_FROM_ABI + _Tp* operator--() volatile _NOEXCEPT {return fetch_sub(1) - 1;} + _LIBCPP_HIDE_FROM_ABI + _Tp* operator--() _NOEXCEPT {return fetch_sub(1) - 1;} + _LIBCPP_HIDE_FROM_ABI + _Tp* operator+=(ptrdiff_t __op) volatile _NOEXCEPT {return fetch_add(__op) + __op;} + _LIBCPP_HIDE_FROM_ABI + _Tp* operator+=(ptrdiff_t __op) _NOEXCEPT {return fetch_add(__op) + __op;} + _LIBCPP_HIDE_FROM_ABI + _Tp* operator-=(ptrdiff_t __op) volatile _NOEXCEPT {return fetch_sub(__op) - __op;} + _LIBCPP_HIDE_FROM_ABI + _Tp* operator-=(ptrdiff_t __op) _NOEXCEPT {return fetch_sub(__op) - __op;} + + atomic& operator=(const atomic&) = delete; + atomic& operator=(const atomic&) volatile = delete; +}; + +// atomic_is_lock_free + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +bool +atomic_is_lock_free(const volatile atomic<_Tp>* __o) _NOEXCEPT +{ + return __o->is_lock_free(); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +bool +atomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT +{ + return __o->is_lock_free(); +} + +// atomic_init + +template <class _Tp> +_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI +void +atomic_init(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT +{ + std::__cxx_atomic_init(std::addressof(__o->__a_), __d); +} + +template <class _Tp> +_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI +void +atomic_init(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT +{ + std::__cxx_atomic_init(std::addressof(__o->__a_), __d); +} + +// atomic_store + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +void +atomic_store(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT +{ + __o->store(__d); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +void +atomic_store(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT +{ + __o->store(__d); +} + +// atomic_store_explicit + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +void +atomic_store_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT + _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) +{ + __o->store(__d, __m); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +void +atomic_store_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT + _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) +{ + __o->store(__d, __m); +} + +// atomic_load + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp +atomic_load(const volatile atomic<_Tp>* __o) _NOEXCEPT +{ + return __o->load(); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp +atomic_load(const atomic<_Tp>* __o) _NOEXCEPT +{ + return __o->load(); +} + +// atomic_load_explicit + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp +atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) _NOEXCEPT + _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) +{ + return __o->load(__m); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp +atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT + _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) +{ + return __o->load(__m); +} + +// atomic_exchange + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp +atomic_exchange(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT +{ + return __o->exchange(__d); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp +atomic_exchange(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT +{ + return __o->exchange(__d); +} + +// atomic_exchange_explicit + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp +atomic_exchange_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT +{ + return __o->exchange(__d, __m); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp +atomic_exchange_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT +{ + return __o->exchange(__d, __m); +} + +// atomic_compare_exchange_weak + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +bool +atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT +{ + return __o->compare_exchange_weak(*__e, __d); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +bool +atomic_compare_exchange_weak(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT +{ + return __o->compare_exchange_weak(*__e, __d); +} + +// atomic_compare_exchange_strong + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +bool +atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT +{ + return __o->compare_exchange_strong(*__e, __d); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +bool +atomic_compare_exchange_strong(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT +{ + return __o->compare_exchange_strong(*__e, __d); +} + +// atomic_compare_exchange_weak_explicit + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +bool +atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, + typename atomic<_Tp>::value_type __d, + memory_order __s, memory_order __f) _NOEXCEPT + _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) +{ + return __o->compare_exchange_weak(*__e, __d, __s, __f); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +bool +atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d, + memory_order __s, memory_order __f) _NOEXCEPT + _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) +{ + return __o->compare_exchange_weak(*__e, __d, __s, __f); +} + +// atomic_compare_exchange_strong_explicit + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +bool +atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o, + typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d, + memory_order __s, memory_order __f) _NOEXCEPT + _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) +{ + return __o->compare_exchange_strong(*__e, __d, __s, __f); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +bool +atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, + typename atomic<_Tp>::value_type __d, + memory_order __s, memory_order __f) _NOEXCEPT + _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) +{ + return __o->compare_exchange_strong(*__e, __d, __s, __f); +} + +// atomic_wait + +template <class _Tp> +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI +void atomic_wait(const volatile atomic<_Tp>* __o, + typename atomic<_Tp>::value_type __v) _NOEXCEPT +{ + return __o->wait(__v); +} + +template <class _Tp> +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI +void atomic_wait(const atomic<_Tp>* __o, + typename atomic<_Tp>::value_type __v) _NOEXCEPT +{ + return __o->wait(__v); +} + +// atomic_wait_explicit + +template <class _Tp> +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI +void atomic_wait_explicit(const volatile atomic<_Tp>* __o, + typename atomic<_Tp>::value_type __v, + memory_order __m) _NOEXCEPT + _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) +{ + return __o->wait(__v, __m); +} + +template <class _Tp> +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI +void atomic_wait_explicit(const atomic<_Tp>* __o, + typename atomic<_Tp>::value_type __v, + memory_order __m) _NOEXCEPT + _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) +{ + return __o->wait(__v, __m); +} + +// atomic_notify_one + +template <class _Tp> +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI +void atomic_notify_one(volatile atomic<_Tp>* __o) _NOEXCEPT +{ + __o->notify_one(); +} +template <class _Tp> +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI +void atomic_notify_one(atomic<_Tp>* __o) _NOEXCEPT +{ + __o->notify_one(); +} + +// atomic_notify_all + +template <class _Tp> +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI +void atomic_notify_all(volatile atomic<_Tp>* __o) _NOEXCEPT +{ + __o->notify_all(); +} +template <class _Tp> +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI +void atomic_notify_all(atomic<_Tp>* __o) _NOEXCEPT +{ + __o->notify_all(); +} + +// atomic_fetch_add + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp +atomic_fetch_add(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT +{ + return __o->fetch_add(__op); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp +atomic_fetch_add(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT +{ + return __o->fetch_add(__op); +} + +// atomic_fetch_add_explicit + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp atomic_fetch_add_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT +{ + return __o->fetch_add(__op, __m); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp atomic_fetch_add_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT +{ + return __o->fetch_add(__op, __m); +} + +// atomic_fetch_sub + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp atomic_fetch_sub(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT +{ + return __o->fetch_sub(__op); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp atomic_fetch_sub(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT +{ + return __o->fetch_sub(__op); +} + +// atomic_fetch_sub_explicit + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp atomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT +{ + return __o->fetch_sub(__op, __m); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp atomic_fetch_sub_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT +{ + return __o->fetch_sub(__op, __m); +} + +// atomic_fetch_and + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +typename enable_if +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +>::type +atomic_fetch_and(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT +{ + return __o->fetch_and(__op); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +typename enable_if +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +>::type +atomic_fetch_and(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT +{ + return __o->fetch_and(__op); +} + +// atomic_fetch_and_explicit + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +typename enable_if +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +>::type +atomic_fetch_and_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT +{ + return __o->fetch_and(__op, __m); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +typename enable_if +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +>::type +atomic_fetch_and_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT +{ + return __o->fetch_and(__op, __m); +} + +// atomic_fetch_or + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +typename enable_if +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +>::type +atomic_fetch_or(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT +{ + return __o->fetch_or(__op); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +typename enable_if +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +>::type +atomic_fetch_or(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT +{ + return __o->fetch_or(__op); +} + +// atomic_fetch_or_explicit + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +typename enable_if +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +>::type +atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT +{ + return __o->fetch_or(__op, __m); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +typename enable_if +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +>::type +atomic_fetch_or_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT +{ + return __o->fetch_or(__op, __m); +} + +// atomic_fetch_xor + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +typename enable_if +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +>::type +atomic_fetch_xor(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT +{ + return __o->fetch_xor(__op); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +typename enable_if +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +>::type +atomic_fetch_xor(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT +{ + return __o->fetch_xor(__op); +} + +// atomic_fetch_xor_explicit + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +typename enable_if +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +>::type +atomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT +{ + return __o->fetch_xor(__op, __m); +} + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +typename enable_if +< + is_integral<_Tp>::value && !is_same<_Tp, bool>::value, + _Tp +>::type +atomic_fetch_xor_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT +{ + return __o->fetch_xor(__op, __m); +} + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___ATOMIC_ATOMIC_H
diff --git a/third_party/llvm-project/libcxx/include/__atomic/atomic_base.h b/third_party/llvm-project/libcxx/include/__atomic/atomic_base.h new file mode 100644 index 0000000..7a9ba78 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__atomic/atomic_base.h
@@ -0,0 +1,232 @@ +//===----------------------------------------------------------------------===// +// +// 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___ATOMIC_ATOMIC_BASE_H +#define _LIBCPP___ATOMIC_ATOMIC_BASE_H + +#include <__atomic/atomic_sync.h> +#include <__atomic/check_memory_order.h> +#include <__atomic/cxx_atomic_impl.h> +#include <__atomic/is_always_lock_free.h> +#include <__atomic/memory_order.h> +#include <__availability> +#include <__config> +#include <__memory/addressof.h> +#include <__type_traits/is_integral.h> +#include <__type_traits/is_nothrow_default_constructible.h> +#include <__type_traits/is_same.h> +#include <version> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::value> +struct __atomic_base // false +{ + mutable __cxx_atomic_impl<_Tp> __a_; + +#if defined(__cpp_lib_atomic_is_always_lock_free) + static _LIBCPP_CONSTEXPR bool is_always_lock_free = __libcpp_is_always_lock_free<__cxx_atomic_impl<_Tp> >::__value; +#endif + + _LIBCPP_HIDE_FROM_ABI + bool is_lock_free() const volatile _NOEXCEPT + {return __cxx_atomic_is_lock_free(sizeof(_Tp));} + _LIBCPP_HIDE_FROM_ABI + bool is_lock_free() const _NOEXCEPT + {return static_cast<__atomic_base const volatile*>(this)->is_lock_free();} + _LIBCPP_HIDE_FROM_ABI void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT + _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) { + std::__cxx_atomic_store(std::addressof(__a_), __d, __m); + } + _LIBCPP_HIDE_FROM_ABI void store(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT + _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) { + std::__cxx_atomic_store(std::addressof(__a_), __d, __m); + } + _LIBCPP_HIDE_FROM_ABI _Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT + _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) { + return std::__cxx_atomic_load(std::addressof(__a_), __m); + } + _LIBCPP_HIDE_FROM_ABI _Tp load(memory_order __m = memory_order_seq_cst) const _NOEXCEPT + _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) { + return std::__cxx_atomic_load(std::addressof(__a_), __m); + } + _LIBCPP_HIDE_FROM_ABI + operator _Tp() const volatile _NOEXCEPT {return load();} + _LIBCPP_HIDE_FROM_ABI + operator _Tp() const _NOEXCEPT {return load();} + _LIBCPP_HIDE_FROM_ABI _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT { + return std::__cxx_atomic_exchange(std::addressof(__a_), __d, __m); + } + _LIBCPP_HIDE_FROM_ABI _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT { + return std::__cxx_atomic_exchange(std::addressof(__a_), __d, __m); + } + _LIBCPP_HIDE_FROM_ABI bool + compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) volatile _NOEXCEPT + _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) { + return std::__cxx_atomic_compare_exchange_weak(std::addressof(__a_), std::addressof(__e), __d, __s, __f); + } + _LIBCPP_HIDE_FROM_ABI bool compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) _NOEXCEPT + _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) { + return std::__cxx_atomic_compare_exchange_weak(std::addressof(__a_), std::addressof(__e), __d, __s, __f); + } + _LIBCPP_HIDE_FROM_ABI bool + compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) volatile _NOEXCEPT + _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) { + return std::__cxx_atomic_compare_exchange_strong(std::addressof(__a_), std::addressof(__e), __d, __s, __f); + } + _LIBCPP_HIDE_FROM_ABI bool compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __s, memory_order __f) _NOEXCEPT + _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) { + return std::__cxx_atomic_compare_exchange_strong(std::addressof(__a_), std::addressof(__e), __d, __s, __f); + } + _LIBCPP_HIDE_FROM_ABI bool + compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT { + return std::__cxx_atomic_compare_exchange_weak(std::addressof(__a_), std::addressof(__e), __d, __m, __m); + } + _LIBCPP_HIDE_FROM_ABI bool + compare_exchange_weak(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT { + return std::__cxx_atomic_compare_exchange_weak(std::addressof(__a_), std::addressof(__e), __d, __m, __m); + } + _LIBCPP_HIDE_FROM_ABI bool + compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT { + return std::__cxx_atomic_compare_exchange_strong(std::addressof(__a_), std::addressof(__e), __d, __m, __m); + } + _LIBCPP_HIDE_FROM_ABI bool + compare_exchange_strong(_Tp& __e, _Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT { + return std::__cxx_atomic_compare_exchange_strong(std::addressof(__a_), std::addressof(__e), __d, __m, __m); + } + + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void wait(_Tp __v, memory_order __m = memory_order_seq_cst) const + volatile _NOEXCEPT { + std::__cxx_atomic_wait(std::addressof(__a_), __v, __m); + } + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void + wait(_Tp __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT { + std::__cxx_atomic_wait(std::addressof(__a_), __v, __m); + } + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() volatile _NOEXCEPT { + std::__cxx_atomic_notify_one(std::addressof(__a_)); + } + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_one() _NOEXCEPT { + std::__cxx_atomic_notify_one(std::addressof(__a_)); + } + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() volatile _NOEXCEPT { + std::__cxx_atomic_notify_all(std::addressof(__a_)); + } + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI void notify_all() _NOEXCEPT { + std::__cxx_atomic_notify_all(std::addressof(__a_)); + } + +#if _LIBCPP_STD_VER >= 20 + _LIBCPP_HIDE_FROM_ABI constexpr + __atomic_base() noexcept(is_nothrow_default_constructible_v<_Tp>) : __a_(_Tp()) {} +#else + _LIBCPP_HIDE_FROM_ABI + __atomic_base() _NOEXCEPT = default; +#endif + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR + __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {} + + __atomic_base(const __atomic_base&) = delete; +}; + +#if defined(__cpp_lib_atomic_is_always_lock_free) +template <class _Tp, bool __b> +_LIBCPP_CONSTEXPR bool __atomic_base<_Tp, __b>::is_always_lock_free; +#endif + +// atomic<Integral> + +template <class _Tp> +struct __atomic_base<_Tp, true> + : public __atomic_base<_Tp, false> +{ + using __base = __atomic_base<_Tp, false>; + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 + __atomic_base() _NOEXCEPT = default; + + _LIBCPP_HIDE_FROM_ABI + _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __base(__d) {} + + _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT { + return std::__cxx_atomic_fetch_add(std::addressof(this->__a_), __op, __m); + } + _LIBCPP_HIDE_FROM_ABI _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT { + return std::__cxx_atomic_fetch_add(std::addressof(this->__a_), __op, __m); + } + _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT { + return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m); + } + _LIBCPP_HIDE_FROM_ABI _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT { + return std::__cxx_atomic_fetch_sub(std::addressof(this->__a_), __op, __m); + } + _LIBCPP_HIDE_FROM_ABI _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT { + return std::__cxx_atomic_fetch_and(std::addressof(this->__a_), __op, __m); + } + _LIBCPP_HIDE_FROM_ABI _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT { + return std::__cxx_atomic_fetch_and(std::addressof(this->__a_), __op, __m); + } + _LIBCPP_HIDE_FROM_ABI _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT { + return std::__cxx_atomic_fetch_or(std::addressof(this->__a_), __op, __m); + } + _LIBCPP_HIDE_FROM_ABI _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT { + return std::__cxx_atomic_fetch_or(std::addressof(this->__a_), __op, __m); + } + _LIBCPP_HIDE_FROM_ABI _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT { + return std::__cxx_atomic_fetch_xor(std::addressof(this->__a_), __op, __m); + } + _LIBCPP_HIDE_FROM_ABI _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT { + return std::__cxx_atomic_fetch_xor(std::addressof(this->__a_), __op, __m); + } + + _LIBCPP_HIDE_FROM_ABI + _Tp operator++(int) volatile _NOEXCEPT {return fetch_add(_Tp(1));} + _LIBCPP_HIDE_FROM_ABI + _Tp operator++(int) _NOEXCEPT {return fetch_add(_Tp(1));} + _LIBCPP_HIDE_FROM_ABI + _Tp operator--(int) volatile _NOEXCEPT {return fetch_sub(_Tp(1));} + _LIBCPP_HIDE_FROM_ABI + _Tp operator--(int) _NOEXCEPT {return fetch_sub(_Tp(1));} + _LIBCPP_HIDE_FROM_ABI + _Tp operator++() volatile _NOEXCEPT {return fetch_add(_Tp(1)) + _Tp(1);} + _LIBCPP_HIDE_FROM_ABI + _Tp operator++() _NOEXCEPT {return fetch_add(_Tp(1)) + _Tp(1);} + _LIBCPP_HIDE_FROM_ABI + _Tp operator--() volatile _NOEXCEPT {return fetch_sub(_Tp(1)) - _Tp(1);} + _LIBCPP_HIDE_FROM_ABI + _Tp operator--() _NOEXCEPT {return fetch_sub(_Tp(1)) - _Tp(1);} + _LIBCPP_HIDE_FROM_ABI + _Tp operator+=(_Tp __op) volatile _NOEXCEPT {return fetch_add(__op) + __op;} + _LIBCPP_HIDE_FROM_ABI + _Tp operator+=(_Tp __op) _NOEXCEPT {return fetch_add(__op) + __op;} + _LIBCPP_HIDE_FROM_ABI + _Tp operator-=(_Tp __op) volatile _NOEXCEPT {return fetch_sub(__op) - __op;} + _LIBCPP_HIDE_FROM_ABI + _Tp operator-=(_Tp __op) _NOEXCEPT {return fetch_sub(__op) - __op;} + _LIBCPP_HIDE_FROM_ABI + _Tp operator&=(_Tp __op) volatile _NOEXCEPT {return fetch_and(__op) & __op;} + _LIBCPP_HIDE_FROM_ABI + _Tp operator&=(_Tp __op) _NOEXCEPT {return fetch_and(__op) & __op;} + _LIBCPP_HIDE_FROM_ABI + _Tp operator|=(_Tp __op) volatile _NOEXCEPT {return fetch_or(__op) | __op;} + _LIBCPP_HIDE_FROM_ABI + _Tp operator|=(_Tp __op) _NOEXCEPT {return fetch_or(__op) | __op;} + _LIBCPP_HIDE_FROM_ABI + _Tp operator^=(_Tp __op) volatile _NOEXCEPT {return fetch_xor(__op) ^ __op;} + _LIBCPP_HIDE_FROM_ABI + _Tp operator^=(_Tp __op) _NOEXCEPT {return fetch_xor(__op) ^ __op;} +}; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___ATOMIC_ATOMIC_BASE_H
diff --git a/third_party/llvm-project/libcxx/include/__atomic/atomic_flag.h b/third_party/llvm-project/libcxx/include/__atomic/atomic_flag.h new file mode 100644 index 0000000..46a6ad7 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__atomic/atomic_flag.h
@@ -0,0 +1,231 @@ +//===----------------------------------------------------------------------===// +// +// 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___ATOMIC_ATOMIC_FLAG_H +#define _LIBCPP___ATOMIC_ATOMIC_FLAG_H + +#include <__atomic/atomic_sync.h> +#include <__atomic/contention_t.h> +#include <__atomic/cxx_atomic_impl.h> +#include <__atomic/memory_order.h> +#include <__chrono/duration.h> +#include <__config> +#include <__threading_support> +#include <cstdint> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +struct atomic_flag +{ + __cxx_atomic_impl<_LIBCPP_ATOMIC_FLAG_TYPE> __a_; + + _LIBCPP_HIDE_FROM_ABI + bool test(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT + {return _LIBCPP_ATOMIC_FLAG_TYPE(true) == __cxx_atomic_load(&__a_, __m);} + _LIBCPP_HIDE_FROM_ABI + bool test(memory_order __m = memory_order_seq_cst) const _NOEXCEPT + {return _LIBCPP_ATOMIC_FLAG_TYPE(true) == __cxx_atomic_load(&__a_, __m);} + + _LIBCPP_HIDE_FROM_ABI + bool test_and_set(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT + {return __cxx_atomic_exchange(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(true), __m);} + _LIBCPP_HIDE_FROM_ABI + bool test_and_set(memory_order __m = memory_order_seq_cst) _NOEXCEPT + {return __cxx_atomic_exchange(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(true), __m);} + _LIBCPP_HIDE_FROM_ABI + void clear(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT + {__cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m);} + _LIBCPP_HIDE_FROM_ABI + void clear(memory_order __m = memory_order_seq_cst) _NOEXCEPT + {__cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m);} + + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI + void wait(bool __v, memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT + {__cxx_atomic_wait(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m);} + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI + void wait(bool __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT + {__cxx_atomic_wait(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m);} + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI + void notify_one() volatile _NOEXCEPT + {__cxx_atomic_notify_one(&__a_);} + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI + void notify_one() _NOEXCEPT + {__cxx_atomic_notify_one(&__a_);} + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI + void notify_all() volatile _NOEXCEPT + {__cxx_atomic_notify_all(&__a_);} + _LIBCPP_AVAILABILITY_SYNC _LIBCPP_HIDE_FROM_ABI + void notify_all() _NOEXCEPT + {__cxx_atomic_notify_all(&__a_);} + +#if _LIBCPP_STD_VER >= 20 + _LIBCPP_HIDE_FROM_ABI constexpr + atomic_flag() _NOEXCEPT : __a_(false) {} +#else + _LIBCPP_HIDE_FROM_ABI + atomic_flag() _NOEXCEPT = default; +#endif + + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR + atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {} // EXTENSION + + atomic_flag(const atomic_flag&) = delete; + atomic_flag& operator=(const atomic_flag&) = delete; + atomic_flag& operator=(const atomic_flag&) volatile = delete; + +}; + +inline _LIBCPP_HIDE_FROM_ABI +bool +atomic_flag_test(const volatile atomic_flag* __o) _NOEXCEPT +{ + return __o->test(); +} + +inline _LIBCPP_HIDE_FROM_ABI +bool +atomic_flag_test(const atomic_flag* __o) _NOEXCEPT +{ + return __o->test(); +} + +inline _LIBCPP_HIDE_FROM_ABI +bool +atomic_flag_test_explicit(const volatile atomic_flag* __o, memory_order __m) _NOEXCEPT +{ + return __o->test(__m); +} + +inline _LIBCPP_HIDE_FROM_ABI +bool +atomic_flag_test_explicit(const atomic_flag* __o, memory_order __m) _NOEXCEPT +{ + return __o->test(__m); +} + +inline _LIBCPP_HIDE_FROM_ABI +bool +atomic_flag_test_and_set(volatile atomic_flag* __o) _NOEXCEPT +{ + return __o->test_and_set(); +} + +inline _LIBCPP_HIDE_FROM_ABI +bool +atomic_flag_test_and_set(atomic_flag* __o) _NOEXCEPT +{ + return __o->test_and_set(); +} + +inline _LIBCPP_HIDE_FROM_ABI +bool +atomic_flag_test_and_set_explicit(volatile atomic_flag* __o, memory_order __m) _NOEXCEPT +{ + return __o->test_and_set(__m); +} + +inline _LIBCPP_HIDE_FROM_ABI +bool +atomic_flag_test_and_set_explicit(atomic_flag* __o, memory_order __m) _NOEXCEPT +{ + return __o->test_and_set(__m); +} + +inline _LIBCPP_HIDE_FROM_ABI +void +atomic_flag_clear(volatile atomic_flag* __o) _NOEXCEPT +{ + __o->clear(); +} + +inline _LIBCPP_HIDE_FROM_ABI +void +atomic_flag_clear(atomic_flag* __o) _NOEXCEPT +{ + __o->clear(); +} + +inline _LIBCPP_HIDE_FROM_ABI +void +atomic_flag_clear_explicit(volatile atomic_flag* __o, memory_order __m) _NOEXCEPT +{ + __o->clear(__m); +} + +inline _LIBCPP_HIDE_FROM_ABI +void +atomic_flag_clear_explicit(atomic_flag* __o, memory_order __m) _NOEXCEPT +{ + __o->clear(__m); +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC +void +atomic_flag_wait(const volatile atomic_flag* __o, bool __v) _NOEXCEPT +{ + __o->wait(__v); +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC +void +atomic_flag_wait(const atomic_flag* __o, bool __v) _NOEXCEPT +{ + __o->wait(__v); +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC +void +atomic_flag_wait_explicit(const volatile atomic_flag* __o, + bool __v, memory_order __m) _NOEXCEPT +{ + __o->wait(__v, __m); +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC +void +atomic_flag_wait_explicit(const atomic_flag* __o, + bool __v, memory_order __m) _NOEXCEPT +{ + __o->wait(__v, __m); +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC +void +atomic_flag_notify_one(volatile atomic_flag* __o) _NOEXCEPT +{ + __o->notify_one(); +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC +void +atomic_flag_notify_one(atomic_flag* __o) _NOEXCEPT +{ + __o->notify_one(); +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC +void +atomic_flag_notify_all(volatile atomic_flag* __o) _NOEXCEPT +{ + __o->notify_all(); +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_SYNC +void +atomic_flag_notify_all(atomic_flag* __o) _NOEXCEPT +{ + __o->notify_all(); +} + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___ATOMIC_ATOMIC_FLAG_H
diff --git a/third_party/llvm-project/libcxx/include/__atomic/atomic_init.h b/third_party/llvm-project/libcxx/include/__atomic/atomic_init.h new file mode 100644 index 0000000..14310ae --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__atomic/atomic_init.h
@@ -0,0 +1,27 @@ +//===----------------------------------------------------------------------===// +// +// 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___ATOMIC_ATOMIC_INIT_H +#define _LIBCPP___ATOMIC_ATOMIC_INIT_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#define ATOMIC_FLAG_INIT {false} +#define ATOMIC_VAR_INIT(__v) {__v} + +#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) +# if defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 1400 +# pragma clang deprecated(ATOMIC_VAR_INIT) +# endif +#endif // _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) + +#endif // _LIBCPP___ATOMIC_ATOMIC_INIT_H
diff --git a/third_party/llvm-project/libcxx/include/__atomic/atomic_lock_free.h b/third_party/llvm-project/libcxx/include/__atomic/atomic_lock_free.h new file mode 100644 index 0000000..d607569 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__atomic/atomic_lock_free.h
@@ -0,0 +1,48 @@ +//===----------------------------------------------------------------------===// +// +// 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___ATOMIC_ATOMIC_LOCK_FREE_H +#define _LIBCPP___ATOMIC_ATOMIC_LOCK_FREE_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#if defined(__CLANG_ATOMIC_BOOL_LOCK_FREE) +# define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE +# define ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE +#ifndef _LIBCPP_HAS_NO_CHAR8_T +# define ATOMIC_CHAR8_T_LOCK_FREE __CLANG_ATOMIC_CHAR8_T_LOCK_FREE +#endif +# define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE +# define ATOMIC_CHAR32_T_LOCK_FREE __CLANG_ATOMIC_CHAR32_T_LOCK_FREE +# define ATOMIC_WCHAR_T_LOCK_FREE __CLANG_ATOMIC_WCHAR_T_LOCK_FREE +# define ATOMIC_SHORT_LOCK_FREE __CLANG_ATOMIC_SHORT_LOCK_FREE +# define ATOMIC_INT_LOCK_FREE __CLANG_ATOMIC_INT_LOCK_FREE +# define ATOMIC_LONG_LOCK_FREE __CLANG_ATOMIC_LONG_LOCK_FREE +# define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE +# define ATOMIC_POINTER_LOCK_FREE __CLANG_ATOMIC_POINTER_LOCK_FREE +#elif defined(__GCC_ATOMIC_BOOL_LOCK_FREE) +# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE +# define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE +#ifndef _LIBCPP_HAS_NO_CHAR8_T +# define ATOMIC_CHAR8_T_LOCK_FREE __GCC_ATOMIC_CHAR8_T_LOCK_FREE +#endif +# define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE +# define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE +# define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE +# define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE +# define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE +# define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE +# define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE +# define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE +#endif + +#endif // _LIBCPP___ATOMIC_ATOMIC_LOCK_FREE_H
diff --git a/third_party/llvm-project/libcxx/include/__atomic/atomic_sync.h b/third_party/llvm-project/libcxx/include/__atomic/atomic_sync.h new file mode 100644 index 0000000..d55450b --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__atomic/atomic_sync.h
@@ -0,0 +1,112 @@ +//===----------------------------------------------------------------------===// +// +// 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___ATOMIC_ATOMIC_SYNC_H +#define _LIBCPP___ATOMIC_ATOMIC_SYNC_H + +#include <__atomic/contention_t.h> +#include <__atomic/cxx_atomic_impl.h> +#include <__atomic/memory_order.h> +#include <__availability> +#include <__chrono/duration.h> +#include <__config> +#include <__memory/addressof.h> +#include <__thread/poll_with_backoff.h> +#include <__threading_support> +#include <__type_traits/decay.h> +#include <cstring> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#ifndef _LIBCPP_HAS_NO_THREADS + +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(void const volatile*); +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(void const volatile*); +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_atomic_monitor(void const volatile*); +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __libcpp_atomic_wait(void const volatile*, __cxx_contention_t); + +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(__cxx_atomic_contention_t const volatile*); +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile*); +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile*); +_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __libcpp_atomic_wait(__cxx_atomic_contention_t const volatile*, __cxx_contention_t); + +template <class _Atp, class _Fn> +struct __libcpp_atomic_wait_backoff_impl { + _Atp* __a; + _Fn __test_fn; + _LIBCPP_AVAILABILITY_SYNC + _LIBCPP_HIDE_FROM_ABI bool operator()(chrono::nanoseconds __elapsed) const + { + if(__elapsed > chrono::microseconds(64)) + { + auto const __monitor = std::__libcpp_atomic_monitor(__a); + if(__test_fn()) + return true; + std::__libcpp_atomic_wait(__a, __monitor); + } + else if(__elapsed > chrono::microseconds(4)) + __libcpp_thread_yield(); + else + {} // poll + return false; + } +}; + +template <class _Atp, class _Fn> +_LIBCPP_AVAILABILITY_SYNC +_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_wait(_Atp* __a, _Fn && __test_fn) +{ + __libcpp_atomic_wait_backoff_impl<_Atp, __decay_t<_Fn> > __backoff_fn = {__a, __test_fn}; + return std::__libcpp_thread_poll_with_backoff(__test_fn, __backoff_fn); +} + +#else // _LIBCPP_HAS_NO_THREADS + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_notify_all(__cxx_atomic_impl<_Tp> const volatile*) { } +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI void __cxx_atomic_notify_one(__cxx_atomic_impl<_Tp> const volatile*) { } +template <class _Atp, class _Fn> +_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_wait(_Atp*, _Fn && __test_fn) +{ + return std::__libcpp_thread_poll_with_backoff(__test_fn, __spinning_backoff_policy()); +} + +#endif // _LIBCPP_HAS_NO_THREADS + +template <typename _Tp> _LIBCPP_HIDE_FROM_ABI +bool __cxx_nonatomic_compare_equal(_Tp const& __lhs, _Tp const& __rhs) { + return std::memcmp(std::addressof(__lhs), std::addressof(__rhs), sizeof(_Tp)) == 0; +} + +template <class _Atp, class _Tp> +struct __cxx_atomic_wait_test_fn_impl { + _Atp* __a; + _Tp __val; + memory_order __order; + _LIBCPP_HIDE_FROM_ABI bool operator()() const + { + return !std::__cxx_nonatomic_compare_equal(std::__cxx_atomic_load(__a, __order), __val); + } +}; + +template <class _Atp, class _Tp> +_LIBCPP_AVAILABILITY_SYNC +_LIBCPP_HIDE_FROM_ABI bool __cxx_atomic_wait(_Atp* __a, _Tp const __val, memory_order __order) +{ + __cxx_atomic_wait_test_fn_impl<_Atp, _Tp> __test_fn = {__a, __val, __order}; + return std::__cxx_atomic_wait(__a, __test_fn); +} + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___ATOMIC_ATOMIC_SYNC_H
diff --git a/third_party/llvm-project/libcxx/include/__atomic/check_memory_order.h b/third_party/llvm-project/libcxx/include/__atomic/check_memory_order.h new file mode 100644 index 0000000..d744312 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__atomic/check_memory_order.h
@@ -0,0 +1,34 @@ +//===----------------------------------------------------------------------===// +// +// 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___ATOMIC_CHECK_MEMORY_ORDER_H +#define _LIBCPP___ATOMIC_CHECK_MEMORY_ORDER_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) \ + _LIBCPP_DIAGNOSE_WARNING(__m == memory_order_consume || \ + __m == memory_order_acquire || \ + __m == memory_order_acq_rel, \ + "memory order argument to atomic operation is invalid") + +#define _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) \ + _LIBCPP_DIAGNOSE_WARNING(__m == memory_order_release || \ + __m == memory_order_acq_rel, \ + "memory order argument to atomic operation is invalid") + +#define _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__m, __f) \ + _LIBCPP_DIAGNOSE_WARNING(__f == memory_order_release || \ + __f == memory_order_acq_rel, \ + "memory order argument to atomic operation is invalid") + +#endif // _LIBCPP___ATOMIC_CHECK_MEMORY_ORDER_H
diff --git a/third_party/llvm-project/libcxx/include/__atomic/contention_t.h b/third_party/llvm-project/libcxx/include/__atomic/contention_t.h new file mode 100644 index 0000000..1d8d024 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__atomic/contention_t.h
@@ -0,0 +1,32 @@ +//===----------------------------------------------------------------------===// +// +// 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___ATOMIC_CONTENTION_T_H +#define _LIBCPP___ATOMIC_CONTENTION_T_H + +#include <__atomic/cxx_atomic_impl.h> +#include <__config> +#include <cstdint> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if defined(__linux__) || (defined(_AIX) && !defined(__64BIT__)) + using __cxx_contention_t = int32_t; +#else + using __cxx_contention_t = int64_t; +#endif // __linux__ || (_AIX && !__64BIT__) + +using __cxx_atomic_contention_t = __cxx_atomic_impl<__cxx_contention_t>; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___ATOMIC_CONTENTION_T_H
diff --git a/third_party/llvm-project/libcxx/include/__atomic/cxx_atomic_impl.h b/third_party/llvm-project/libcxx/include/__atomic/cxx_atomic_impl.h new file mode 100644 index 0000000..167cee7 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__atomic/cxx_atomic_impl.h
@@ -0,0 +1,831 @@ +//===----------------------------------------------------------------------===// +// +// 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___ATOMIC_CXX_ATOMIC_IMPL_H +#define _LIBCPP___ATOMIC_CXX_ATOMIC_IMPL_H + +#include <__atomic/is_always_lock_free.h> +#include <__atomic/memory_order.h> +#include <__config> +#include <__memory/addressof.h> +#include <__type_traits/conditional.h> +#include <__type_traits/is_assignable.h> +#include <__type_traits/is_trivially_copyable.h> +#include <__type_traits/remove_const.h> +#include <cstddef> +#include <cstring> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) || \ + defined(_LIBCPP_ATOMIC_ONLY_USE_BUILTINS) + +// [atomics.types.generic]p1 guarantees _Tp is trivially copyable. Because +// the default operator= in an object is not volatile, a byte-by-byte copy +// is required. +template <typename _Tp, typename _Tv> _LIBCPP_HIDE_FROM_ABI +typename enable_if<is_assignable<_Tp&, _Tv>::value>::type +__cxx_atomic_assign_volatile(_Tp& __a_value, _Tv const& __val) { + __a_value = __val; +} +template <typename _Tp, typename _Tv> _LIBCPP_HIDE_FROM_ABI +typename enable_if<is_assignable<_Tp&, _Tv>::value>::type +__cxx_atomic_assign_volatile(_Tp volatile& __a_value, _Tv volatile const& __val) { + volatile char* __to = reinterpret_cast<volatile char*>(std::addressof(__a_value)); + volatile char* __end = __to + sizeof(_Tp); + volatile const char* __from = reinterpret_cast<volatile const char*>(std::addressof(__val)); + while (__to != __end) + *__to++ = *__from++; +} + +#endif + +#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) + +template <typename _Tp> +struct __cxx_atomic_base_impl { + + _LIBCPP_HIDE_FROM_ABI +#ifndef _LIBCPP_CXX03_LANG + __cxx_atomic_base_impl() _NOEXCEPT = default; +#else + __cxx_atomic_base_impl() _NOEXCEPT : __a_value() {} +#endif // _LIBCPP_CXX03_LANG + _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp value) _NOEXCEPT + : __a_value(value) {} + _Tp __a_value; +}; + +_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR int __to_gcc_order(memory_order __order) { + // Avoid switch statement to make this a constexpr. + return __order == memory_order_relaxed ? __ATOMIC_RELAXED: + (__order == memory_order_acquire ? __ATOMIC_ACQUIRE: + (__order == memory_order_release ? __ATOMIC_RELEASE: + (__order == memory_order_seq_cst ? __ATOMIC_SEQ_CST: + (__order == memory_order_acq_rel ? __ATOMIC_ACQ_REL: + __ATOMIC_CONSUME)))); +} + +_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR int __to_gcc_failure_order(memory_order __order) { + // Avoid switch statement to make this a constexpr. + return __order == memory_order_relaxed ? __ATOMIC_RELAXED: + (__order == memory_order_acquire ? __ATOMIC_ACQUIRE: + (__order == memory_order_release ? __ATOMIC_RELAXED: + (__order == memory_order_seq_cst ? __ATOMIC_SEQ_CST: + (__order == memory_order_acq_rel ? __ATOMIC_ACQUIRE: + __ATOMIC_CONSUME)))); +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +void __cxx_atomic_init(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __val) { + __cxx_atomic_assign_volatile(__a->__a_value, __val); +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp>* __a, _Tp __val) { + __a->__a_value = __val; +} + +_LIBCPP_HIDE_FROM_ABI inline +void __cxx_atomic_thread_fence(memory_order __order) { + __atomic_thread_fence(__to_gcc_order(__order)); +} + +_LIBCPP_HIDE_FROM_ABI inline +void __cxx_atomic_signal_fence(memory_order __order) { + __atomic_signal_fence(__to_gcc_order(__order)); +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +void __cxx_atomic_store(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __val, + memory_order __order) { + __atomic_store(std::addressof(__a->__a_value), std::addressof(__val), __to_gcc_order(__order)); +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp>* __a, _Tp __val, + memory_order __order) { + __atomic_store(std::addressof(__a->__a_value), std::addressof(__val), __to_gcc_order(__order)); +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_load(const volatile __cxx_atomic_base_impl<_Tp>* __a, + memory_order __order) { + _Tp __ret; + __atomic_load(std::addressof(__a->__a_value), std::addressof(__ret), __to_gcc_order(__order)); + return __ret; +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_load(const __cxx_atomic_base_impl<_Tp>* __a, memory_order __order) { + _Tp __ret; + __atomic_load(std::addressof(__a->__a_value), std::addressof(__ret), __to_gcc_order(__order)); + return __ret; +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_exchange(volatile __cxx_atomic_base_impl<_Tp>* __a, + _Tp __value, memory_order __order) { + _Tp __ret; + __atomic_exchange( + std::addressof(__a->__a_value), std::addressof(__value), std::addressof(__ret), __to_gcc_order(__order)); + return __ret; +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp>* __a, _Tp __value, + memory_order __order) { + _Tp __ret; + __atomic_exchange( + std::addressof(__a->__a_value), std::addressof(__value), std::addressof(__ret), __to_gcc_order(__order)); + return __ret; +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +bool __cxx_atomic_compare_exchange_strong( + volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, + memory_order __success, memory_order __failure) { + return __atomic_compare_exchange( + std::addressof(__a->__a_value), + __expected, + std::addressof(__value), + false, + __to_gcc_order(__success), + __to_gcc_failure_order(__failure)); +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +bool __cxx_atomic_compare_exchange_strong( + __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order __success, + memory_order __failure) { + return __atomic_compare_exchange( + std::addressof(__a->__a_value), + __expected, + std::addressof(__value), + false, + __to_gcc_order(__success), + __to_gcc_failure_order(__failure)); +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +bool __cxx_atomic_compare_exchange_weak( + volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, + memory_order __success, memory_order __failure) { + return __atomic_compare_exchange( + std::addressof(__a->__a_value), + __expected, + std::addressof(__value), + true, + __to_gcc_order(__success), + __to_gcc_failure_order(__failure)); +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +bool __cxx_atomic_compare_exchange_weak( + __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order __success, + memory_order __failure) { + return __atomic_compare_exchange( + std::addressof(__a->__a_value), + __expected, + std::addressof(__value), + true, + __to_gcc_order(__success), + __to_gcc_failure_order(__failure)); +} + +template <typename _Tp> +struct __skip_amt { enum {value = 1}; }; + +template <typename _Tp> +struct __skip_amt<_Tp*> { enum {value = sizeof(_Tp)}; }; + +// FIXME: Haven't figured out what the spec says about using arrays with +// atomic_fetch_add. Force a failure rather than creating bad behavior. +template <typename _Tp> +struct __skip_amt<_Tp[]> { }; +template <typename _Tp, int n> +struct __skip_amt<_Tp[n]> { }; + +template <typename _Tp, typename _Td> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_add(volatile __cxx_atomic_base_impl<_Tp>* __a, + _Td __delta, memory_order __order) { + return __atomic_fetch_add(std::addressof(__a->__a_value), __delta * __skip_amt<_Tp>::value, __to_gcc_order(__order)); +} + +template <typename _Tp, typename _Td> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp>* __a, _Td __delta, + memory_order __order) { + return __atomic_fetch_add(std::addressof(__a->__a_value), __delta * __skip_amt<_Tp>::value, __to_gcc_order(__order)); +} + +template <typename _Tp, typename _Td> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_sub(volatile __cxx_atomic_base_impl<_Tp>* __a, + _Td __delta, memory_order __order) { + return __atomic_fetch_sub(std::addressof(__a->__a_value), __delta * __skip_amt<_Tp>::value, __to_gcc_order(__order)); +} + +template <typename _Tp, typename _Td> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp>* __a, _Td __delta, + memory_order __order) { + return __atomic_fetch_sub(std::addressof(__a->__a_value), __delta * __skip_amt<_Tp>::value, __to_gcc_order(__order)); +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_and(volatile __cxx_atomic_base_impl<_Tp>* __a, + _Tp __pattern, memory_order __order) { + return __atomic_fetch_and(std::addressof(__a->__a_value), __pattern, __to_gcc_order(__order)); +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp>* __a, + _Tp __pattern, memory_order __order) { + return __atomic_fetch_and(std::addressof(__a->__a_value), __pattern, __to_gcc_order(__order)); +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_or(volatile __cxx_atomic_base_impl<_Tp>* __a, + _Tp __pattern, memory_order __order) { + return __atomic_fetch_or(std::addressof(__a->__a_value), __pattern, __to_gcc_order(__order)); +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, + memory_order __order) { + return __atomic_fetch_or(std::addressof(__a->__a_value), __pattern, __to_gcc_order(__order)); +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_xor(volatile __cxx_atomic_base_impl<_Tp>* __a, + _Tp __pattern, memory_order __order) { + return __atomic_fetch_xor(std::addressof(__a->__a_value), __pattern, __to_gcc_order(__order)); +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, + memory_order __order) { + return __atomic_fetch_xor(std::addressof(__a->__a_value), __pattern, __to_gcc_order(__order)); +} + +#define __cxx_atomic_is_lock_free(__s) __atomic_is_lock_free(__s, 0) + +#elif defined(_LIBCPP_HAS_C_ATOMIC_IMP) + +template <typename _Tp> +struct __cxx_atomic_base_impl { + + _LIBCPP_HIDE_FROM_ABI +#ifndef _LIBCPP_CXX03_LANG + __cxx_atomic_base_impl() _NOEXCEPT = default; +#else + __cxx_atomic_base_impl() _NOEXCEPT : __a_value() {} +#endif // _LIBCPP_CXX03_LANG + _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp __value) _NOEXCEPT + : __a_value(__value) {} + _LIBCPP_DISABLE_EXTENSION_WARNING _Atomic(_Tp) __a_value; +}; + +#define __cxx_atomic_is_lock_free(__s) __c11_atomic_is_lock_free(__s) + +_LIBCPP_HIDE_FROM_ABI inline +void __cxx_atomic_thread_fence(memory_order __order) _NOEXCEPT { + __c11_atomic_thread_fence(static_cast<__memory_order_underlying_t>(__order)); +} + +_LIBCPP_HIDE_FROM_ABI inline +void __cxx_atomic_signal_fence(memory_order __order) _NOEXCEPT { + __c11_atomic_signal_fence(static_cast<__memory_order_underlying_t>(__order)); +} + +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __val) _NOEXCEPT { + __c11_atomic_init(std::addressof(__a->__a_value), __val); +} +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp> * __a, _Tp __val) _NOEXCEPT { + __c11_atomic_init(std::addressof(__a->__a_value), __val); +} + +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __val, memory_order __order) _NOEXCEPT { + __c11_atomic_store(std::addressof(__a->__a_value), __val, static_cast<__memory_order_underlying_t>(__order)); +} +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp> * __a, _Tp __val, memory_order __order) _NOEXCEPT { + __c11_atomic_store(std::addressof(__a->__a_value), __val, static_cast<__memory_order_underlying_t>(__order)); +} + +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const volatile* __a, memory_order __order) _NOEXCEPT { + using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*; + return __c11_atomic_load( + const_cast<__ptr_type>(std::addressof(__a->__a_value)), static_cast<__memory_order_underlying_t>(__order)); +} +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const* __a, memory_order __order) _NOEXCEPT { + using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*; + return __c11_atomic_load( + const_cast<__ptr_type>(std::addressof(__a->__a_value)), static_cast<__memory_order_underlying_t>(__order)); +} + +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __value, memory_order __order) _NOEXCEPT { + return __c11_atomic_exchange( + std::addressof(__a->__a_value), __value, static_cast<__memory_order_underlying_t>(__order)); +} +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp> * __a, _Tp __value, memory_order __order) _NOEXCEPT { + return __c11_atomic_exchange( + std::addressof(__a->__a_value), __value, static_cast<__memory_order_underlying_t>(__order)); +} + +_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR memory_order __to_failure_order(memory_order __order) { + // Avoid switch statement to make this a constexpr. + return __order == memory_order_release ? memory_order_relaxed: + (__order == memory_order_acq_rel ? memory_order_acquire: + __order); +} + +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT { + return __c11_atomic_compare_exchange_strong( + std::addressof(__a->__a_value), + __expected, + __value, + static_cast<__memory_order_underlying_t>(__success), + static_cast<__memory_order_underlying_t>(__to_failure_order(__failure))); +} +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_base_impl<_Tp> * __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT { + return __c11_atomic_compare_exchange_strong( + std::addressof(__a->__a_value), + __expected, + __value, + static_cast<__memory_order_underlying_t>(__success), + static_cast<__memory_order_underlying_t>(__to_failure_order(__failure))); +} + +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT { + return __c11_atomic_compare_exchange_weak( + std::addressof(__a->__a_value), + __expected, + __value, + static_cast<__memory_order_underlying_t>(__success), + static_cast<__memory_order_underlying_t>(__to_failure_order(__failure))); +} +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_base_impl<_Tp> * __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT { + return __c11_atomic_compare_exchange_weak( + std::addressof(__a->__a_value), + __expected, + __value, + static_cast<__memory_order_underlying_t>(__success), + static_cast<__memory_order_underlying_t>(__to_failure_order(__failure))); +} + +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __delta, memory_order __order) _NOEXCEPT { + return __c11_atomic_fetch_add( + std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order)); +} +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp> * __a, _Tp __delta, memory_order __order) _NOEXCEPT { + return __c11_atomic_fetch_add( + std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order)); +} + +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp* __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT { + return __c11_atomic_fetch_add( + std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order)); +} +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp* __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> * __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT { + return __c11_atomic_fetch_add( + std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order)); +} + +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __delta, memory_order __order) _NOEXCEPT { + return __c11_atomic_fetch_sub( + std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order)); +} +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp> * __a, _Tp __delta, memory_order __order) _NOEXCEPT { + return __c11_atomic_fetch_sub( + std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order)); +} +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp* __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT { + return __c11_atomic_fetch_sub( + std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order)); +} +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp* __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> * __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT { + return __c11_atomic_fetch_sub( + std::addressof(__a->__a_value), __delta, static_cast<__memory_order_underlying_t>(__order)); +} + +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT { + return __c11_atomic_fetch_and( + std::addressof(__a->__a_value), __pattern, static_cast<__memory_order_underlying_t>(__order)); +} +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) _NOEXCEPT { + return __c11_atomic_fetch_and( + std::addressof(__a->__a_value), __pattern, static_cast<__memory_order_underlying_t>(__order)); +} + +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT { + return __c11_atomic_fetch_or( + std::addressof(__a->__a_value), __pattern, static_cast<__memory_order_underlying_t>(__order)); +} +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) _NOEXCEPT { + return __c11_atomic_fetch_or( + std::addressof(__a->__a_value), __pattern, static_cast<__memory_order_underlying_t>(__order)); +} + +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT { + return __c11_atomic_fetch_xor( + std::addressof(__a->__a_value), __pattern, static_cast<__memory_order_underlying_t>(__order)); +} +template<class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) _NOEXCEPT { + return __c11_atomic_fetch_xor( + std::addressof(__a->__a_value), __pattern, static_cast<__memory_order_underlying_t>(__order)); +} + +#endif // _LIBCPP_HAS_GCC_ATOMIC_IMP, _LIBCPP_HAS_C_ATOMIC_IMP + +#ifdef _LIBCPP_ATOMIC_ONLY_USE_BUILTINS + +template<typename _Tp> +struct __cxx_atomic_lock_impl { + + _LIBCPP_HIDE_FROM_ABI + __cxx_atomic_lock_impl() _NOEXCEPT + : __a_value(), __a_lock(0) {} + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit + __cxx_atomic_lock_impl(_Tp value) _NOEXCEPT + : __a_value(value), __a_lock(0) {} + + _Tp __a_value; + mutable __cxx_atomic_base_impl<_LIBCPP_ATOMIC_FLAG_TYPE> __a_lock; + + _LIBCPP_HIDE_FROM_ABI void __lock() const volatile { + while(1 == __cxx_atomic_exchange(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(true), memory_order_acquire)) + /*spin*/; + } + _LIBCPP_HIDE_FROM_ABI void __lock() const { + while(1 == __cxx_atomic_exchange(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(true), memory_order_acquire)) + /*spin*/; + } + _LIBCPP_HIDE_FROM_ABI void __unlock() const volatile { + __cxx_atomic_store(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(false), memory_order_release); + } + _LIBCPP_HIDE_FROM_ABI void __unlock() const { + __cxx_atomic_store(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(false), memory_order_release); + } + _LIBCPP_HIDE_FROM_ABI _Tp __read() const volatile { + __lock(); + _Tp __old; + __cxx_atomic_assign_volatile(__old, __a_value); + __unlock(); + return __old; + } + _LIBCPP_HIDE_FROM_ABI _Tp __read() const { + __lock(); + _Tp __old = __a_value; + __unlock(); + return __old; + } +}; + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +void __cxx_atomic_init(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __val) { + __cxx_atomic_assign_volatile(__a->__a_value, __val); +} +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +void __cxx_atomic_init(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __val) { + __a->__a_value = __val; +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +void __cxx_atomic_store(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __val, memory_order) { + __a->__lock(); + __cxx_atomic_assign_volatile(__a->__a_value, __val); + __a->__unlock(); +} +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +void __cxx_atomic_store(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __val, memory_order) { + __a->__lock(); + __a->__a_value = __val; + __a->__unlock(); +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_load(const volatile __cxx_atomic_lock_impl<_Tp>* __a, memory_order) { + return __a->__read(); +} +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_load(const __cxx_atomic_lock_impl<_Tp>* __a, memory_order) { + return __a->__read(); +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_exchange(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __value, memory_order) { + __a->__lock(); + _Tp __old; + __cxx_atomic_assign_volatile(__old, __a->__a_value); + __cxx_atomic_assign_volatile(__a->__a_value, __value); + __a->__unlock(); + return __old; +} +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_exchange(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __value, memory_order) { + __a->__lock(); + _Tp __old = __a->__a_value; + __a->__a_value = __value; + __a->__unlock(); + return __old; +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +bool __cxx_atomic_compare_exchange_strong(volatile __cxx_atomic_lock_impl<_Tp>* __a, + _Tp* __expected, _Tp __value, memory_order, memory_order) { + _Tp __temp; + __a->__lock(); + __cxx_atomic_assign_volatile(__temp, __a->__a_value); + bool __ret = (std::memcmp(&__temp, __expected, sizeof(_Tp)) == 0); + if(__ret) + __cxx_atomic_assign_volatile(__a->__a_value, __value); + else + __cxx_atomic_assign_volatile(*__expected, __a->__a_value); + __a->__unlock(); + return __ret; +} +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_lock_impl<_Tp>* __a, + _Tp* __expected, _Tp __value, memory_order, memory_order) { + __a->__lock(); + bool __ret = (std::memcmp(&__a->__a_value, __expected, sizeof(_Tp)) == 0); + if(__ret) + std::memcpy(&__a->__a_value, &__value, sizeof(_Tp)); + else + std::memcpy(__expected, &__a->__a_value, sizeof(_Tp)); + __a->__unlock(); + return __ret; +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +bool __cxx_atomic_compare_exchange_weak(volatile __cxx_atomic_lock_impl<_Tp>* __a, + _Tp* __expected, _Tp __value, memory_order, memory_order) { + _Tp __temp; + __a->__lock(); + __cxx_atomic_assign_volatile(__temp, __a->__a_value); + bool __ret = (std::memcmp(&__temp, __expected, sizeof(_Tp)) == 0); + if(__ret) + __cxx_atomic_assign_volatile(__a->__a_value, __value); + else + __cxx_atomic_assign_volatile(*__expected, __a->__a_value); + __a->__unlock(); + return __ret; +} +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_lock_impl<_Tp>* __a, + _Tp* __expected, _Tp __value, memory_order, memory_order) { + __a->__lock(); + bool __ret = (std::memcmp(&__a->__a_value, __expected, sizeof(_Tp)) == 0); + if(__ret) + std::memcpy(&__a->__a_value, &__value, sizeof(_Tp)); + else + std::memcpy(__expected, &__a->__a_value, sizeof(_Tp)); + __a->__unlock(); + return __ret; +} + +template <typename _Tp, typename _Td> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp>* __a, + _Td __delta, memory_order) { + __a->__lock(); + _Tp __old; + __cxx_atomic_assign_volatile(__old, __a->__a_value); + __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old + __delta)); + __a->__unlock(); + return __old; +} +template <typename _Tp, typename _Td> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp>* __a, + _Td __delta, memory_order) { + __a->__lock(); + _Tp __old = __a->__a_value; + __a->__a_value += __delta; + __a->__unlock(); + return __old; +} + +template <typename _Tp, typename _Td> +_LIBCPP_HIDE_FROM_ABI +_Tp* __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp*>* __a, + ptrdiff_t __delta, memory_order) { + __a->__lock(); + _Tp* __old; + __cxx_atomic_assign_volatile(__old, __a->__a_value); + __cxx_atomic_assign_volatile(__a->__a_value, __old + __delta); + __a->__unlock(); + return __old; +} +template <typename _Tp, typename _Td> +_LIBCPP_HIDE_FROM_ABI +_Tp* __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp*>* __a, + ptrdiff_t __delta, memory_order) { + __a->__lock(); + _Tp* __old = __a->__a_value; + __a->__a_value += __delta; + __a->__unlock(); + return __old; +} + +template <typename _Tp, typename _Td> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_sub(volatile __cxx_atomic_lock_impl<_Tp>* __a, + _Td __delta, memory_order) { + __a->__lock(); + _Tp __old; + __cxx_atomic_assign_volatile(__old, __a->__a_value); + __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old - __delta)); + __a->__unlock(); + return __old; +} +template <typename _Tp, typename _Td> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_sub(__cxx_atomic_lock_impl<_Tp>* __a, + _Td __delta, memory_order) { + __a->__lock(); + _Tp __old = __a->__a_value; + __a->__a_value -= __delta; + __a->__unlock(); + return __old; +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_and(volatile __cxx_atomic_lock_impl<_Tp>* __a, + _Tp __pattern, memory_order) { + __a->__lock(); + _Tp __old; + __cxx_atomic_assign_volatile(__old, __a->__a_value); + __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old & __pattern)); + __a->__unlock(); + return __old; +} +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_and(__cxx_atomic_lock_impl<_Tp>* __a, + _Tp __pattern, memory_order) { + __a->__lock(); + _Tp __old = __a->__a_value; + __a->__a_value &= __pattern; + __a->__unlock(); + return __old; +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_or(volatile __cxx_atomic_lock_impl<_Tp>* __a, + _Tp __pattern, memory_order) { + __a->__lock(); + _Tp __old; + __cxx_atomic_assign_volatile(__old, __a->__a_value); + __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old | __pattern)); + __a->__unlock(); + return __old; +} +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_or(__cxx_atomic_lock_impl<_Tp>* __a, + _Tp __pattern, memory_order) { + __a->__lock(); + _Tp __old = __a->__a_value; + __a->__a_value |= __pattern; + __a->__unlock(); + return __old; +} + +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_xor(volatile __cxx_atomic_lock_impl<_Tp>* __a, + _Tp __pattern, memory_order) { + __a->__lock(); + _Tp __old; + __cxx_atomic_assign_volatile(__old, __a->__a_value); + __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old ^ __pattern)); + __a->__unlock(); + return __old; +} +template <typename _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp __cxx_atomic_fetch_xor(__cxx_atomic_lock_impl<_Tp>* __a, + _Tp __pattern, memory_order) { + __a->__lock(); + _Tp __old = __a->__a_value; + __a->__a_value ^= __pattern; + __a->__unlock(); + return __old; +} + +template <typename _Tp, + typename _Base = typename conditional<__libcpp_is_always_lock_free<_Tp>::__value, + __cxx_atomic_base_impl<_Tp>, + __cxx_atomic_lock_impl<_Tp> >::type> +#else +template <typename _Tp, + typename _Base = __cxx_atomic_base_impl<_Tp> > +#endif //_LIBCPP_ATOMIC_ONLY_USE_BUILTINS +struct __cxx_atomic_impl : public _Base { + static_assert(is_trivially_copyable<_Tp>::value, + "std::atomic<T> requires that 'T' be a trivially copyable type"); + + _LIBCPP_HIDE_FROM_ABI __cxx_atomic_impl() _NOEXCEPT = default; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __cxx_atomic_impl(_Tp __value) _NOEXCEPT + : _Base(__value) {} +}; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___ATOMIC_CXX_ATOMIC_IMPL_H
diff --git a/third_party/llvm-project/libcxx/include/__atomic/fence.h b/third_party/llvm-project/libcxx/include/__atomic/fence.h new file mode 100644 index 0000000..c62f38f --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__atomic/fence.h
@@ -0,0 +1,38 @@ +//===----------------------------------------------------------------------===// +// +// 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___ATOMIC_FENCE_H +#define _LIBCPP___ATOMIC_FENCE_H + +#include <__atomic/cxx_atomic_impl.h> +#include <__atomic/memory_order.h> +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +inline _LIBCPP_HIDE_FROM_ABI +void +atomic_thread_fence(memory_order __m) _NOEXCEPT +{ + __cxx_atomic_thread_fence(__m); +} + +inline _LIBCPP_HIDE_FROM_ABI +void +atomic_signal_fence(memory_order __m) _NOEXCEPT +{ + __cxx_atomic_signal_fence(__m); +} + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___ATOMIC_FENCE_H
diff --git a/third_party/llvm-project/libcxx/include/__atomic/is_always_lock_free.h b/third_party/llvm-project/libcxx/include/__atomic/is_always_lock_free.h new file mode 100644 index 0000000..fbbd437 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__atomic/is_always_lock_free.h
@@ -0,0 +1,28 @@ +//===----------------------------------------------------------------------===// +// +// 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___ATOMIC_IS_ALWAYS_LOCK_FREE_H +#define _LIBCPP___ATOMIC_IS_ALWAYS_LOCK_FREE_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> +struct __libcpp_is_always_lock_free { + // __atomic_always_lock_free is available in all Standard modes + static const bool __value = __atomic_always_lock_free(sizeof(_Tp), 0); +}; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___ATOMIC_IS_ALWAYS_LOCK_FREE_H
diff --git a/third_party/llvm-project/libcxx/include/__atomic/kill_dependency.h b/third_party/llvm-project/libcxx/include/__atomic/kill_dependency.h new file mode 100644 index 0000000..1bd5c8c --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__atomic/kill_dependency.h
@@ -0,0 +1,29 @@ +//===----------------------------------------------------------------------===// +// +// 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___ATOMIC_KILL_DEPENDENCY_H +#define _LIBCPP___ATOMIC_KILL_DEPENDENCY_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> +_LIBCPP_HIDE_FROM_ABI +_Tp kill_dependency(_Tp __y) _NOEXCEPT +{ + return __y; +} + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___ATOMIC_KILL_DEPENDENCY_H
diff --git a/third_party/llvm-project/libcxx/include/__atomic/memory_order.h b/third_party/llvm-project/libcxx/include/__atomic/memory_order.h new file mode 100644 index 0000000..3671dc3 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__atomic/memory_order.h
@@ -0,0 +1,72 @@ +//===----------------------------------------------------------------------===// +// +// 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___ATOMIC_MEMORY_ORDER_H +#define _LIBCPP___ATOMIC_MEMORY_ORDER_H + +#include <__config> +#include <__type_traits/is_same.h> +#include <__type_traits/underlying_type.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +// Figure out what the underlying type for `memory_order` would be if it were +// declared as an unscoped enum (accounting for -fshort-enums). Use this result +// to pin the underlying type in C++20. +enum __legacy_memory_order { + __mo_relaxed, + __mo_consume, + __mo_acquire, + __mo_release, + __mo_acq_rel, + __mo_seq_cst +}; + +using __memory_order_underlying_t = underlying_type<__legacy_memory_order>::type; + +#if _LIBCPP_STD_VER >= 20 + +enum class memory_order : __memory_order_underlying_t { + relaxed = __mo_relaxed, + consume = __mo_consume, + acquire = __mo_acquire, + release = __mo_release, + acq_rel = __mo_acq_rel, + seq_cst = __mo_seq_cst +}; + +static_assert((is_same<underlying_type<memory_order>::type, __memory_order_underlying_t>::value), + "unexpected underlying type for std::memory_order"); + +inline constexpr auto memory_order_relaxed = memory_order::relaxed; +inline constexpr auto memory_order_consume = memory_order::consume; +inline constexpr auto memory_order_acquire = memory_order::acquire; +inline constexpr auto memory_order_release = memory_order::release; +inline constexpr auto memory_order_acq_rel = memory_order::acq_rel; +inline constexpr auto memory_order_seq_cst = memory_order::seq_cst; + +#else + +enum memory_order { + memory_order_relaxed = __mo_relaxed, + memory_order_consume = __mo_consume, + memory_order_acquire = __mo_acquire, + memory_order_release = __mo_release, + memory_order_acq_rel = __mo_acq_rel, + memory_order_seq_cst = __mo_seq_cst, +}; + +#endif // _LIBCPP_STD_VER >= 20 + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___ATOMIC_MEMORY_ORDER_H
diff --git a/third_party/llvm-project/libcxx/include/__availability b/third_party/llvm-project/libcxx/include/__availability index 6dfca3f..3c4c5cc 100644 --- a/third_party/llvm-project/libcxx/include/__availability +++ b/third_party/llvm-project/libcxx/include/__availability
@@ -39,17 +39,23 @@ // // This mechanism is general in nature, and any vendor can add their markup to // the library (see below). Whenever a new feature is added that requires support -// in the shared library, a macro should be added below to mark this feature -// as unavailable. When vendors decide to ship the feature as part of their -// shared library, they can update the markup appropriately. +// in the shared library, two macros are added below to allow marking the feature +// as unavailable: +// 1. A macro named `_LIBCPP_AVAILABILITY_HAS_NO_<feature>` which must be defined +// exactly when compiling for a target that doesn't support the feature. +// 2. A macro named `_LIBCPP_AVAILABILITY_<feature>`, which must always be defined +// and must expand to the proper availability attribute for the platform. +// +// When vendors decide to ship the feature as part of their shared library, they +// can update these macros appropriately for their platform, and the library will +// use those to provide an optimal user experience. // // Furthermore, many features in the standard library have corresponding -// feature-test macros. When a feature is made unavailable on some deployment -// target, a macro should be defined to signal that it is unavailable. That -// macro can then be picked up when feature-test macros are generated (see -// generate_feature_test_macro_components.py) to make sure that feature-test -// macros don't announce a feature as being implemented if it has been marked -// as unavailable. +// feature-test macros. The `_LIBCPP_AVAILABILITY_HAS_NO_<feature>` macros +// are checked by the corresponding feature-test macros generated by +// generate_feature_test_macro_components.py to ensure that the library +// doesn't announce a feature as being implemented if it is unavailable on +// the deployment target. // // Note that this mechanism is disabled by default in the "upstream" libc++. // Availability annotations are only meaningful when shipping libc++ inside @@ -83,9 +89,8 @@ // This controls the availability of std::shared_mutex and std::shared_timed_mutex, // which were added to the dylib later. +// # define _LIBCPP_AVAILABILITY_HAS_NO_SHARED_MUTEX # define _LIBCPP_AVAILABILITY_SHARED_MUTEX -// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex -// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex // These macros control the availability of std::bad_optional_access and // other exception types. These were put in the shared library to prevent @@ -95,16 +100,23 @@ // Note that when exceptions are disabled, the methods that normally throw // these exceptions can be used even on older deployment targets, but those // methods will abort instead of throwing. +// # define _LIBCPP_AVAILABILITY_HAS_NO_BAD_OPTIONAL_ACCESS # define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS + +// # define _LIBCPP_AVAILABILITY_HAS_NO_BAD_VARIANT_ACCESS # define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS + +// # define _LIBCPP_AVAILABILITY_HAS_NO_BAD_ANY_CAST # define _LIBCPP_AVAILABILITY_BAD_ANY_CAST // This controls the availability of std::uncaught_exceptions(). +// # define _LIBCPP_AVAILABILITY_HAS_NO_UNCAUGHT_EXCEPTIONS # define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS // This controls the availability of the sized version of ::operator delete, // ::operator delete[], and their align_val_t variants, which were all added // in C++17, and hence not present in early dylibs. +// # define _LIBCPP_AVAILABILITY_HAS_NO_SIZED_NEW_DELETE # define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE // This controls the availability of the std::future_error exception. @@ -112,73 +124,78 @@ // Note that when exceptions are disabled, the methods that normally throw // std::future_error can be used even on older deployment targets, but those // methods will abort instead of throwing. +// # define _LIBCPP_AVAILABILITY_HAS_NO_FUTURE_ERROR # define _LIBCPP_AVAILABILITY_FUTURE_ERROR // This controls the availability of std::type_info's vtable. // I can't imagine how using std::type_info can work at all if // this isn't supported. +// # define _LIBCPP_AVAILABILITY_HAS_NO_TYPEINFO_VTABLE # define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE // This controls the availability of std::locale::category members // (e.g. std::locale::collate), which are defined in the dylib. +// # define _LIBCPP_AVAILABILITY_HAS_NO_LOCALE_CATEGORY # define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY // This controls the availability of atomic operations on std::shared_ptr // (e.g. `std::atomic_store(std::shared_ptr)`), which require a shared // lock table located in the dylib. +// # define _LIBCPP_AVAILABILITY_HAS_NO_ATOMIC_SHARED_PTR # define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR // These macros control the availability of all parts of <filesystem> that // depend on something in the dylib. +// # define _LIBCPP_AVAILABILITY_HAS_NO_FILESYSTEM # define _LIBCPP_AVAILABILITY_FILESYSTEM # define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH # define _LIBCPP_AVAILABILITY_FILESYSTEM_POP -// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem // This controls the availability of floating-point std::to_chars functions. // These overloads were added later than the integer overloads. +// # define _LIBCPP_AVAILABILITY_HAS_NO_TO_CHARS_FLOATING_POINT # define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT // This controls the availability of the C++20 synchronization library, // which requires shared library support for various operations // (see libcxx/src/atomic.cpp). This includes <barier>, <latch>, // <semaphore>, and notification functions on std::atomic. +// # define _LIBCPP_AVAILABILITY_HAS_NO_SYNC # define _LIBCPP_AVAILABILITY_SYNC -// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait -// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier -// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch -// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore - - // This controls the availability of the C++20 format library. - // The library is in development and not ABI stable yet. P2216 is - // retroactively accepted in C++20. This paper contains ABI breaking - // changes. -# define _LIBCPP_AVAILABILITY_FORMAT -// # define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format // This controls whether the library claims to provide a default verbose // termination function, and consequently whether the headers will try // to use it when the mechanism isn't overriden at compile-time. -// # define _LIBCPP_HAS_NO_VERBOSE_ABORT_IN_LIBRARY +// # define _LIBCPP_AVAILABILITY_HAS_NO_VERBOSE_ABORT +# define _LIBCPP_AVAILABILITY_VERBOSE_ABORT #elif defined(__APPLE__) + // shared_mutex and shared_timed_mutex +# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200) || \ + (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 100000) || \ + (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 100000) || \ + (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 30000) +# define _LIBCPP_AVAILABILITY_HAS_NO_SHARED_MUTEX +# endif # define _LIBCPP_AVAILABILITY_SHARED_MUTEX \ __attribute__((availability(macos,strict,introduced=10.12))) \ __attribute__((availability(ios,strict,introduced=10.0))) \ __attribute__((availability(tvos,strict,introduced=10.0))) \ __attribute__((availability(watchos,strict,introduced=3.0))) -# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200) || \ - (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 100000) || \ - (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 100000) || \ - (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 30000) -# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex -# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex -# endif + // bad_optional_access, bad_variant_access and bad_any_cast // Note: bad_optional_access & friends were not introduced in the matching // macOS and iOS versions, so the version mismatch between macOS and others // is intended. +# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101300) || \ + (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 120000) || \ + (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 120000) || \ + (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 50000) +# define _LIBCPP_AVAILABILITY_HAS_NO_BAD_OPTIONAL_ACCESS +# define _LIBCPP_AVAILABILITY_HAS_NO_BAD_VARIANT_ACCESS +# define _LIBCPP_AVAILABILITY_HAS_NO_BAD_ANY_CAST +# endif # define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS \ __attribute__((availability(macos,strict,introduced=10.13))) \ __attribute__((availability(ios,strict,introduced=12.0))) \ @@ -189,33 +206,73 @@ # define _LIBCPP_AVAILABILITY_BAD_ANY_CAST \ _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS + // uncaught_exceptions +# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200) || \ + (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 100000) || \ + (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 100000) || \ + (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 30000) +# define _LIBCPP_AVAILABILITY_HAS_NO_UNCAUGHT_EXCEPTIONS +# endif # define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \ __attribute__((availability(macos,strict,introduced=10.12))) \ __attribute__((availability(ios,strict,introduced=10.0))) \ __attribute__((availability(tvos,strict,introduced=10.0))) \ __attribute__((availability(watchos,strict,introduced=3.0))) + // sized operator new and sized operator delete +# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101200) || \ + (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 100000) || \ + (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 100000) || \ + (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 30000) +# define _LIBCPP_AVAILABILITY_HAS_NO_SIZED_NEW_DELETE +# endif # define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \ __attribute__((availability(macos,strict,introduced=10.12))) \ __attribute__((availability(ios,strict,introduced=10.0))) \ __attribute__((availability(tvos,strict,introduced=10.0))) \ __attribute__((availability(watchos,strict,introduced=3.0))) + // future_error +# if (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 60000) +# define _LIBCPP_AVAILABILITY_HAS_NO_FUTURE_ERROR +# endif # define _LIBCPP_AVAILABILITY_FUTURE_ERROR \ __attribute__((availability(ios,strict,introduced=6.0))) + // type_info's vtable +# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 100900) || \ + (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 70000) +# define _LIBCPP_AVAILABILITY_HAS_NO_TYPEINFO_VTABLE +# endif # define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \ __attribute__((availability(macos,strict,introduced=10.9))) \ __attribute__((availability(ios,strict,introduced=7.0))) + // locale::category +# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 100900) || \ + (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 70000) +# define _LIBCPP_AVAILABILITY_HAS_NO_LOCALE_CATEGORY +# endif # define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \ __attribute__((availability(macos,strict,introduced=10.9))) \ __attribute__((availability(ios,strict,introduced=7.0))) + // atomic operations on shared_ptr +# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 100900) || \ + (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 70000) +# define _LIBCPP_AVAILABILITY_HAS_NO_ATOMIC_SHARED_PTR +# endif # define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \ __attribute__((availability(macos,strict,introduced=10.9))) \ __attribute__((availability(ios,strict,introduced=7.0))) + // <filesystem> +# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) || \ + (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 130000) || \ + (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 130000) || \ + (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 60000) +# define _LIBCPP_AVAILABILITY_HAS_NO_FILESYSTEM +# endif # define _LIBCPP_AVAILABILITY_FILESYSTEM \ __attribute__((availability(macos,strict,introduced=10.15))) \ __attribute__((availability(ios,strict,introduced=13.0))) \ @@ -231,36 +288,39 @@ _Pragma("clang attribute pop") \ _Pragma("clang attribute pop") \ _Pragma("clang attribute pop") -# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 101500) || \ - (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 130000) || \ - (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 130000) || \ - (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 60000) -# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem + + // std::to_chars(floating-point) +# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 130300) || \ + (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 160300) || \ + (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 160300) || \ + (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 90300) +# define _LIBCPP_AVAILABILITY_HAS_NO_TO_CHARS_FLOATING_POINT # endif - # define _LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT \ - __attribute__((unavailable)) + __attribute__((availability(macos,strict,introduced=13.3))) \ + __attribute__((availability(ios,strict,introduced=16.3))) \ + __attribute__((availability(tvos,strict,introduced=16.3))) \ + __attribute__((availability(watchos,strict,introduced=9.3))) + // c++20 synchronization library +# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 110000) || \ + (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000) || \ + (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 140000) || \ + (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 70000) +# define _LIBCPP_AVAILABILITY_HAS_NO_SYNC +# endif # define _LIBCPP_AVAILABILITY_SYNC \ __attribute__((availability(macos,strict,introduced=11.0))) \ __attribute__((availability(ios,strict,introduced=14.0))) \ __attribute__((availability(tvos,strict,introduced=14.0))) \ __attribute__((availability(watchos,strict,introduced=7.0))) -# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 110000) || \ - (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 140000) || \ - (defined(__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ < 140000) || \ - (defined(__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ < 70000) -# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait -# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier -# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch -# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore + + // __libcpp_verbose_abort +# if 1 // TODO: Update once this is released +# define _LIBCPP_AVAILABILITY_HAS_NO_VERBOSE_ABORT # endif - -# define _LIBCPP_AVAILABILITY_FORMAT \ +# define _LIBCPP_AVAILABILITY_VERBOSE_ABORT \ __attribute__((unavailable)) -# define _LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format - -# define _LIBCPP_HAS_NO_VERBOSE_ABORT_IN_LIBRARY #else @@ -270,10 +330,10 @@ #endif -// Define availability attributes that depend on _LIBCPP_NO_EXCEPTIONS. +// Define availability attributes that depend on _LIBCPP_HAS_NO_EXCEPTIONS. // Those are defined in terms of the availability attributes above, and // should not be vendor-specific. -#if defined(_LIBCPP_NO_EXCEPTIONS) +#if defined(_LIBCPP_HAS_NO_EXCEPTIONS) # define _LIBCPP_AVAILABILITY_FUTURE # define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST # define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
diff --git a/third_party/llvm-project/libcxx/include/__bit/bit_cast.h b/third_party/llvm-project/libcxx/include/__bit/bit_cast.h index 2ca4120..3984246 100644 --- a/third_party/llvm-project/libcxx/include/__bit/bit_cast.h +++ b/third_party/llvm-project/libcxx/include/__bit/bit_cast.h
@@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _ToType, class _FromType> requires(sizeof(_ToType) == sizeof(_FromType) && @@ -29,7 +29,7 @@ return __builtin_bit_cast(_ToType, __from); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__bit/bit_ceil.h b/third_party/llvm-project/libcxx/include/__bit/bit_ceil.h index a558d61..1332900 100644 --- a/third_party/llvm-project/libcxx/include/__bit/bit_ceil.h +++ b/third_party/llvm-project/libcxx/include/__bit/bit_ceil.h
@@ -34,8 +34,8 @@ return _Tp{1} << __n; else { const unsigned __extra = numeric_limits<unsigned>::digits - numeric_limits<_Tp>::digits; - const unsigned __retVal = 1u << (__n + __extra); - return (_Tp)(__retVal >> __extra); + const unsigned __ret_val = 1u << (__n + __extra); + return (_Tp)(__ret_val >> __extra); } }
diff --git a/third_party/llvm-project/libcxx/include/__bit/byteswap.h b/third_party/llvm-project/libcxx/include/__bit/byteswap.h index 6fa8d48..b290e80 100644 --- a/third_party/llvm-project/libcxx/include/__bit/byteswap.h +++ b/third_party/llvm-project/libcxx/include/__bit/byteswap.h
@@ -13,7 +13,6 @@ #include <__concepts/arithmetic.h> #include <__config> #include <cstdint> -#include <cstdlib> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -21,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <integral _Tp> _LIBCPP_HIDE_FROM_ABI constexpr _Tp byteswap(_Tp __val) noexcept { @@ -48,7 +47,7 @@ } } -#endif // _LIBCPP_STD_VER > 20 +#endif // _LIBCPP_STD_VER >= 23 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__bit_reference b/third_party/llvm-project/libcxx/include/__bit_reference index 2665749..95188ff 100644 --- a/third_party/llvm-project/libcxx/include/__bit_reference +++ b/third_party/llvm-project/libcxx/include/__bit_reference
@@ -19,8 +19,9 @@ #include <__iterator/iterator_traits.h> #include <__memory/construct_at.h> #include <__memory/pointer_traits.h> +#include <__type_traits/conditional.h> +#include <__utility/swap.h> #include <cstring> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -75,7 +76,7 @@ return *this; } -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 _LIBCPP_HIDE_FROM_ABI constexpr const __bit_reference& operator=(bool __x) const noexcept { if (__x) *__seg_ |= __mask_; @@ -155,6 +156,8 @@ friend typename _Cp::__self; friend class __bit_iterator<_Cp, true>; public: + using __container = typename _Cp::__self; + _LIBCPP_INLINE_VISIBILITY __bit_const_reference(const __bit_const_reference&) = default; @@ -1135,7 +1138,7 @@ public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 __bit_iterator() _NOEXCEPT -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 : __seg_(nullptr), __ctz_(0) #endif {}
diff --git a/third_party/llvm-project/libcxx/include/__charconv/chars_format.h b/third_party/llvm-project/libcxx/include/__charconv/chars_format.h index 695bd87..0e781c0 100644 --- a/third_party/llvm-project/libcxx/include/__charconv/chars_format.h +++ b/third_party/llvm-project/libcxx/include/__charconv/chars_format.h
@@ -19,58 +19,45 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 -enum class _LIBCPP_ENUM_VIS chars_format -{ - scientific = 0x1, - fixed = 0x2, - hex = 0x4, - general = fixed | scientific -}; +enum class _LIBCPP_ENUM_VIS chars_format { scientific = 0x1, fixed = 0x2, hex = 0x4, general = fixed | scientific }; -inline _LIBCPP_INLINE_VISIBILITY constexpr chars_format -operator~(chars_format __x) { - return chars_format(~_VSTD::__to_underlying(__x)); +inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format operator~(chars_format __x) { + return chars_format(~std::__to_underlying(__x)); } -inline _LIBCPP_INLINE_VISIBILITY constexpr chars_format -operator&(chars_format __x, chars_format __y) { - return chars_format(_VSTD::__to_underlying(__x) & - _VSTD::__to_underlying(__y)); +inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format operator&(chars_format __x, chars_format __y) { + return chars_format(std::__to_underlying(__x) & std::__to_underlying(__y)); } -inline _LIBCPP_INLINE_VISIBILITY constexpr chars_format -operator|(chars_format __x, chars_format __y) { - return chars_format(_VSTD::__to_underlying(__x) | - _VSTD::__to_underlying(__y)); +inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format operator|(chars_format __x, chars_format __y) { + return chars_format(std::__to_underlying(__x) | std::__to_underlying(__y)); } -inline _LIBCPP_INLINE_VISIBILITY constexpr chars_format -operator^(chars_format __x, chars_format __y) { - return chars_format(_VSTD::__to_underlying(__x) ^ - _VSTD::__to_underlying(__y)); +inline _LIBCPP_HIDE_FROM_ABI constexpr chars_format operator^(chars_format __x, chars_format __y) { + return chars_format(std::__to_underlying(__x) ^ std::__to_underlying(__y)); } -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 chars_format& +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 chars_format& operator&=(chars_format& __x, chars_format __y) { __x = __x & __y; return __x; } -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 chars_format& +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 chars_format& operator|=(chars_format& __x, chars_format __y) { __x = __x | __y; return __x; } -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 chars_format& +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 chars_format& operator^=(chars_format& __x, chars_format __y) { __x = __x ^ __y; return __x; } -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__charconv/from_chars_integral.h b/third_party/llvm-project/libcxx/include/__charconv/from_chars_integral.h new file mode 100644 index 0000000..990aa21 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__charconv/from_chars_integral.h
@@ -0,0 +1,239 @@ +// -*- 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___CHARCONV_FROM_CHARS_INTEGRAL_H +#define _LIBCPP___CHARCONV_FROM_CHARS_INTEGRAL_H + +#include <__algorithm/copy_n.h> +#include <__charconv/from_chars_result.h> +#include <__charconv/traits.h> +#include <__config> +#include <__memory/addressof.h> +#include <__system_error/errc.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_integral.h> +#include <__type_traits/is_unsigned.h> +#include <__type_traits/make_unsigned.h> +#include <limits> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER >= 17 + +from_chars_result from_chars(const char*, const char*, bool, int = 10) = delete; + +template <typename _It, typename _Tp, typename _Fn, typename... _Ts> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result +__sign_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args) { + using __tl = numeric_limits<_Tp>; + decltype(std::__to_unsigned_like(__value)) __x; + + bool __neg = (__first != __last && *__first == '-'); + auto __r = __f(__neg ? __first + 1 : __first, __last, __x, __args...); + switch (__r.ec) { + case errc::invalid_argument: + return {__first, __r.ec}; + case errc::result_out_of_range: + return __r; + default: + break; + } + + if (__neg) { + if (__x <= std::__complement(std::__to_unsigned_like(__tl::min()))) { + __x = std::__complement(__x); + std::copy_n(std::addressof(__x), 1, std::addressof(__value)); + return __r; + } + } else { + if (__x <= std::__to_unsigned_like(__tl::max())) { + __value = __x; + return __r; + } + } + + return {__r.ptr, errc::result_out_of_range}; +} + +template <typename _Tp> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool __in_pattern(_Tp __c) { + return '0' <= __c && __c <= '9'; +} + +struct _LIBCPP_HIDDEN __in_pattern_result { + bool __ok; + int __val; + + explicit _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI operator bool() const { return __ok; } +}; + +template <typename _Tp> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __in_pattern_result __in_pattern(_Tp __c, int __base) { + if (__base <= 10) + return {'0' <= __c && __c < '0' + __base, __c - '0'}; + else if (std::__in_pattern(__c)) + return {true, __c - '0'}; + else if ('a' <= __c && __c < 'a' + __base - 10) + return {true, __c - 'a' + 10}; + else + return {'A' <= __c && __c < 'A' + __base - 10, __c - 'A' + 10}; +} + +template <typename _It, typename _Tp, typename _Fn, typename... _Ts> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result +__subject_seq_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args) { + auto __find_non_zero = [](_It __firstit, _It __lastit) { + for (; __firstit != __lastit; ++__firstit) + if (*__firstit != '0') + break; + return __firstit; + }; + + auto __p = __find_non_zero(__first, __last); + if (__p == __last || !std::__in_pattern(*__p, __args...)) { + if (__p == __first) + return {__first, errc::invalid_argument}; + else { + __value = 0; + return {__p, {}}; + } + } + + auto __r = __f(__p, __last, __value, __args...); + if (__r.ec == errc::result_out_of_range) { + for (; __r.ptr != __last; ++__r.ptr) { + if (!std::__in_pattern(*__r.ptr, __args...)) + break; + } + } + + return __r; +} + +template <typename _Tp, typename enable_if<is_unsigned<_Tp>::value, int>::type = 0> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result +__from_chars_atoi(const char* __first, const char* __last, _Tp& __value) { + using __tx = __itoa::__traits<_Tp>; + using __output_type = typename __tx::type; + + return std::__subject_seq_combinator( + __first, __last, __value, [](const char* __f, const char* __l, _Tp& __val) -> from_chars_result { + __output_type __a, __b; + auto __p = __tx::__read(__f, __l, __a, __b); + if (__p == __l || !std::__in_pattern(*__p)) { + __output_type __m = numeric_limits<_Tp>::max(); + if (__m >= __a && __m - __a >= __b) { + __val = __a + __b; + return {__p, {}}; + } + } + return {__p, errc::result_out_of_range}; + }); +} + +template <typename _Tp, typename enable_if<is_signed<_Tp>::value, int>::type = 0> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result +__from_chars_atoi(const char* __first, const char* __last, _Tp& __value) { + using __t = decltype(std::__to_unsigned_like(__value)); + return std::__sign_combinator(__first, __last, __value, __from_chars_atoi<__t>); +} + +/* +// Code used to generate __from_chars_log2f_lut. +#include <cmath> +#include <format> +#include <iostream> + +int main() { + for (int i = 2; i <= 36; ++i) + std::cout << std::format("{},\n", log2f(i)); +} +*/ +/// log2f table for bases [2, 36]. +inline constexpr float __from_chars_log2f_lut[35] = { + 1, 1.5849625, 2, 2.321928, 2.5849626, 2.807355, 3, 3.169925, 3.321928, + 3.4594316, 3.5849626, 3.7004397, 3.807355, 3.9068906, 4, 4.087463, 4.169925, 4.2479277, + 4.321928, 4.3923173, 4.4594316, 4.523562, 4.5849624, 4.643856, 4.70044, 4.7548876, 4.807355, + 4.857981, 4.9068904, 4.9541965, 5, 5.044394, 5.087463, 5.129283, 5.169925}; + +template <typename _Tp, typename enable_if<is_unsigned<_Tp>::value, int>::type = 0> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result +__from_chars_integral(const char* __first, const char* __last, _Tp& __value, int __base) { + if (__base == 10) + return std::__from_chars_atoi(__first, __last, __value); + + return std::__subject_seq_combinator( + __first, + __last, + __value, + [](const char* __p, const char* __lastp, _Tp& __val, int __b) -> from_chars_result { + using __tl = numeric_limits<_Tp>; + // __base is always between 2 and 36 inclusive. + auto __digits = __tl::digits / __from_chars_log2f_lut[__b - 2]; + _Tp __x = __in_pattern(*__p++, __b).__val, __y = 0; + + for (int __i = 1; __p != __lastp; ++__i, ++__p) { + if (auto __c = __in_pattern(*__p, __b)) { + if (__i < __digits - 1) + __x = __x * __b + __c.__val; + else { + if (!__itoa::__mul_overflowed(__x, __b, __x)) + ++__p; + __y = __c.__val; + break; + } + } else + break; + } + + if (__p == __lastp || !__in_pattern(*__p, __b)) { + if (__tl::max() - __x >= __y) { + __val = __x + __y; + return {__p, {}}; + } + } + return {__p, errc::result_out_of_range}; + }, + __base); +} + +template <typename _Tp, typename enable_if<is_signed<_Tp>::value, int>::type = 0> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result +__from_chars_integral(const char* __first, const char* __last, _Tp& __value, int __base) { + using __t = decltype(std::__to_unsigned_like(__value)); + return std::__sign_combinator(__first, __last, __value, __from_chars_integral<__t>, __base); +} + +template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result +from_chars(const char* __first, const char* __last, _Tp& __value) { + return std::__from_chars_atoi(__first, __last, __value); +} + +template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result +from_chars(const char* __first, const char* __last, _Tp& __value, int __base) { + _LIBCPP_ASSERT(2 <= __base && __base <= 36, "base not in [2, 36]"); + return std::__from_chars_integral(__first, __last, __value, __base); +} +#endif // _LIBCPP_STD_VER >= 17 + +_LIBCPP_END_NAMESPACE_STD + +_LIBCPP_POP_MACROS + +#endif // _LIBCPP___CHARCONV_FROM_CHARS_INTEGRAL_H
diff --git a/third_party/llvm-project/libcxx/include/__charconv/from_chars_result.h b/third_party/llvm-project/libcxx/include/__charconv/from_chars_result.h index 05ffe14..7eeb9ec 100644 --- a/third_party/llvm-project/libcxx/include/__charconv/from_chars_result.h +++ b/third_party/llvm-project/libcxx/include/__charconv/from_chars_result.h
@@ -11,7 +11,7 @@ #define _LIBCPP___CHARCONV_FROM_CHARS_RESULT_H #include <__config> -#include <__errc> +#include <__system_error/errc.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -19,18 +19,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 -struct _LIBCPP_TYPE_VIS from_chars_result -{ - const char* ptr; - errc ec; -# if _LIBCPP_STD_VER > 17 - _LIBCPP_HIDE_FROM_ABI friend bool operator==(const from_chars_result&, const from_chars_result&) = default; +struct _LIBCPP_TYPE_VIS from_chars_result { + const char* ptr; + errc ec; +# if _LIBCPP_STD_VER >= 20 + _LIBCPP_HIDE_FROM_ABI friend bool operator==(const from_chars_result&, const from_chars_result&) = default; # endif }; -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__charconv/tables.h b/third_party/llvm-project/libcxx/include/__charconv/tables.h index 9b82440..6b93536 100644 --- a/third_party/llvm-project/libcxx/include/__charconv/tables.h +++ b/third_party/llvm-project/libcxx/include/__charconv/tables.h
@@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 namespace __itoa { @@ -62,32 +62,41 @@ 'f', 'd', 'f', 'e', 'f', 'f'}; inline constexpr uint32_t __pow10_32[10] = { - UINT32_C(0), UINT32_C(10), UINT32_C(100), UINT32_C(1000), UINT32_C(10000), - UINT32_C(100000), UINT32_C(1000000), UINT32_C(10000000), UINT32_C(100000000), UINT32_C(1000000000)}; + UINT32_C(0), + UINT32_C(10), + UINT32_C(100), + UINT32_C(1000), + UINT32_C(10000), + UINT32_C(100000), + UINT32_C(1000000), + UINT32_C(10000000), + UINT32_C(100000000), + UINT32_C(1000000000)}; -inline constexpr uint64_t __pow10_64[20] = {UINT64_C(0), - UINT64_C(10), - UINT64_C(100), - UINT64_C(1000), - UINT64_C(10000), - UINT64_C(100000), - UINT64_C(1000000), - UINT64_C(10000000), - UINT64_C(100000000), - UINT64_C(1000000000), - UINT64_C(10000000000), - UINT64_C(100000000000), - UINT64_C(1000000000000), - UINT64_C(10000000000000), - UINT64_C(100000000000000), - UINT64_C(1000000000000000), - UINT64_C(10000000000000000), - UINT64_C(100000000000000000), - UINT64_C(1000000000000000000), - UINT64_C(10000000000000000000)}; +inline constexpr uint64_t __pow10_64[20] = { + UINT64_C(0), + UINT64_C(10), + UINT64_C(100), + UINT64_C(1000), + UINT64_C(10000), + UINT64_C(100000), + UINT64_C(1000000), + UINT64_C(10000000), + UINT64_C(100000000), + UINT64_C(1000000000), + UINT64_C(10000000000), + UINT64_C(100000000000), + UINT64_C(1000000000000), + UINT64_C(10000000000000), + UINT64_C(100000000000000), + UINT64_C(1000000000000000), + UINT64_C(10000000000000000), + UINT64_C(100000000000000000), + UINT64_C(1000000000000000000), + UINT64_C(10000000000000000000)}; # ifndef _LIBCPP_HAS_NO_INT128 -inline constexpr int __pow10_128_offset = 0; +inline constexpr int __pow10_128_offset = 0; inline constexpr __uint128_t __pow10_128[40] = { UINT64_C(0), UINT64_C(10), @@ -147,7 +156,7 @@ } // namespace __itoa -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__charconv/to_chars.h b/third_party/llvm-project/libcxx/include/__charconv/to_chars.h new file mode 100644 index 0000000..8ef09af --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__charconv/to_chars.h
@@ -0,0 +1,25 @@ +// -*- 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___CHARCONV_TO_CHARS +#define _LIBCPP___CHARCONV_TO_CHARS + +#include <__charconv/to_chars_floating_point.h> +#include <__charconv/to_chars_integral.h> +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___CHARCONV_TO_CHARS
diff --git a/third_party/llvm-project/libcxx/include/__charconv/to_chars_base_10.h b/third_party/llvm-project/libcxx/include/__charconv/to_chars_base_10.h index fc7fb76..028ff33 100644 --- a/third_party/llvm-project/libcxx/include/__charconv/to_chars_base_10.h +++ b/third_party/llvm-project/libcxx/include/__charconv/to_chars_base_10.h
@@ -25,7 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 namespace __itoa { @@ -72,7 +72,8 @@ static_cast<uint32_t>(__value % 100000000)); } -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __base_10_u32(char* __first, uint32_t __value) noexcept { +_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* +__base_10_u32(char* __first, uint32_t __value) noexcept { if (__value < 1000000) { if (__value < 10000) { if (__value < 100) { @@ -107,7 +108,8 @@ return __itoa::__append10(__first, __value); } -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __base_10_u64(char* __buffer, uint64_t __value) noexcept { +_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* +__base_10_u64(char* __buffer, uint64_t __value) noexcept { if (__value <= UINT32_MAX) return __itoa::__base_10_u32(__buffer, static_cast<uint32_t>(__value)); @@ -134,7 +136,8 @@ return __pow10_128[__exp - __pow10_128_offset]; } -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* __base_10_u128(char* __buffer, __uint128_t __value) noexcept { +_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI inline char* +__base_10_u128(char* __buffer, __uint128_t __value) noexcept { _LIBCPP_ASSERT( __value > numeric_limits<uint64_t>::max(), "The optimizations for this algorithm fail when this isn't true."); @@ -159,8 +162,7 @@ __value %= __itoa::__pow_10(29); __buffer = __itoa::__append10(__buffer, static_cast<uint64_t>(__value / __itoa::__pow_10(19))); __value %= __itoa::__pow_10(19); - } - else { + } else { // step 2 // This version needs to determine the position of the leading non-zero digit. __buffer = __base_10_u64(__buffer, static_cast<uint64_t>(__value / __itoa::__pow_10(19))); @@ -176,7 +178,7 @@ # endif } // namespace __itoa -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__charconv/to_chars_floating_point.h b/third_party/llvm-project/libcxx/include/__charconv/to_chars_floating_point.h new file mode 100644 index 0000000..6ede36e --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__charconv/to_chars_floating_point.h
@@ -0,0 +1,56 @@ +// -*- 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___CHARCONV_TO_CHARS_FLOATING_POINT_H +#define _LIBCPP___CHARCONV_TO_CHARS_FLOATING_POINT_H + +#include <__availability> +#include <__charconv/chars_format.h> +#include <__charconv/to_chars_result.h> +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER >= 17 + +_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS to_chars_result +to_chars(char* __first, char* __last, float __value); + +_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS to_chars_result +to_chars(char* __first, char* __last, double __value); + +_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS to_chars_result +to_chars(char* __first, char* __last, long double __value); + +_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS to_chars_result +to_chars(char* __first, char* __last, float __value, chars_format __fmt); + +_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS to_chars_result +to_chars(char* __first, char* __last, double __value, chars_format __fmt); + +_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS to_chars_result +to_chars(char* __first, char* __last, long double __value, chars_format __fmt); + +_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS to_chars_result +to_chars(char* __first, char* __last, float __value, chars_format __fmt, int __precision); + +_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS to_chars_result +to_chars(char* __first, char* __last, double __value, chars_format __fmt, int __precision); + +_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS to_chars_result +to_chars(char* __first, char* __last, long double __value, chars_format __fmt, int __precision); +#endif // _LIBCPP_STD_VER >= 17 + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___CHARCONV_TO_CHARS_FLOATING_POINT_H
diff --git a/third_party/llvm-project/libcxx/include/__charconv/to_chars_integral.h b/third_party/llvm-project/libcxx/include/__charconv/to_chars_integral.h new file mode 100644 index 0000000..6c726c0 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__charconv/to_chars_integral.h
@@ -0,0 +1,326 @@ +// -*- 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___CHARCONV_TO_CHARS_INTEGRAL_H +#define _LIBCPP___CHARCONV_TO_CHARS_INTEGRAL_H + +#include <__algorithm/copy_n.h> +#include <__bit/countl.h> +#include <__charconv/tables.h> +#include <__charconv/to_chars_base_10.h> +#include <__charconv/to_chars_result.h> +#include <__charconv/traits.h> +#include <__config> +#include <__system_error/errc.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_same.h> +#include <__type_traits/make_32_64_or_128_bit.h> +#include <__type_traits/make_unsigned.h> +#include <__utility/unreachable.h> +#include <cstddef> +#include <cstdint> +#include <limits> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER >= 17 + +to_chars_result to_chars(char*, char*, bool, int = 10) = delete; + +template <typename _Tp> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result +__to_chars_itoa(char* __first, char* __last, _Tp __value, false_type); + +template <typename _Tp> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result +__to_chars_itoa(char* __first, char* __last, _Tp __value, true_type) { + auto __x = std::__to_unsigned_like(__value); + if (__value < 0 && __first != __last) { + *__first++ = '-'; + __x = std::__complement(__x); + } + + return std::__to_chars_itoa(__first, __last, __x, false_type()); +} + +template <typename _Tp> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result +__to_chars_itoa(char* __first, char* __last, _Tp __value, false_type) { + using __tx = __itoa::__traits<_Tp>; + auto __diff = __last - __first; + + if (__tx::digits <= __diff || __tx::__width(__value) <= __diff) + return {__tx::__convert(__first, __value), errc(0)}; + else + return {__last, errc::value_too_large}; +} + +# ifndef _LIBCPP_HAS_NO_INT128 +template <> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result +__to_chars_itoa(char* __first, char* __last, __uint128_t __value, false_type) { + // When the value fits in 64-bits use the 64-bit code path. This reduces + // the number of expensive calculations on 128-bit values. + // + // NOTE the 128-bit code path requires this optimization. + if (__value <= numeric_limits<uint64_t>::max()) + return __to_chars_itoa(__first, __last, static_cast<uint64_t>(__value), false_type()); + + using __tx = __itoa::__traits<__uint128_t>; + auto __diff = __last - __first; + + if (__tx::digits <= __diff || __tx::__width(__value) <= __diff) + return {__tx::__convert(__first, __value), errc(0)}; + else + return {__last, errc::value_too_large}; +} +# endif + +template <class _Tp> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result +__to_chars_integral(char* __first, char* __last, _Tp __value, int __base, false_type); + +template <typename _Tp> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result +__to_chars_integral(char* __first, char* __last, _Tp __value, int __base, true_type) { + auto __x = std::__to_unsigned_like(__value); + if (__value < 0 && __first != __last) { + *__first++ = '-'; + __x = std::__complement(__x); + } + + return std::__to_chars_integral(__first, __last, __x, __base, false_type()); +} + +namespace __itoa { + +template <unsigned _Base> +struct _LIBCPP_HIDDEN __integral; + +template <> +struct _LIBCPP_HIDDEN __integral<2> { + template <typename _Tp> + _LIBCPP_HIDE_FROM_ABI static constexpr int __width(_Tp __value) noexcept { + // If value == 0 still need one digit. If the value != this has no + // effect since the code scans for the most significant bit set. (Note + // that __libcpp_clz doesn't work for 0.) + return numeric_limits<_Tp>::digits - std::__libcpp_clz(__value | 1); + } + + template <typename _Tp> + _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI static to_chars_result + __to_chars(char* __first, char* __last, _Tp __value) { + ptrdiff_t __cap = __last - __first; + int __n = __width(__value); + if (__n > __cap) + return {__last, errc::value_too_large}; + + __last = __first + __n; + char* __p = __last; + const unsigned __divisor = 16; + while (__value > __divisor) { + unsigned __c = __value % __divisor; + __value /= __divisor; + __p -= 4; + std::copy_n(&__base_2_lut[4 * __c], 4, __p); + } + do { + unsigned __c = __value % 2; + __value /= 2; + *--__p = "01"[__c]; + } while (__value != 0); + return {__last, errc(0)}; + } +}; + +template <> +struct _LIBCPP_HIDDEN __integral<8> { + template <typename _Tp> + _LIBCPP_HIDE_FROM_ABI static constexpr int __width(_Tp __value) noexcept { + // If value == 0 still need one digit. If the value != this has no + // effect since the code scans for the most significat bit set. (Note + // that __libcpp_clz doesn't work for 0.) + return ((numeric_limits<_Tp>::digits - std::__libcpp_clz(__value | 1)) + 2) / 3; + } + + template <typename _Tp> + _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI static to_chars_result + __to_chars(char* __first, char* __last, _Tp __value) { + ptrdiff_t __cap = __last - __first; + int __n = __width(__value); + if (__n > __cap) + return {__last, errc::value_too_large}; + + __last = __first + __n; + char* __p = __last; + unsigned __divisor = 64; + while (__value > __divisor) { + unsigned __c = __value % __divisor; + __value /= __divisor; + __p -= 2; + std::copy_n(&__base_8_lut[2 * __c], 2, __p); + } + do { + unsigned __c = __value % 8; + __value /= 8; + *--__p = "01234567"[__c]; + } while (__value != 0); + return {__last, errc(0)}; + } +}; + +template <> +struct _LIBCPP_HIDDEN __integral<16> { + template <typename _Tp> + _LIBCPP_HIDE_FROM_ABI static constexpr int __width(_Tp __value) noexcept { + // If value == 0 still need one digit. If the value != this has no + // effect since the code scans for the most significat bit set. (Note + // that __libcpp_clz doesn't work for 0.) + return (numeric_limits<_Tp>::digits - std::__libcpp_clz(__value | 1) + 3) / 4; + } + + template <typename _Tp> + _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI static to_chars_result + __to_chars(char* __first, char* __last, _Tp __value) { + ptrdiff_t __cap = __last - __first; + int __n = __width(__value); + if (__n > __cap) + return {__last, errc::value_too_large}; + + __last = __first + __n; + char* __p = __last; + unsigned __divisor = 256; + while (__value > __divisor) { + unsigned __c = __value % __divisor; + __value /= __divisor; + __p -= 2; + std::copy_n(&__base_16_lut[2 * __c], 2, __p); + } + if (__first != __last) + do { + unsigned __c = __value % 16; + __value /= 16; + *--__p = "0123456789abcdef"[__c]; + } while (__value != 0); + return {__last, errc(0)}; + } +}; + +} // namespace __itoa + +template <unsigned _Base, typename _Tp, typename enable_if<(sizeof(_Tp) >= sizeof(unsigned)), int>::type = 0> +_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __to_chars_integral_width(_Tp __value) { + return __itoa::__integral<_Base>::__width(__value); +} + +template <unsigned _Base, typename _Tp, typename enable_if<(sizeof(_Tp) < sizeof(unsigned)), int>::type = 0> +_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __to_chars_integral_width(_Tp __value) { + return std::__to_chars_integral_width<_Base>(static_cast<unsigned>(__value)); +} + +template <unsigned _Base, typename _Tp, typename enable_if<(sizeof(_Tp) >= sizeof(unsigned)), int>::type = 0> +_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result +__to_chars_integral(char* __first, char* __last, _Tp __value) { + return __itoa::__integral<_Base>::__to_chars(__first, __last, __value); +} + +template <unsigned _Base, typename _Tp, typename enable_if<(sizeof(_Tp) < sizeof(unsigned)), int>::type = 0> +_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result +__to_chars_integral(char* __first, char* __last, _Tp __value) { + return std::__to_chars_integral<_Base>(__first, __last, static_cast<unsigned>(__value)); +} + +template <typename _Tp> +_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __to_chars_integral_width(_Tp __value, unsigned __base) { + _LIBCPP_ASSERT(__value >= 0, "The function requires a non-negative value."); + + unsigned __base_2 = __base * __base; + unsigned __base_3 = __base_2 * __base; + unsigned __base_4 = __base_2 * __base_2; + + int __r = 0; + while (true) { + if (__value < __base) + return __r + 1; + if (__value < __base_2) + return __r + 2; + if (__value < __base_3) + return __r + 3; + if (__value < __base_4) + return __r + 4; + + __value /= __base_4; + __r += 4; + } + + __libcpp_unreachable(); +} + +template <typename _Tp> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result +__to_chars_integral(char* __first, char* __last, _Tp __value, int __base, false_type) { + if (__base == 10) [[likely]] + return std::__to_chars_itoa(__first, __last, __value, false_type()); + + switch (__base) { + case 2: + return std::__to_chars_integral<2>(__first, __last, __value); + case 8: + return std::__to_chars_integral<8>(__first, __last, __value); + case 16: + return std::__to_chars_integral<16>(__first, __last, __value); + } + + ptrdiff_t __cap = __last - __first; + int __n = std::__to_chars_integral_width(__value, __base); + if (__n > __cap) + return {__last, errc::value_too_large}; + + __last = __first + __n; + char* __p = __last; + do { + unsigned __c = __value % __base; + __value /= __base; + *--__p = "0123456789abcdefghijklmnopqrstuvwxyz"[__c]; + } while (__value != 0); + return {__last, errc(0)}; +} + +template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result +to_chars(char* __first, char* __last, _Tp __value) { + using _Type = __make_32_64_or_128_bit_t<_Tp>; + static_assert(!is_same<_Type, void>::value, "unsupported integral type used in to_chars"); + return std::__to_chars_itoa(__first, __last, static_cast<_Type>(__value), is_signed<_Tp>()); +} + +template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result +to_chars(char* __first, char* __last, _Tp __value, int __base) { + _LIBCPP_ASSERT(2 <= __base && __base <= 36, "base not in [2, 36]"); + + using _Type = __make_32_64_or_128_bit_t<_Tp>; + return std::__to_chars_integral(__first, __last, static_cast<_Type>(__value), __base, is_signed<_Tp>()); +} + +#endif // _LIBCPP_STD_VER >= 17 + +_LIBCPP_END_NAMESPACE_STD + +_LIBCPP_POP_MACROS + +#endif // _LIBCPP___CHARCONV_TO_CHARS_INTEGRAL_H
diff --git a/third_party/llvm-project/libcxx/include/__charconv/to_chars_result.h b/third_party/llvm-project/libcxx/include/__charconv/to_chars_result.h index 2eb4098..67221b3 100644 --- a/third_party/llvm-project/libcxx/include/__charconv/to_chars_result.h +++ b/third_party/llvm-project/libcxx/include/__charconv/to_chars_result.h
@@ -11,7 +11,7 @@ #define _LIBCPP___CHARCONV_TO_CHARS_RESULT_H #include <__config> -#include <__errc> +#include <__system_error/errc.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -19,18 +19,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 -struct _LIBCPP_TYPE_VIS to_chars_result -{ - char* ptr; - errc ec; -# if _LIBCPP_STD_VER > 17 - _LIBCPP_HIDE_FROM_ABI friend bool operator==(const to_chars_result&, const to_chars_result&) = default; +struct _LIBCPP_TYPE_VIS to_chars_result { + char* ptr; + errc ec; +# if _LIBCPP_STD_VER >= 20 + _LIBCPP_HIDE_FROM_ABI friend bool operator==(const to_chars_result&, const to_chars_result&) = default; # endif }; -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__charconv/traits.h b/third_party/llvm-project/libcxx/include/__charconv/traits.h new file mode 100644 index 0000000..505a0b1 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__charconv/traits.h
@@ -0,0 +1,199 @@ +// -*- 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___CHARCONV_TRAITS +#define _LIBCPP___CHARCONV_TRAITS + +#include <__bit/countl.h> +#include <__charconv/tables.h> +#include <__charconv/to_chars_base_10.h> +#include <__config> +#include <__type_traits/enable_if.h> +#include <__type_traits/is_unsigned.h> +#include <cstdint> +#include <limits> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + +_LIBCPP_BEGIN_NAMESPACE_STD + +#if _LIBCPP_STD_VER >= 17 + +namespace __itoa { + +template <typename _Tp, typename = void> +struct _LIBCPP_HIDDEN __traits_base; + +template <typename _Tp> +struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t<sizeof(_Tp) <= sizeof(uint32_t)>> { + using type = uint32_t; + + /// The width estimation using a log10 algorithm. + /// + /// The algorithm is based on + /// http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10 + /// Instead of using IntegerLogBase2 it uses __libcpp_clz. Since that + /// function requires its input to have at least one bit set the value of + /// zero is set to one. This means the first element of the lookup table is + /// zero. + static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width(_Tp __v) { + auto __t = (32 - std::__libcpp_clz(static_cast<type>(__v | 1))) * 1233 >> 12; + return __t - (__v < __itoa::__pow10_32[__t]) + 1; + } + + static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char* __convert(char* __p, _Tp __v) { + return __itoa::__base_10_u32(__p, __v); + } + + static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI decltype(__pow10_32)& __pow() { + return __itoa::__pow10_32; + } +}; + +template <typename _Tp> +struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t<sizeof(_Tp) == sizeof(uint64_t)>> { + using type = uint64_t; + + /// The width estimation using a log10 algorithm. + /// + /// The algorithm is based on + /// http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10 + /// Instead of using IntegerLogBase2 it uses __libcpp_clz. Since that + /// function requires its input to have at least one bit set the value of + /// zero is set to one. This means the first element of the lookup table is + /// zero. + static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width(_Tp __v) { + auto __t = (64 - std::__libcpp_clz(static_cast<type>(__v | 1))) * 1233 >> 12; + return __t - (__v < __itoa::__pow10_64[__t]) + 1; + } + + static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char* __convert(char* __p, _Tp __v) { + return __itoa::__base_10_u64(__p, __v); + } + + static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI decltype(__pow10_64)& __pow() { + return __itoa::__pow10_64; + } +}; + +# ifndef _LIBCPP_HAS_NO_INT128 +template <typename _Tp> +struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t<sizeof(_Tp) == sizeof(__uint128_t)> > { + using type = __uint128_t; + + /// The width estimation using a log10 algorithm. + /// + /// The algorithm is based on + /// http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10 + /// Instead of using IntegerLogBase2 it uses __libcpp_clz. Since that + /// function requires its input to have at least one bit set the value of + /// zero is set to one. This means the first element of the lookup table is + /// zero. + static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width(_Tp __v) { + _LIBCPP_ASSERT( + __v > numeric_limits<uint64_t>::max(), "The optimizations for this algorithm fail when this isn't true."); + // There's always a bit set in the upper 64-bits. + auto __t = (128 - std::__libcpp_clz(static_cast<uint64_t>(__v >> 64))) * 1233 >> 12; + _LIBCPP_ASSERT(__t >= __itoa::__pow10_128_offset, "Index out of bounds"); + // __t is adjusted since the lookup table misses the lower entries. + return __t - (__v < __itoa::__pow10_128[__t - __itoa::__pow10_128_offset]) + 1; + } + + static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char* __convert(char* __p, _Tp __v) { + return __itoa::__base_10_u128(__p, __v); + } + + // TODO FMT This pow function should get an index. + // By moving this to its own header it can be reused by the pow function in to_chars_base_10. + static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI decltype(__pow10_128)& __pow() { + return __itoa::__pow10_128; + } +}; +# endif + +template <typename _Tp> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool +__mul_overflowed(unsigned char __a, _Tp __b, unsigned char& __r) { + auto __c = __a * __b; + __r = __c; + return __c > numeric_limits<unsigned char>::max(); +} + +template <typename _Tp> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool +__mul_overflowed(unsigned short __a, _Tp __b, unsigned short& __r) { + auto __c = __a * __b; + __r = __c; + return __c > numeric_limits<unsigned short>::max(); +} + +template <typename _Tp> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool __mul_overflowed(_Tp __a, _Tp __b, _Tp& __r) { + static_assert(is_unsigned<_Tp>::value, ""); + return __builtin_mul_overflow(__a, __b, &__r); +} + +template <typename _Tp, typename _Up> +inline _LIBCPP_HIDE_FROM_ABI bool _LIBCPP_CONSTEXPR_SINCE_CXX23 __mul_overflowed(_Tp __a, _Up __b, _Tp& __r) { + return __itoa::__mul_overflowed(__a, static_cast<_Tp>(__b), __r); +} + +template <typename _Tp> +struct _LIBCPP_HIDDEN __traits : __traits_base<_Tp> { + static constexpr int digits = numeric_limits<_Tp>::digits10 + 1; + using __traits_base<_Tp>::__pow; + using typename __traits_base<_Tp>::type; + + // precondition: at least one non-zero character available + static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char const* + __read(char const* __p, char const* __ep, type& __a, type& __b) { + type __cprod[digits]; + int __j = digits - 1; + int __i = digits; + do { + if (*__p < '0' || *__p > '9') + break; + __cprod[--__i] = *__p++ - '0'; + } while (__p != __ep && __i != 0); + + __a = __inner_product(__cprod + __i + 1, __cprod + __j, __pow() + 1, __cprod[__i]); + if (__itoa::__mul_overflowed(__cprod[__j], __pow()[__j - __i], __b)) + --__p; + return __p; + } + + template <typename _It1, typename _It2, class _Up> + static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI _Up + __inner_product(_It1 __first1, _It1 __last1, _It2 __first2, _Up __init) { + for (; __first1 < __last1; ++__first1, ++__first2) + __init = __init + *__first1 * *__first2; + return __init; + } +}; + +} // namespace __itoa + +template <typename _Tp> +inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI _Tp __complement(_Tp __x) { + static_assert(is_unsigned<_Tp>::value, "cast to unsigned first"); + return _Tp(~__x + 1); +} + +#endif // _LIBCPP_STD_VER >= 17 + +_LIBCPP_END_NAMESPACE_STD + +_LIBCPP_POP_MACROS + +#endif // _LIBCPP___CHARCONV_TRAITS
diff --git a/third_party/llvm-project/libcxx/include/__chrono/calendar.h b/third_party/llvm-project/libcxx/include/__chrono/calendar.h index d3762a6..e14f96d 100644 --- a/third_party/llvm-project/libcxx/include/__chrono/calendar.h +++ b/third_party/llvm-project/libcxx/include/__chrono/calendar.h
@@ -18,7 +18,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -39,6 +39,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___CHRONO_CALENDAR_H
diff --git a/third_party/llvm-project/libcxx/include/__tuple_dir/pair_like.h b/third_party/llvm-project/libcxx/include/__chrono/concepts.h similarity index 60% copy from third_party/llvm-project/libcxx/include/__tuple_dir/pair_like.h copy to third_party/llvm-project/libcxx/include/__chrono/concepts.h index 87407ad..61ec256 100644 --- a/third_party/llvm-project/libcxx/include/__tuple_dir/pair_like.h +++ b/third_party/llvm-project/libcxx/include/__chrono/concepts.h
@@ -1,3 +1,4 @@ +// -*- C++ -*- //===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. @@ -6,13 +7,13 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP___TUPLE_PAIR_LIKE_H -#define _LIBCPP___TUPLE_PAIR_LIKE_H +#ifndef _LIBCPP___CHRONO_CONCEPTS_H +#define _LIBCPP___CHRONO_CONCEPTS_H +#include <__chrono/hh_mm_ss.h> +#include <__chrono/time_point.h> #include <__config> -#include <__tuple_dir/tuple_like.h> -#include <__tuple_dir/tuple_size.h> -#include <__type_traits/remove_cvref.h> +#include <__type_traits/is_specialization.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -23,10 +24,13 @@ #if _LIBCPP_STD_VER >= 20 template <class _Tp> -concept __pair_like = __tuple_like<_Tp> && tuple_size<remove_cvref_t<_Tp>>::value == 2; +concept __is_hh_mm_ss = __is_specialization_v<_Tp, chrono::hh_mm_ss>; + +template <class _Tp> +concept __is_time_point = __is_specialization_v<_Tp, chrono::time_point>; #endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP___TUPLE_PAIR_LIKE_H +#endif // _LIBCPP___CHRONO_CONCEPTS_H
diff --git a/third_party/llvm-project/libcxx/include/__chrono/convert_to_tm.h b/third_party/llvm-project/libcxx/include/__chrono/convert_to_tm.h index 36846b3..95cde20 100644 --- a/third_party/llvm-project/libcxx/include/__chrono/convert_to_tm.h +++ b/third_party/llvm-project/libcxx/include/__chrono/convert_to_tm.h
@@ -10,6 +10,7 @@ #ifndef _LIBCPP___CHRONO_CONVERT_TO_TM_H #define _LIBCPP___CHRONO_CONVERT_TO_TM_H +#include <__chrono/concepts.h> #include <__chrono/day.h> #include <__chrono/duration.h> #include <__chrono/hh_mm_ss.h> @@ -26,17 +27,22 @@ #include <__chrono/year_month_weekday.h> #include <__concepts/same_as.h> #include <__config> +#include <__format/format_error.h> #include <__memory/addressof.h> #include <cstdint> #include <ctime> +#include <limits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // Conerts a chrono date and weekday to a given _Tm type. // @@ -76,7 +82,25 @@ __result.tm_zone = "UTC"; # endif - if constexpr (chrono::__is_duration<_ChronoT>::value) { + if constexpr (__is_time_point<_ChronoT>) { + if constexpr (same_as<typename _ChronoT::clock, chrono::system_clock>) { + chrono::sys_days __days = chrono::time_point_cast<chrono::days>(__value); + chrono::year_month_day __ymd{__days}; + + __result = std::__convert_to_tm<_Tm>(chrono::year_month_day{__ymd}, chrono::weekday{__days}); + + // TODO FMT D138826 has improvements for this part. + // TODO FMT Since this is identical for duration and system time it would be good to avoid code duplication. + uint64_t __sec = + chrono::duration_cast<chrono::seconds>(__value - chrono::time_point_cast<chrono::seconds>(__days)).count(); + __sec %= 24 * 3600; + __result.tm_hour = __sec / 3600; + __sec %= 3600; + __result.tm_min = __sec / 60; + __result.tm_sec = __sec % 60; + } else + static_assert(sizeof(_ChronoT) == 0, "TODO: Add the missing clock specialization"); + } else if constexpr (chrono::__is_duration<_ChronoT>::value) { // [time.format]/6 // ... However, if a flag refers to a "time of day" (e.g. %H, %I, %p, // etc.), then a specialization of duration is interpreted as the time of @@ -114,14 +138,26 @@ } else if constexpr (same_as<_ChronoT, chrono::year_month_weekday> || same_as<_ChronoT, chrono::year_month_weekday_last>) { return std::__convert_to_tm<_Tm>(chrono::year_month_day{static_cast<chrono::sys_days>(__value)}, __value.weekday()); + } else if constexpr (__is_hh_mm_ss<_ChronoT>) { + __result.tm_sec = __value.seconds().count(); + __result.tm_min = __value.minutes().count(); + // In libc++ hours is stored as a long. The type in std::tm is an int. So + // the overflow can only occur when hour uses more bits than an int + // provides. + if constexpr (sizeof(std::chrono::hours::rep) > sizeof(__result.tm_hour)) + if (__value.hours().count() > std::numeric_limits<decltype(__result.tm_hour)>::max()) + std::__throw_format_error("Formatting hh_mm_ss, encountered an hour overflow"); + __result.tm_hour = __value.hours().count(); } else static_assert(sizeof(_ChronoT) == 0, "Add the missing type specialization"); return __result; } -#endif //if _LIBCPP_STD_VER > 17 +#endif // if _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD +_LIBCPP_POP_MACROS + #endif // _LIBCPP___CHRONO_CONVERT_TO_TM_H
diff --git a/third_party/llvm-project/libcxx/include/__chrono/day.h b/third_party/llvm-project/libcxx/include/__chrono/day.h index 35ecfcf..13a885c 100644 --- a/third_party/llvm-project/libcxx/include/__chrono/day.h +++ b/third_party/llvm-project/libcxx/include/__chrono/day.h
@@ -18,7 +18,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -79,6 +79,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___CHRONO_DAY_H
diff --git a/third_party/llvm-project/libcxx/include/__chrono/duration.h b/third_party/llvm-project/libcxx/include/__chrono/duration.h index afcc38b..2c8d50a 100644 --- a/third_party/llvm-project/libcxx/include/__chrono/duration.h +++ b/third_party/llvm-project/libcxx/include/__chrono/duration.h
@@ -10,6 +10,8 @@ #ifndef _LIBCPP___CHRONO_DURATION_H #define _LIBCPP___CHRONO_DURATION_H +#include <__compare/ordering.h> +#include <__compare/three_way_comparable.h> #include <__config> #include <__type_traits/common_type.h> #include <__type_traits/enable_if.h> @@ -130,7 +132,7 @@ template <class _Rep> struct _LIBCPP_TEMPLATE_VIS treat_as_floating_point : is_floating_point<_Rep> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Rep> inline constexpr bool treat_as_floating_point_v = treat_as_floating_point<_Rep>::value; #endif @@ -144,7 +146,7 @@ _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep min() _NOEXCEPT {return numeric_limits<_Rep>::lowest();} }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _ToDuration, class _Rep, class _Period> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename enable_if @@ -186,11 +188,11 @@ { _ToDuration __lower = chrono::floor<_ToDuration>(__d); _ToDuration __upper = __lower + _ToDuration{1}; - auto __lowerDiff = __d - __lower; - auto __upperDiff = __upper - __d; - if (__lowerDiff < __upperDiff) + auto __lower_diff = __d - __lower; + auto __upper_diff = __upper - __d; + if (__lower_diff < __upper_diff) return __lower; - if (__lowerDiff > __upperDiff) + if (__lower_diff > __upper_diff) return __upper; return __lower.count() & 1 ? __upper : __lower; } @@ -307,7 +309,7 @@ typedef duration<long long > seconds; typedef duration< long, ratio< 60> > minutes; typedef duration< long, ratio<3600> > hours; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 typedef duration< int, ratio_multiply<ratio<24>, hours::period>> days; typedef duration< int, ratio_multiply<ratio<7>, days::period>> weeks; typedef duration< int, ratio_multiply<ratio<146097, 400>, days::period>> years; @@ -343,6 +345,8 @@ return __duration_eq<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >()(__lhs, __rhs); } +#if _LIBCPP_STD_VER <= 17 + // Duration != template <class _Rep1, class _Period1, class _Rep2, class _Period2> @@ -354,6 +358,8 @@ return !(__lhs == __rhs); } +#endif // _LIBCPP_STD_VER <= 17 + // Duration < template <class _LhsDuration, class _RhsDuration> @@ -417,6 +423,20 @@ return !(__lhs < __rhs); } +#if _LIBCPP_STD_VER >= 20 + +template<class _Rep1, class _Period1, class _Rep2, class _Period2> + requires three_way_comparable<common_type_t<_Rep1, _Rep2>> +_LIBCPP_HIDE_FROM_ABI +constexpr auto operator<=>(const duration<_Rep1, _Period1>& __lhs, + const duration<_Rep2, _Period2>& __rhs) +{ + using _Ct = common_type_t<duration<_Rep1, _Period1>, duration<_Rep2, _Period2>>; + return _Ct(__lhs).count() <=> _Ct(__rhs).count(); +} + +#endif // _LIBCPP_STD_VER >= 20 + // Duration + template <class _Rep1, class _Period1, class _Rep2, class _Period2> @@ -530,7 +550,7 @@ } // namespace chrono -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 // Suffixes for duration literals [time.duration.literals] inline namespace literals { @@ -609,7 +629,7 @@ using namespace literals::chrono_literals; } // namespace chrono -#endif // _LIBCPP_STD_VER > 11 +#endif // _LIBCPP_STD_VER >= 14 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__chrono/file_clock.h b/third_party/llvm-project/libcxx/include/__chrono/file_clock.h index ef62b83..7a4dce9 100644 --- a/third_party/llvm-project/libcxx/include/__chrono/file_clock.h +++ b/third_party/llvm-project/libcxx/include/__chrono/file_clock.h
@@ -27,7 +27,7 @@ _LIBCPP_END_NAMESPACE_FILESYSTEM #endif // !_LIBCPP_CXX03_LANG -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -44,7 +44,7 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #ifndef _LIBCPP_CXX03_LANG _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM @@ -65,7 +65,7 @@ _LIBCPP_AVAILABILITY_FILESYSTEM _LIBCPP_FUNC_VIS static time_point now() noexcept; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Duration> _LIBCPP_HIDE_FROM_ABI static chrono::sys_time<_Duration> to_sys(const chrono::file_time<_Duration>& __t) { @@ -77,7 +77,7 @@ static chrono::file_time<_Duration> from_sys(const chrono::sys_time<_Duration>& __t) { return chrono::file_time<_Duration>(__t.time_since_epoch()); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 }; _LIBCPP_END_NAMESPACE_FILESYSTEM #endif // !_LIBCPP_CXX03_LANG
diff --git a/third_party/llvm-project/libcxx/include/__chrono/formatter.h b/third_party/llvm-project/libcxx/include/__chrono/formatter.h index 2015783..e73b043 100644 --- a/third_party/llvm-project/libcxx/include/__chrono/formatter.h +++ b/third_party/llvm-project/libcxx/include/__chrono/formatter.h
@@ -11,6 +11,7 @@ #define _LIBCPP___CHRONO_FORMATTER_H #include <__chrono/calendar.h> +#include <__chrono/concepts.h> #include <__chrono/convert_to_tm.h> #include <__chrono/day.h> #include <__chrono/duration.h> @@ -21,6 +22,7 @@ #include <__chrono/ostream.h> #include <__chrono/parser_std_format_spec.h> #include <__chrono/statically_widen.h> +#include <__chrono/system_clock.h> #include <__chrono/time_point.h> #include <__chrono/weekday.h> #include <__chrono/year.h> @@ -50,7 +52,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) +#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) namespace __formatter { @@ -75,13 +77,15 @@ // For tiny ratios it's not possible to convert a duration to a hh_mm_ss. This // fails compile-time due to the limited precision of the ratio (64-bit is too // small). Therefore a duration uses its own conversion. -template <class _CharT, class _Tp> - requires(chrono::__is_duration<_Tp>::value) -_LIBCPP_HIDE_FROM_ABI void __format_sub_seconds(const _Tp& __value, basic_stringstream<_CharT>& __sstr) { +template <class _CharT, class _Rep, class _Period> +_LIBCPP_HIDE_FROM_ABI void +__format_sub_seconds(const chrono::duration<_Rep, _Period>& __value, basic_stringstream<_CharT>& __sstr) { __sstr << std::use_facet<numpunct<_CharT>>(__sstr.getloc()).decimal_point(); + using __duration = chrono::duration<_Rep, _Period>; + auto __fraction = __value - chrono::duration_cast<chrono::seconds>(__value); - if constexpr (chrono::treat_as_floating_point_v<typename _Tp::rep>) + if constexpr (chrono::treat_as_floating_point_v<_Rep>) // When the floating-point value has digits itself they are ignored based // on the wording in [tab:time.format.spec] // If the precision of the input cannot be exactly represented with @@ -97,18 +101,43 @@ std::format_to(std::ostreambuf_iterator<_CharT>{__sstr}, _LIBCPP_STATICALLY_WIDEN(_CharT, "{:0{}.0f}"), __fraction.count(), - chrono::hh_mm_ss<_Tp>::fractional_width); + chrono::hh_mm_ss<__duration>::fractional_width); else std::format_to(std::ostreambuf_iterator<_CharT>{__sstr}, _LIBCPP_STATICALLY_WIDEN(_CharT, "{:0{}}"), __fraction.count(), - chrono::hh_mm_ss<_Tp>::fractional_width); + chrono::hh_mm_ss<__duration>::fractional_width); +} + +template <class _CharT, __is_time_point _Tp> +_LIBCPP_HIDE_FROM_ABI void __format_sub_seconds(const _Tp& __value, basic_stringstream<_CharT>& __sstr) { + __formatter::__format_sub_seconds(__value.time_since_epoch(), __sstr); +} + +template <class _CharT, class _Duration> +_LIBCPP_HIDE_FROM_ABI void +__format_sub_seconds(const chrono::hh_mm_ss<_Duration>& __value, basic_stringstream<_CharT>& __sstr) { + __sstr << std::use_facet<numpunct<_CharT>>(__sstr.getloc()).decimal_point(); + if constexpr (chrono::treat_as_floating_point_v<typename _Duration::rep>) + std::format_to(std::ostreambuf_iterator<_CharT>{__sstr}, + _LIBCPP_STATICALLY_WIDEN(_CharT, "{:0{}.0f}"), + __value.subseconds().count(), + __value.fractional_width); + else + std::format_to(std::ostreambuf_iterator<_CharT>{__sstr}, + _LIBCPP_STATICALLY_WIDEN(_CharT, "{:0{}}"), + __value.subseconds().count(), + __value.fractional_width); } template <class _Tp> consteval bool __use_fraction() { - if constexpr (chrono::__is_duration<_Tp>::value) + if constexpr (__is_time_point<_Tp>) + return chrono::hh_mm_ss<typename _Tp::duration>::fractional_width; + else if constexpr (chrono::__is_duration<_Tp>::value) return chrono::hh_mm_ss<_Tp>::fractional_width; + else if constexpr (__is_hh_mm_ss<_Tp>) + return _Tp::fractional_width; else return false; } @@ -169,7 +198,7 @@ if (__year < 1000 || __year > 9999) __formatter::__format_century(__year, __sstr); else - __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), __s, __it + 1); + __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1)); } break; case _CharT('j'): @@ -180,7 +209,7 @@ // an intemediate step. __sstr << chrono::duration_cast<chrono::days>(chrono::duration_cast<chrono::seconds>(__value)).count(); else - __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), __s, __it + 1); + __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1)); break; case _CharT('q'): @@ -208,7 +237,7 @@ case _CharT('S'): case _CharT('T'): - __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), __s, __it + 1); + __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1)); if constexpr (__use_fraction<_Tp>()) __formatter::__format_sub_seconds(__value, __sstr); break; @@ -252,7 +281,7 @@ if (__year < 1000) __formatter::__format_year(__year, __sstr); else - __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), __s, __it + 1); + __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1)); } break; case _CharT('F'): { @@ -261,9 +290,14 @@ __formatter::__format_year(__year, __sstr); __sstr << std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "-{:02}-{:02}"), __t.tm_mon + 1, __t.tm_mday); } else - __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), __s, __it + 1); + __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1)); } break; + case _CharT('Z'): + // TODO FMT Add proper timezone support. + __sstr << _LIBCPP_STATICALLY_WIDEN(_CharT, "UTC"); + break; + case _CharT('O'): if constexpr (__use_fraction<_Tp>()) { // Handle OS using the normal representation for the non-fractional @@ -271,7 +305,7 @@ // fractional part should be formatted. if (*(__it + 1) == 'S') { ++__it; - __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), __s, __it + 1); + __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1)); __formatter::__format_sub_seconds(__value, __sstr); break; } @@ -281,7 +315,7 @@ ++__it; [[fallthrough]]; default: - __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), __s, __it + 1); + __facet.put({__sstr}, __sstr, _CharT(' '), std::addressof(__t), std::to_address(__s), std::to_address(__it + 1)); break; } } else { @@ -292,7 +326,9 @@ template <class _Tp> _LIBCPP_HIDE_FROM_ABI constexpr bool __weekday_ok(const _Tp& __value) { - if constexpr (same_as<_Tp, chrono::day>) + if constexpr (__is_time_point<_Tp>) + return true; + else if constexpr (same_as<_Tp, chrono::day>) return true; else if constexpr (same_as<_Tp, chrono::month>) return __value.ok(); @@ -322,13 +358,17 @@ return __value.weekday().ok(); else if constexpr (same_as<_Tp, chrono::year_month_weekday_last>) return __value.weekday().ok(); + else if constexpr (__is_hh_mm_ss<_Tp>) + return true; else static_assert(sizeof(_Tp) == 0, "Add the missing type specialization"); } template <class _Tp> _LIBCPP_HIDE_FROM_ABI constexpr bool __weekday_name_ok(const _Tp& __value) { - if constexpr (same_as<_Tp, chrono::day>) + if constexpr (__is_time_point<_Tp>) + return true; + else if constexpr (same_as<_Tp, chrono::day>) return true; else if constexpr (same_as<_Tp, chrono::month>) return __value.ok(); @@ -358,13 +398,17 @@ return __value.weekday().ok(); else if constexpr (same_as<_Tp, chrono::year_month_weekday_last>) return __value.weekday().ok(); + else if constexpr (__is_hh_mm_ss<_Tp>) + return true; else static_assert(sizeof(_Tp) == 0, "Add the missing type specialization"); } template <class _Tp> _LIBCPP_HIDE_FROM_ABI constexpr bool __date_ok(const _Tp& __value) { - if constexpr (same_as<_Tp, chrono::day>) + if constexpr (__is_time_point<_Tp>) + return true; + else if constexpr (same_as<_Tp, chrono::day>) return true; else if constexpr (same_as<_Tp, chrono::month>) return __value.ok(); @@ -394,13 +438,17 @@ return __value.ok(); else if constexpr (same_as<_Tp, chrono::year_month_weekday_last>) return __value.ok(); + else if constexpr (__is_hh_mm_ss<_Tp>) + return true; else static_assert(sizeof(_Tp) == 0, "Add the missing type specialization"); } template <class _Tp> _LIBCPP_HIDE_FROM_ABI constexpr bool __month_name_ok(const _Tp& __value) { - if constexpr (same_as<_Tp, chrono::day>) + if constexpr (__is_time_point<_Tp>) + return true; + else if constexpr (same_as<_Tp, chrono::day>) return true; else if constexpr (same_as<_Tp, chrono::month>) return __value.ok(); @@ -430,6 +478,8 @@ return __value.month().ok(); else if constexpr (same_as<_Tp, chrono::year_month_weekday_last>) return __value.month().ok(); + else if constexpr (__is_hh_mm_ss<_Tp>) + return true; else static_assert(sizeof(_Tp) == 0, "Add the missing type specialization"); } @@ -478,6 +528,29 @@ if (__specs.__chrono_.__month_name_ && !__formatter::__month_name_ok(__value)) std::__throw_format_error("formatting a month name from an invalid month number"); + if constexpr (__is_hh_mm_ss<_Tp>) { + // Note this is a pedantic intepretation of the Standard. A hh_mm_ss + // is no longer a time_of_day and can store an arbitrary number of + // hours. A number of hours in a 12 or 24 hour clock can't represent + // 24 hours or more. The functions std::chrono::make12 and + // std::chrono::make24 reaffirm this view point. + // + // Interestingly this will be the only output stream function that + // throws. + // + // TODO FMT The wording probably needs to be adapted to + // - The displayed hours is hh_mm_ss.hours() % 24 + // - It should probably allow %j in the same fashion as duration. + // - The stream formatter should change its output when hours >= 24 + // - Write it as not valid, + // - or write the number of days. + if (__specs.__chrono_.__hour_ && __value.hours().count() > 23) + std::__throw_format_error("formatting a hour needs a valid value"); + + if (__value.is_negative()) + __sstr << _CharT('-'); + } + __formatter::__format_chrono_using_chrono_specs(__value, __sstr, __chrono_specs); } } @@ -490,7 +563,7 @@ } // namespace __formatter template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __formatter_chrono { +struct _LIBCPP_TEMPLATE_VIS __formatter_chrono { public: _LIBCPP_HIDE_FROM_ABI constexpr auto __parse( basic_format_parse_context<_CharT>& __parse_ctx, __format_spec::__fields __fields, __format_spec::__flags __flags) @@ -507,6 +580,17 @@ __format_spec::__parser_chrono<_CharT> __parser_; }; +template <class _Duration, __fmt_char_type _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<chrono::sys_time<_Duration>, _CharT> : public __formatter_chrono<_CharT> { +public: + using _Base = __formatter_chrono<_CharT>; + + _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) + -> decltype(__parse_ctx.begin()) { + return _Base::__parse(__parse_ctx, __format_spec::__fields_chrono, __format_spec::__flags::__clock); + } +}; + template <class _Rep, class _Period, __fmt_char_type _CharT> struct formatter<chrono::duration<_Rep, _Period>, _CharT> : public __formatter_chrono<_CharT> { public: @@ -530,7 +614,7 @@ }; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::day, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<chrono::day, _CharT> : public __formatter_chrono<_CharT> { public: using _Base = __formatter_chrono<_CharT>; @@ -542,7 +626,7 @@ }; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::month, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month, _CharT> : public __formatter_chrono<_CharT> { public: using _Base = __formatter_chrono<_CharT>; @@ -554,7 +638,7 @@ }; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::year, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year, _CharT> : public __formatter_chrono<_CharT> { public: using _Base = __formatter_chrono<_CharT>; @@ -566,7 +650,7 @@ }; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::weekday, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<chrono::weekday, _CharT> : public __formatter_chrono<_CharT> { public: using _Base = __formatter_chrono<_CharT>; @@ -578,7 +662,7 @@ }; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::weekday_indexed, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<chrono::weekday_indexed, _CharT> : public __formatter_chrono<_CharT> { public: using _Base = __formatter_chrono<_CharT>; @@ -590,7 +674,7 @@ }; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::weekday_last, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<chrono::weekday_last, _CharT> : public __formatter_chrono<_CharT> { public: using _Base = __formatter_chrono<_CharT>; @@ -602,7 +686,7 @@ }; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::month_day, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_day, _CharT> : public __formatter_chrono<_CharT> { public: using _Base = __formatter_chrono<_CharT>; @@ -614,7 +698,7 @@ }; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::month_day_last, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_day_last, _CharT> : public __formatter_chrono<_CharT> { public: using _Base = __formatter_chrono<_CharT>; @@ -626,7 +710,7 @@ }; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::month_weekday, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_weekday, _CharT> : public __formatter_chrono<_CharT> { public: using _Base = __formatter_chrono<_CharT>; @@ -638,7 +722,7 @@ }; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::month_weekday_last, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<chrono::month_weekday_last, _CharT> : public __formatter_chrono<_CharT> { public: using _Base = __formatter_chrono<_CharT>; @@ -650,7 +734,7 @@ }; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::year_month, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month, _CharT> : public __formatter_chrono<_CharT> { public: using _Base = __formatter_chrono<_CharT>; @@ -662,7 +746,7 @@ }; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::year_month_day, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_day, _CharT> : public __formatter_chrono<_CharT> { public: using _Base = __formatter_chrono<_CharT>; @@ -674,7 +758,7 @@ }; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::year_month_day_last, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_day_last, _CharT> : public __formatter_chrono<_CharT> { public: using _Base = __formatter_chrono<_CharT>; @@ -686,7 +770,7 @@ }; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::year_month_weekday, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_weekday, _CharT> : public __formatter_chrono<_CharT> { public: using _Base = __formatter_chrono<_CharT>; @@ -698,7 +782,7 @@ }; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<chrono::year_month_weekday_last, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<chrono::year_month_weekday_last, _CharT> : public __formatter_chrono<_CharT> { public: using _Base = __formatter_chrono<_CharT>; @@ -709,7 +793,17 @@ } }; -#endif // if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) +template <class _Duration, __fmt_char_type _CharT> +struct formatter<chrono::hh_mm_ss<_Duration>, _CharT> : public __formatter_chrono<_CharT> { +public: + using _Base = __formatter_chrono<_CharT>; + + _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) + -> decltype(__parse_ctx.begin()) { + return _Base::__parse(__parse_ctx, __format_spec::__fields_chrono, __format_spec::__flags::__time); + } +}; +#endif // if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__chrono/hh_mm_ss.h b/third_party/llvm-project/libcxx/include/__chrono/hh_mm_ss.h index fd61cbe..5bd452e 100644 --- a/third_party/llvm-project/libcxx/include/__chrono/hh_mm_ss.h +++ b/third_party/llvm-project/libcxx/include/__chrono/hh_mm_ss.h
@@ -13,14 +13,14 @@ #include <__chrono/duration.h> #include <__chrono/time_point.h> #include <__config> +#include <__type_traits/common_type.h> #include <ratio> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -85,6 +85,7 @@ chrono::seconds __s_; precision __f_; }; +_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(hh_mm_ss); _LIBCPP_HIDE_FROM_ABI constexpr bool is_am(const hours& __h) noexcept { return __h >= hours( 0) && __h < hours(12); } _LIBCPP_HIDE_FROM_ABI constexpr bool is_pm(const hours& __h) noexcept { return __h >= hours(12) && __h < hours(24); } @@ -107,6 +108,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___CHRONO_HH_MM_SS_H
diff --git a/third_party/llvm-project/libcxx/include/__chrono/literals.h b/third_party/llvm-project/libcxx/include/__chrono/literals.h index 50529bd..28ddc43 100644 --- a/third_party/llvm-project/libcxx/include/__chrono/literals.h +++ b/third_party/llvm-project/libcxx/include/__chrono/literals.h
@@ -18,7 +18,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -44,6 +44,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___CHRONO_LITERALS_H
diff --git a/third_party/llvm-project/libcxx/include/__chrono/month.h b/third_party/llvm-project/libcxx/include/__chrono/month.h index e929f24..ad679e4 100644 --- a/third_party/llvm-project/libcxx/include/__chrono/month.h +++ b/third_party/llvm-project/libcxx/include/__chrono/month.h
@@ -18,7 +18,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -98,6 +98,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___CHRONO_MONTH_H
diff --git a/third_party/llvm-project/libcxx/include/__chrono/month_weekday.h b/third_party/llvm-project/libcxx/include/__chrono/month_weekday.h index 01cdf76..802cbd7 100644 --- a/third_party/llvm-project/libcxx/include/__chrono/month_weekday.h +++ b/third_party/llvm-project/libcxx/include/__chrono/month_weekday.h
@@ -18,7 +18,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -101,6 +101,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___CHRONO_MONTH_WEEKDAY_H
diff --git a/third_party/llvm-project/libcxx/include/__chrono/monthday.h b/third_party/llvm-project/libcxx/include/__chrono/monthday.h index c0ee3e4..961b71e 100644 --- a/third_party/llvm-project/libcxx/include/__chrono/monthday.h +++ b/third_party/llvm-project/libcxx/include/__chrono/monthday.h
@@ -20,7 +20,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -124,6 +124,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___CHRONO_MONTHDAY_H
diff --git a/third_party/llvm-project/libcxx/include/__chrono/ostream.h b/third_party/llvm-project/libcxx/include/__chrono/ostream.h index 30a04bd..26df882 100644 --- a/third_party/llvm-project/libcxx/include/__chrono/ostream.h +++ b/third_party/llvm-project/libcxx/include/__chrono/ostream.h
@@ -12,10 +12,12 @@ #include <__chrono/day.h> #include <__chrono/duration.h> +#include <__chrono/hh_mm_ss.h> #include <__chrono/month.h> #include <__chrono/month_weekday.h> #include <__chrono/monthday.h> #include <__chrono/statically_widen.h> +#include <__chrono/system_clock.h> #include <__chrono/weekday.h> #include <__chrono/year.h> #include <__chrono/year_month.h> @@ -33,10 +35,16 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) +#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) namespace chrono { +template <class _CharT, class _Traits, class _Duration> +_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& +operator<<(basic_ostream<_CharT, _Traits>& __os, const sys_time<_Duration> __tp) { + return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%F %T}"), __tp); +} + // Depending on the type the return is a const _CharT* or a basic_string<_CharT> template <class _CharT, class _Period> _LIBCPP_HIDE_FROM_ABI auto __units_suffix() { @@ -92,7 +100,7 @@ } template <class _CharT, class _Traits, class _Rep, class _Period> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& +_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const duration<_Rep, _Period>& __d) { basic_ostringstream<_CharT, _Traits> __s; __s.flags(__os.flags()); @@ -103,21 +111,19 @@ } template <class _CharT, class _Traits> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& -operator<<(basic_ostream<_CharT, _Traits>& __os, const day& __d) { - return __os - << (__d.ok() - ? std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:%d}"), __d) - // Note this error differs from the wording of the Standard. The - // Standard wording doesn't work well on AIX or Windows. There - // the formatted day seems to be either modulo 100 or completely - // omitted. Judging by the wording this is valid. - // TODO FMT Write a paper of file an LWG issue. - : std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:02} is not a valid day"), static_cast<unsigned>(__d))); +_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const day& __d) { + return __os << (__d.ok() ? std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:%d}"), __d) + // Note this error differs from the wording of the Standard. The + // Standard wording doesn't work well on AIX or Windows. There + // the formatted day seems to be either modulo 100 or completely + // omitted. Judging by the wording this is valid. + // TODO FMT Write a paper of file an LWG issue. + : std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:02} is not a valid day"), + static_cast<unsigned>(__d))); } template <class _CharT, class _Traits> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& +_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const month& __m) { return __os << (__m.ok() ? std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%b}"), __m) : std::format(__os.getloc(), @@ -126,14 +132,14 @@ } template <class _CharT, class _Traits> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& +_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const year& __y) { return __os << (__y.ok() ? std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:%Y}"), __y) : std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:%Y} is not a valid year"), __y)); } template <class _CharT, class _Traits> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& +_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const weekday& __wd) { return __os << (__wd.ok() ? std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%a}"), __wd) : std::format(__os.getloc(), // TODO FMT Standard mandated locale isn't used. @@ -142,7 +148,7 @@ } template <class _CharT, class _Traits> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& +_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const weekday_indexed& __wdi) { auto __i = __wdi.index(); return __os << (__i >= 1 && __i <= 5 @@ -154,13 +160,13 @@ } template <class _CharT, class _Traits> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& +_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const weekday_last& __wdl) { return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}[last]"), __wdl.weekday()); } template <class _CharT, class _Traits> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& +_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const month_day& __md) { // TODO FMT The Standard allows 30th of February to be printed. // It would be nice to show an error message instead. @@ -168,47 +174,47 @@ } template <class _CharT, class _Traits> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& +_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const month_day_last& __mdl) { return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}/last"), __mdl.month()); } template <class _CharT, class _Traits> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& +_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const month_weekday& __mwd) { return __os << std::format( __os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}/{:L}"), __mwd.month(), __mwd.weekday_indexed()); } template <class _CharT, class _Traits> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& +_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const month_weekday_last& __mwdl) { return __os << std::format( __os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L}/{:L}"), __mwdl.month(), __mwdl.weekday_last()); } template <class _CharT, class _Traits> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& +_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const year_month& __ym) { return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{}/{:L}"), __ym.year(), __ym.month()); } template <class _CharT, class _Traits> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& +_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const year_month_day& __ymd) { return __os << (__ymd.ok() ? std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:%F}"), __ymd) : std::format(_LIBCPP_STATICALLY_WIDEN(_CharT, "{:%F} is not a valid date"), __ymd)); } template <class _CharT, class _Traits> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& +_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const year_month_day_last& __ymdl) { return __os << std::format( __os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{}/{:L}"), __ymdl.year(), __ymdl.month_day_last()); } template <class _CharT, class _Traits> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& +_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const year_month_weekday& __ymwd) { return __os << std::format( __os.getloc(), @@ -219,7 +225,7 @@ } template <class _CharT, class _Traits> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT basic_ostream<_CharT, _Traits>& +_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const year_month_weekday_last& __ymwdl) { return __os << std::format( __os.getloc(), @@ -229,9 +235,15 @@ __ymwdl.weekday_last()); } +template <class _CharT, class _Traits, class _Duration> +_LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& +operator<<(basic_ostream<_CharT, _Traits>& __os, const hh_mm_ss<_Duration> __hms) { + return __os << std::format(__os.getloc(), _LIBCPP_STATICALLY_WIDEN(_CharT, "{:L%T}"), __hms); +} + } // namespace chrono -#endif //if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) +#endif // if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__chrono/parser_std_format_spec.h b/third_party/llvm-project/libcxx/include/__chrono/parser_std_format_spec.h index dbcfe6d..27b8aa7 100644 --- a/third_party/llvm-project/libcxx/include/__chrono/parser_std_format_spec.h +++ b/third_party/llvm-project/libcxx/include/__chrono/parser_std_format_spec.h
@@ -24,7 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) +#if _LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) namespace __format_spec { @@ -137,17 +137,19 @@ template <class _CharT> class _LIBCPP_TEMPLATE_VIS __parser_chrono { + using _ConstIterator = typename basic_format_parse_context<_CharT>::const_iterator; + public: _LIBCPP_HIDE_FROM_ABI constexpr auto __parse(basic_format_parse_context<_CharT>& __parse_ctx, __fields __fields, __flags __flags) -> decltype(__parse_ctx.begin()) { - const _CharT* __begin = __parser_.__parse(__parse_ctx, __fields); - const _CharT* __end = __parse_ctx.end(); + _ConstIterator __begin = __parser_.__parse(__parse_ctx, __fields); + _ConstIterator __end = __parse_ctx.end(); if (__begin == __end) return __begin; - const _CharT* __last = __parse_chrono_specs(__begin, __end, __flags); - __chrono_specs_ = basic_string_view<_CharT>{__begin, __last}; + _ConstIterator __last = __parse_chrono_specs(__begin, __end, __flags); + __chrono_specs_ = basic_string_view<_CharT>{__begin, __last}; return __last; } @@ -156,8 +158,8 @@ basic_string_view<_CharT> __chrono_specs_; private: - _LIBCPP_HIDE_FROM_ABI constexpr const _CharT* - __parse_chrono_specs(const _CharT* __begin, const _CharT* __end, __flags __flags) { + _LIBCPP_HIDE_FROM_ABI constexpr _ConstIterator + __parse_chrono_specs(_ConstIterator __begin, _ConstIterator __end, __flags __flags) { _LIBCPP_ASSERT(__begin != __end, "When called with an empty input the function will cause " "undefined behavior by evaluating data not in the input"); @@ -190,7 +192,7 @@ /// \pre *__begin == '%' /// \post __begin points at the end parsed conversion-spec _LIBCPP_HIDE_FROM_ABI constexpr void - __parse_conversion_spec(const _CharT*& __begin, const _CharT* __end, __flags __flags) { + __parse_conversion_spec(_ConstIterator& __begin, _ConstIterator __end, __flags __flags) { ++__begin; if (__begin == __end) std::__throw_format_error("End of input while parsing the modifier chrono conversion-spec"); @@ -212,6 +214,7 @@ case _CharT('p'): // TODO FMT does the formater require an hour or a time? case _CharT('H'): case _CharT('I'): + __parser_.__hour_ = true; __validate_hour(__flags); break; @@ -219,6 +222,7 @@ case _CharT('R'): case _CharT('T'): case _CharT('X'): + __parser_.__hour_ = true; __format_spec::__validate_time(__flags); break; @@ -304,13 +308,14 @@ /// \pre *__begin == 'E' /// \post __begin is incremented by one. _LIBCPP_HIDE_FROM_ABI constexpr void - __parse_modifier_E(const _CharT*& __begin, const _CharT* __end, __flags __flags) { + __parse_modifier_E(_ConstIterator& __begin, _ConstIterator __end, __flags __flags) { ++__begin; if (__begin == __end) std::__throw_format_error("End of input while parsing the modifier E"); switch (*__begin) { case _CharT('X'): + __parser_.__hour_ = true; __format_spec::__validate_time(__flags); break; @@ -343,7 +348,7 @@ /// \pre *__begin == 'O' /// \post __begin is incremented by one. _LIBCPP_HIDE_FROM_ABI constexpr void - __parse_modifier_O(const _CharT*& __begin, const _CharT* __end, __flags __flags) { + __parse_modifier_O(_ConstIterator& __begin, _ConstIterator __end, __flags __flags) { ++__begin; if (__begin == __end) std::__throw_format_error("End of input while parsing the modifier O"); @@ -359,6 +364,7 @@ case _CharT('I'): case _CharT('H'): + __parser_.__hour_ = true; __format_spec::__validate_hour(__flags); break; @@ -403,7 +409,7 @@ } // namespace __format_spec -#endif //_LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) +#endif //_LIBCPP_STD_VER >= 20 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__chrono/statically_widen.h b/third_party/llvm-project/libcxx/include/__chrono/statically_widen.h index 360b6c2..cc1d586 100644 --- a/third_party/llvm-project/libcxx/include/__chrono/statically_widen.h +++ b/third_party/llvm-project/libcxx/include/__chrono/statically_widen.h
@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <__fmt_char_type _CharT> @@ -45,7 +45,7 @@ # define _LIBCPP_STATICALLY_WIDEN(_CharT, __str) ::std::__statically_widen<_CharT>(__str) # endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__chrono/system_clock.h b/third_party/llvm-project/libcxx/include/__chrono/system_clock.h index 331db46..e8a41ce 100644 --- a/third_party/llvm-project/libcxx/include/__chrono/system_clock.h +++ b/third_party/llvm-project/libcxx/include/__chrono/system_clock.h
@@ -38,7 +38,7 @@ static time_point from_time_t(time_t __t) _NOEXCEPT; }; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Duration> using sys_time = time_point<system_clock, _Duration>;
diff --git a/third_party/llvm-project/libcxx/include/__chrono/time_point.h b/third_party/llvm-project/libcxx/include/__chrono/time_point.h index 8a8fa21..c148354 100644 --- a/third_party/llvm-project/libcxx/include/__chrono/time_point.h +++ b/third_party/llvm-project/libcxx/include/__chrono/time_point.h
@@ -11,6 +11,8 @@ #define _LIBCPP___CHRONO_TIME_POINT_H #include <__chrono/duration.h> +#include <__compare/ordering.h> +#include <__compare/three_way_comparable.h> #include <__config> #include <__type_traits/common_type.h> #include <__type_traits/enable_if.h> @@ -90,7 +92,7 @@ return time_point<_Clock, _ToDuration>(chrono::duration_cast<_ToDuration>(__t.time_since_epoch())); } -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _ToDuration, class _Clock, class _Duration> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename enable_if @@ -138,7 +140,7 @@ { return __d >= __d.zero() ? +__d : -__d; } -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 // time_point == @@ -150,6 +152,8 @@ return __lhs.time_since_epoch() == __rhs.time_since_epoch(); } +#if _LIBCPP_STD_VER <= 17 + // time_point != template <class _Clock, class _Duration1, class _Duration2> @@ -160,6 +164,8 @@ return !(__lhs == __rhs); } +#endif // _LIBCPP_STD_VER <= 17 + // time_point < template <class _Clock, class _Duration1, class _Duration2> @@ -200,6 +206,16 @@ return !(__lhs < __rhs); } +#if _LIBCPP_STD_VER >= 20 + +template <class _Clock, class _Duration1, three_way_comparable_with<_Duration1> _Duration2> +_LIBCPP_HIDE_FROM_ABI constexpr auto +operator<=>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs) { + return __lhs.time_since_epoch() <=> __rhs.time_since_epoch(); +} + +#endif // _LIBCPP_STD_VER >= 20 + // time_point operator+(time_point x, duration y); template <class _Clock, class _Duration1, class _Rep2, class _Period2>
diff --git a/third_party/llvm-project/libcxx/include/__chrono/weekday.h b/third_party/llvm-project/libcxx/include/__chrono/weekday.h index e0bc8a4..ed9530f 100644 --- a/third_party/llvm-project/libcxx/include/__chrono/weekday.h +++ b/third_party/llvm-project/libcxx/include/__chrono/weekday.h
@@ -20,7 +20,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -180,6 +180,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___CHRONO_WEEKDAY_H
diff --git a/third_party/llvm-project/libcxx/include/__chrono/year.h b/third_party/llvm-project/libcxx/include/__chrono/year.h index 79ee8a0..d5251aa 100644 --- a/third_party/llvm-project/libcxx/include/__chrono/year.h +++ b/third_party/llvm-project/libcxx/include/__chrono/year.h
@@ -22,7 +22,7 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -95,7 +95,7 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_POP_MACROS
diff --git a/third_party/llvm-project/libcxx/include/__chrono/year_month.h b/third_party/llvm-project/libcxx/include/__chrono/year_month.h index 9f1e65c..7a6acff 100644 --- a/third_party/llvm-project/libcxx/include/__chrono/year_month.h +++ b/third_party/llvm-project/libcxx/include/__chrono/year_month.h
@@ -20,7 +20,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -96,6 +96,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___CHRONO_YEAR_MONTH_H
diff --git a/third_party/llvm-project/libcxx/include/__chrono/year_month_day.h b/third_party/llvm-project/libcxx/include/__chrono/year_month_day.h index b749014..4d64db3 100644 --- a/third_party/llvm-project/libcxx/include/__chrono/year_month_day.h +++ b/third_party/llvm-project/libcxx/include/__chrono/year_month_day.h
@@ -27,7 +27,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -302,6 +302,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___CHRONO_YEAR_MONTH_DAY_H
diff --git a/third_party/llvm-project/libcxx/include/__chrono/year_month_weekday.h b/third_party/llvm-project/libcxx/include/__chrono/year_month_weekday.h index 6604dea..b667120 100644 --- a/third_party/llvm-project/libcxx/include/__chrono/year_month_weekday.h +++ b/third_party/llvm-project/libcxx/include/__chrono/year_month_weekday.h
@@ -27,7 +27,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -250,6 +250,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP___CHRONO_YEAR_MONTH_WEEKDAY_H
diff --git a/third_party/llvm-project/libcxx/include/__compare/common_comparison_category.h b/third_party/llvm-project/libcxx/include/__compare/common_comparison_category.h index 06c4b28..5fad99b 100644 --- a/third_party/llvm-project/libcxx/include/__compare/common_comparison_category.h +++ b/third_party/llvm-project/libcxx/include/__compare/common_comparison_category.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace __comp_detail { @@ -65,14 +65,14 @@ constexpr auto __get_comp_type() { using _CCC = _ClassifyCompCategory; constexpr _CCC __type_kinds[] = {_StrongOrd, __type_to_enum<_Ts>()...}; - constexpr _CCC _Cat = __comp_detail::__compute_comp_type(__type_kinds); - if constexpr (_Cat == _None) + constexpr _CCC __cat = __comp_detail::__compute_comp_type(__type_kinds); + if constexpr (__cat == _None) return void(); - else if constexpr (_Cat == _PartialOrd) + else if constexpr (__cat == _PartialOrd) return partial_ordering::equivalent; - else if constexpr (_Cat == _WeakOrd) + else if constexpr (__cat == _WeakOrd) return weak_ordering::equivalent; - else if constexpr (_Cat == _StrongOrd) + else if constexpr (__cat == _StrongOrd) return strong_ordering::equivalent; else static_assert(_False, "unhandled case"); @@ -88,7 +88,7 @@ template<class... _Ts> using common_comparison_category_t = typename common_comparison_category<_Ts...>::type; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__compare/compare_partial_order_fallback.h b/third_party/llvm-project/libcxx/include/__compare/compare_partial_order_fallback.h index 06f03fe..fb2921e 100644 --- a/third_party/llvm-project/libcxx/include/__compare/compare_partial_order_fallback.h +++ b/third_party/llvm-project/libcxx/include/__compare/compare_partial_order_fallback.h
@@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [cmp.alg] namespace __compare_partial_order_fallback { @@ -67,7 +67,7 @@ inline constexpr auto compare_partial_order_fallback = __compare_partial_order_fallback::__fn{}; } // namespace __cpo -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__compare/compare_strong_order_fallback.h b/third_party/llvm-project/libcxx/include/__compare/compare_strong_order_fallback.h index 8693868..d84d065 100644 --- a/third_party/llvm-project/libcxx/include/__compare/compare_strong_order_fallback.h +++ b/third_party/llvm-project/libcxx/include/__compare/compare_strong_order_fallback.h
@@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [cmp.alg] namespace __compare_strong_order_fallback { @@ -64,7 +64,7 @@ inline constexpr auto compare_strong_order_fallback = __compare_strong_order_fallback::__fn{}; } // namespace __cpo -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__compare/compare_three_way.h b/third_party/llvm-project/libcxx/include/__compare/compare_three_way.h index fdbba04..2bc63a0 100644 --- a/third_party/llvm-project/libcxx/include/__compare/compare_three_way.h +++ b/third_party/llvm-project/libcxx/include/__compare/compare_three_way.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 struct _LIBCPP_TEMPLATE_VIS compare_three_way { @@ -34,7 +34,7 @@ using is_transparent = void; }; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__compare/compare_three_way_result.h b/third_party/llvm-project/libcxx/include/__compare/compare_three_way_result.h index 8885d7e..632ebdc 100644 --- a/third_party/llvm-project/libcxx/include/__compare/compare_three_way_result.h +++ b/third_party/llvm-project/libcxx/include/__compare/compare_three_way_result.h
@@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template<class, class, class> struct _LIBCPP_HIDE_FROM_ABI __compare_three_way_result { }; @@ -37,7 +37,7 @@ template<class _Tp, class _Up = _Tp> using compare_three_way_result_t = typename compare_three_way_result<_Tp, _Up>::type; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__compare/compare_weak_order_fallback.h b/third_party/llvm-project/libcxx/include/__compare/compare_weak_order_fallback.h index f434dcb..d3ba04a 100644 --- a/third_party/llvm-project/libcxx/include/__compare/compare_weak_order_fallback.h +++ b/third_party/llvm-project/libcxx/include/__compare/compare_weak_order_fallback.h
@@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [cmp.alg] namespace __compare_weak_order_fallback { @@ -64,7 +64,7 @@ inline constexpr auto compare_weak_order_fallback = __compare_weak_order_fallback::__fn{}; } // namespace __cpo -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__compare/is_eq.h b/third_party/llvm-project/libcxx/include/__compare/is_eq.h index 4964892..9a82df1 100644 --- a/third_party/llvm-project/libcxx/include/__compare/is_eq.h +++ b/third_party/llvm-project/libcxx/include/__compare/is_eq.h
@@ -18,7 +18,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_eq(partial_ordering __c) noexcept { return __c == 0; } _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_neq(partial_ordering __c) noexcept { return __c != 0; } @@ -27,7 +27,7 @@ _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_gt(partial_ordering __c) noexcept { return __c > 0; } _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_gteq(partial_ordering __c) noexcept { return __c >= 0; } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__compare/ordering.h b/third_party/llvm-project/libcxx/include/__compare/ordering.h index ff148ab..c348f04 100644 --- a/third_party/llvm-project/libcxx/include/__compare/ordering.h +++ b/third_party/llvm-project/libcxx/include/__compare/ordering.h
@@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // exposition only enum class _LIBCPP_ENUM_VIS _OrdResult : signed char { @@ -40,7 +40,7 @@ inline constexpr bool __one_of_v = (is_same_v<_Tp, _Args> || ...); struct _CmpUnspecifiedParam { - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEVAL + _LIBCPP_HIDE_FROM_ABI constexpr _CmpUnspecifiedParam(int _CmpUnspecifiedParam::*) noexcept {} template<class _Tp, class = enable_if_t<!__one_of_v<_Tp, int, partial_ordering, weak_ordering, strong_ordering>>> @@ -319,7 +319,7 @@ template <class _Tp> concept __comparison_category = __one_of_v<_Tp, partial_ordering, weak_ordering, strong_ordering>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__compare/partial_order.h b/third_party/llvm-project/libcxx/include/__compare/partial_order.h index aee07eb..9cb76cc 100644 --- a/third_party/llvm-project/libcxx/include/__compare/partial_order.h +++ b/third_party/llvm-project/libcxx/include/__compare/partial_order.h
@@ -24,7 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [cmp.alg] namespace __partial_order { @@ -67,7 +67,7 @@ inline constexpr auto partial_order = __partial_order::__fn{}; } // namespace __cpo -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__compare/strong_order.h b/third_party/llvm-project/libcxx/include/__compare/strong_order.h index 05856c2..b6e0cfa 100644 --- a/third_party/llvm-project/libcxx/include/__compare/strong_order.h +++ b/third_party/llvm-project/libcxx/include/__compare/strong_order.h
@@ -30,7 +30,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [cmp.alg] namespace __strong_order { @@ -130,7 +130,7 @@ inline constexpr auto strong_order = __strong_order::__fn{}; } // namespace __cpo -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__compare/synth_three_way.h b/third_party/llvm-project/libcxx/include/__compare/synth_three_way.h index 7d33898..6420d13 100644 --- a/third_party/llvm-project/libcxx/include/__compare/synth_three_way.h +++ b/third_party/llvm-project/libcxx/include/__compare/synth_three_way.h
@@ -21,30 +21,36 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [expos.only.func] -_LIBCPP_HIDE_FROM_ABI inline constexpr auto __synth_three_way = - []<class _Tp, class _Up>(const _Tp& __t, const _Up& __u) - requires requires { - { __t < __u } -> __boolean_testable; - { __u < __t } -> __boolean_testable; - } - { - if constexpr (three_way_comparable_with<_Tp, _Up>) { - return __t <=> __u; - } else { - if (__t < __u) return weak_ordering::less; - if (__u < __t) return weak_ordering::greater; - return weak_ordering::equivalent; - } - }; +// TODO MODULES restore the lamba to match the Standard. +// See https://github.com/llvm/llvm-project/issues/57222 +//_LIBCPP_HIDE_FROM_ABI inline constexpr auto __synth_three_way = +// []<class _Tp, class _Up>(const _Tp& __t, const _Up& __u) +template <class _Tp, class _Up> +_LIBCPP_HIDE_FROM_ABI constexpr auto __synth_three_way(const _Tp& __t, const _Up& __u) + requires requires { + { __t < __u } -> __boolean_testable; + { __u < __t } -> __boolean_testable; + } +{ + if constexpr (three_way_comparable_with<_Tp, _Up>) { + return __t <=> __u; + } else { + if (__t < __u) + return weak_ordering::less; + if (__u < __t) + return weak_ordering::greater; + return weak_ordering::equivalent; + } +} template <class _Tp, class _Up = _Tp> using __synth_three_way_result = decltype(std::__synth_three_way(std::declval<_Tp&>(), std::declval<_Up&>())); -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__compare/three_way_comparable.h b/third_party/llvm-project/libcxx/include/__compare/three_way_comparable.h index 6c98916..2b77bc3 100644 --- a/third_party/llvm-project/libcxx/include/__compare/three_way_comparable.h +++ b/third_party/llvm-project/libcxx/include/__compare/three_way_comparable.h
@@ -25,7 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template<class _Tp, class _Cat> concept __compares_as = @@ -52,7 +52,7 @@ { __u <=> __t } -> __compares_as<_Cat>; }; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__compare/weak_order.h b/third_party/llvm-project/libcxx/include/__compare/weak_order.h index abb24e3..9cbc1d2 100644 --- a/third_party/llvm-project/libcxx/include/__compare/weak_order.h +++ b/third_party/llvm-project/libcxx/include/__compare/weak_order.h
@@ -24,7 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [cmp.alg] namespace __weak_order { @@ -95,7 +95,7 @@ inline constexpr auto weak_order = __weak_order::__fn{}; } // namespace __cpo -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__concepts/arithmetic.h b/third_party/llvm-project/libcxx/include/__concepts/arithmetic.h index 215b52a..91a0b18 100644 --- a/third_party/llvm-project/libcxx/include/__concepts/arithmetic.h +++ b/third_party/llvm-project/libcxx/include/__concepts/arithmetic.h
@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concepts.arithmetic], arithmetic concepts @@ -45,7 +45,7 @@ template <class _Tp> concept __libcpp_signed_integer = __libcpp_is_signed_integer<_Tp>::value; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__concepts/assignable.h b/third_party/llvm-project/libcxx/include/__concepts/assignable.h index 91edd40..2dabae5 100644 --- a/third_party/llvm-project/libcxx/include/__concepts/assignable.h +++ b/third_party/llvm-project/libcxx/include/__concepts/assignable.h
@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.assignable] @@ -34,7 +34,7 @@ { __lhs = _VSTD::forward<_Rhs>(__rhs) } -> same_as<_Lhs>; }; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__concepts/boolean_testable.h b/third_party/llvm-project/libcxx/include/__concepts/boolean_testable.h index a96bde7..8efb6e5 100644 --- a/third_party/llvm-project/libcxx/include/__concepts/boolean_testable.h +++ b/third_party/llvm-project/libcxx/include/__concepts/boolean_testable.h
@@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concepts.booleantestable] @@ -31,7 +31,7 @@ { !_VSTD::forward<_Tp>(__t) } -> __boolean_testable_impl; }; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__concepts/class_or_enum.h b/third_party/llvm-project/libcxx/include/__concepts/class_or_enum.h index c4d2f98..04c24bd 100644 --- a/third_party/llvm-project/libcxx/include/__concepts/class_or_enum.h +++ b/third_party/llvm-project/libcxx/include/__concepts/class_or_enum.h
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // Whether a type is a class type or enumeration type according to the Core wording. @@ -33,7 +33,7 @@ template<class _Tp> concept __workaround_52970 = is_class_v<__remove_cvref_t<_Tp>> || is_union_v<__remove_cvref_t<_Tp>>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__concepts/common_reference_with.h b/third_party/llvm-project/libcxx/include/__concepts/common_reference_with.h index cc92762..6ad0db2 100644 --- a/third_party/llvm-project/libcxx/include/__concepts/common_reference_with.h +++ b/third_party/llvm-project/libcxx/include/__concepts/common_reference_with.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.commonref] @@ -30,7 +30,7 @@ convertible_to<_Tp, common_reference_t<_Tp, _Up>> && convertible_to<_Up, common_reference_t<_Tp, _Up>>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__concepts/common_with.h b/third_party/llvm-project/libcxx/include/__concepts/common_with.h index 569a0ee..e159bcc 100644 --- a/third_party/llvm-project/libcxx/include/__concepts/common_with.h +++ b/third_party/llvm-project/libcxx/include/__concepts/common_with.h
@@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.common] @@ -43,7 +43,7 @@ add_lvalue_reference_t<const _Tp>, add_lvalue_reference_t<const _Up>>>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__concepts/constructible.h b/third_party/llvm-project/libcxx/include/__concepts/constructible.h index 1d78eb5..6e3862c 100644 --- a/third_party/llvm-project/libcxx/include/__concepts/constructible.h +++ b/third_party/llvm-project/libcxx/include/__concepts/constructible.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.constructible] template<class _Tp, class... _Args> @@ -49,7 +49,7 @@ constructible_from<_Tp, const _Tp&> && convertible_to<const _Tp&, _Tp> && constructible_from<_Tp, const _Tp> && convertible_to<const _Tp, _Tp>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__concepts/convertible_to.h b/third_party/llvm-project/libcxx/include/__concepts/convertible_to.h index 2c1d267..20ee31b 100644 --- a/third_party/llvm-project/libcxx/include/__concepts/convertible_to.h +++ b/third_party/llvm-project/libcxx/include/__concepts/convertible_to.h
@@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.convertible] @@ -30,7 +30,7 @@ static_cast<_To>(std::declval<_From>()); }; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__concepts/copyable.h b/third_party/llvm-project/libcxx/include/__concepts/copyable.h index c5d8a80..0d6dd50 100644 --- a/third_party/llvm-project/libcxx/include/__concepts/copyable.h +++ b/third_party/llvm-project/libcxx/include/__concepts/copyable.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concepts.object] @@ -32,7 +32,7 @@ assignable_from<_Tp&, const _Tp&> && assignable_from<_Tp&, const _Tp>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__concepts/derived_from.h b/third_party/llvm-project/libcxx/include/__concepts/derived_from.h index 0d3462d..1cbe458 100644 --- a/third_party/llvm-project/libcxx/include/__concepts/derived_from.h +++ b/third_party/llvm-project/libcxx/include/__concepts/derived_from.h
@@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.derived] @@ -28,7 +28,7 @@ is_base_of_v<_Bp, _Dp> && is_convertible_v<const volatile _Dp*, const volatile _Bp*>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__concepts/destructible.h b/third_party/llvm-project/libcxx/include/__concepts/destructible.h index ad3819d..8da9c37 100644 --- a/third_party/llvm-project/libcxx/include/__concepts/destructible.h +++ b/third_party/llvm-project/libcxx/include/__concepts/destructible.h
@@ -18,14 +18,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.destructible] template<class _Tp> concept destructible = is_nothrow_destructible_v<_Tp>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__concepts/different_from.h b/third_party/llvm-project/libcxx/include/__concepts/different_from.h index 15fd8f0..5ef1467 100644 --- a/third_party/llvm-project/libcxx/include/__concepts/different_from.h +++ b/third_party/llvm-project/libcxx/include/__concepts/different_from.h
@@ -19,12 +19,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template<class _Tp, class _Up> concept __different_from = !same_as<remove_cvref_t<_Tp>, remove_cvref_t<_Up>>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__concepts/equality_comparable.h b/third_party/llvm-project/libcxx/include/__concepts/equality_comparable.h index b865141..f106288 100644 --- a/third_party/llvm-project/libcxx/include/__concepts/equality_comparable.h +++ b/third_party/llvm-project/libcxx/include/__concepts/equality_comparable.h
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.equalitycomparable] @@ -47,7 +47,7 @@ __make_const_lvalue_ref<_Up>>> && __weakly_equality_comparable_with<_Tp, _Up>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__concepts/invocable.h b/third_party/llvm-project/libcxx/include/__concepts/invocable.h index ec39b7b..59eab01 100644 --- a/third_party/llvm-project/libcxx/include/__concepts/invocable.h +++ b/third_party/llvm-project/libcxx/include/__concepts/invocable.h
@@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.invocable] @@ -33,7 +33,7 @@ template<class _Fn, class... _Args> concept regular_invocable = invocable<_Fn, _Args...>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__concepts/movable.h b/third_party/llvm-project/libcxx/include/__concepts/movable.h index 749b78a..f37d49f 100644 --- a/third_party/llvm-project/libcxx/include/__concepts/movable.h +++ b/third_party/llvm-project/libcxx/include/__concepts/movable.h
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concepts.object] @@ -32,7 +32,7 @@ assignable_from<_Tp&, _Tp> && swappable<_Tp>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__concepts/predicate.h b/third_party/llvm-project/libcxx/include/__concepts/predicate.h index 7ae9783..b09183c 100644 --- a/third_party/llvm-project/libcxx/include/__concepts/predicate.h +++ b/third_party/llvm-project/libcxx/include/__concepts/predicate.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.predicate] @@ -28,7 +28,7 @@ concept predicate = regular_invocable<_Fn, _Args...> && __boolean_testable<invoke_result_t<_Fn, _Args...>>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__concepts/regular.h b/third_party/llvm-project/libcxx/include/__concepts/regular.h index d15728d..93fb701 100644 --- a/third_party/llvm-project/libcxx/include/__concepts/regular.h +++ b/third_party/llvm-project/libcxx/include/__concepts/regular.h
@@ -19,14 +19,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.object] template<class _Tp> concept regular = semiregular<_Tp> && equality_comparable<_Tp>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__concepts/relation.h b/third_party/llvm-project/libcxx/include/__concepts/relation.h index 7d5141c..218afef 100644 --- a/third_party/llvm-project/libcxx/include/__concepts/relation.h +++ b/third_party/llvm-project/libcxx/include/__concepts/relation.h
@@ -18,7 +18,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.relation] @@ -37,7 +37,7 @@ template<class _Rp, class _Tp, class _Up> concept strict_weak_order = relation<_Rp, _Tp, _Up>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__concepts/same_as.h b/third_party/llvm-project/libcxx/include/__concepts/same_as.h index 554ebc3..b86cada 100644 --- a/third_party/llvm-project/libcxx/include/__concepts/same_as.h +++ b/third_party/llvm-project/libcxx/include/__concepts/same_as.h
@@ -18,7 +18,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.same] @@ -28,7 +28,7 @@ template<class _Tp, class _Up> concept same_as = __same_as_impl<_Tp, _Up> && __same_as_impl<_Up, _Tp>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__concepts/semiregular.h b/third_party/llvm-project/libcxx/include/__concepts/semiregular.h index d15bb3b..ae2f3c6 100644 --- a/third_party/llvm-project/libcxx/include/__concepts/semiregular.h +++ b/third_party/llvm-project/libcxx/include/__concepts/semiregular.h
@@ -19,14 +19,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.object] template<class _Tp> concept semiregular = copyable<_Tp> && default_initializable<_Tp>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__concepts/swappable.h b/third_party/llvm-project/libcxx/include/__concepts/swappable.h index d91a7a1..340691d 100644 --- a/third_party/llvm-project/libcxx/include/__concepts/swappable.h +++ b/third_party/llvm-project/libcxx/include/__concepts/swappable.h
@@ -30,7 +30,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.swappable] @@ -114,7 +114,7 @@ ranges::swap(_VSTD::forward<_Up>(__u), _VSTD::forward<_Tp>(__t)); }; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__concepts/totally_ordered.h b/third_party/llvm-project/libcxx/include/__concepts/totally_ordered.h index f12d26b..350eff3 100644 --- a/third_party/llvm-project/libcxx/include/__concepts/totally_ordered.h +++ b/third_party/llvm-project/libcxx/include/__concepts/totally_ordered.h
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [concept.totallyordered] @@ -51,7 +51,7 @@ __make_const_lvalue_ref<_Up>>> && __partially_ordered_with<_Tp, _Up>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__condition_variable/condition_variable.h b/third_party/llvm-project/libcxx/include/__condition_variable/condition_variable.h new file mode 100644 index 0000000..10b0662 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__condition_variable/condition_variable.h
@@ -0,0 +1,243 @@ +//===----------------------------------------------------------------------===// +// +// 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___CONDITION_VARIABLE_CONDITION_VARIABLE_H +#define _LIBCPP___CONDITION_VARIABLE_CONDITION_VARIABLE_H + +#include <__chrono/steady_clock.h> +#include <__chrono/system_clock.h> +#include <__chrono/time_point.h> +#include <__config> +#include <__mutex/mutex.h> +#include <__mutex/unique_lock.h> +#include <__system_error/system_error.h> +#include <__threading_support> +#include <__type_traits/enable_if.h> +#include <__type_traits/is_floating_point.h> +#include <__utility/move.h> +#include <ratio> + +#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_HAS_NO_THREADS + +// enum class cv_status +_LIBCPP_DECLARE_STRONG_ENUM(cv_status){no_timeout, timeout}; +_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(cv_status) + +class _LIBCPP_TYPE_VIS condition_variable { + __libcpp_condvar_t __cv_ = _LIBCPP_CONDVAR_INITIALIZER; + +public: + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR condition_variable() _NOEXCEPT = default; + +# ifdef _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION + ~condition_variable() = default; +# else + ~condition_variable(); +# endif + + condition_variable(const condition_variable&) = delete; + condition_variable& operator=(const condition_variable&) = delete; + + void notify_one() _NOEXCEPT; + void notify_all() _NOEXCEPT; + + void wait(unique_lock<mutex>& __lk) _NOEXCEPT; + template <class _Predicate> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS void wait(unique_lock<mutex>& __lk, _Predicate __pred); + + template <class _Clock, class _Duration> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS cv_status + wait_until(unique_lock<mutex>& __lk, const chrono::time_point<_Clock, _Duration>& __t); + + template <class _Clock, class _Duration, class _Predicate> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS bool + wait_until(unique_lock<mutex>& __lk, const chrono::time_point<_Clock, _Duration>& __t, _Predicate __pred); + + template <class _Rep, class _Period> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS cv_status + wait_for(unique_lock<mutex>& __lk, const chrono::duration<_Rep, _Period>& __d); + + template <class _Rep, class _Period, class _Predicate> + bool _LIBCPP_HIDE_FROM_ABI + wait_for(unique_lock<mutex>& __lk, const chrono::duration<_Rep, _Period>& __d, _Predicate __pred); + + typedef __libcpp_condvar_t* native_handle_type; + _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() { return &__cv_; } + +private: + void + __do_timed_wait(unique_lock<mutex>& __lk, chrono::time_point<chrono::system_clock, chrono::nanoseconds>) _NOEXCEPT; +# if defined(_LIBCPP_HAS_COND_CLOCKWAIT) + void + __do_timed_wait(unique_lock<mutex>& __lk, chrono::time_point<chrono::steady_clock, chrono::nanoseconds>) _NOEXCEPT; +# endif + template <class _Clock> + void __do_timed_wait(unique_lock<mutex>& __lk, chrono::time_point<_Clock, chrono::nanoseconds>) _NOEXCEPT; +}; +#endif // !_LIBCPP_HAS_NO_THREADS + +template <class _Rep, class _Period> +inline _LIBCPP_HIDE_FROM_ABI __enable_if_t<is_floating_point<_Rep>::value, chrono::nanoseconds> +__safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d) { + using namespace chrono; + using __ratio = ratio_divide<_Period, nano>; + using __ns_rep = nanoseconds::rep; + _Rep __result_float = __d.count() * __ratio::num / __ratio::den; + + _Rep __result_max = numeric_limits<__ns_rep>::max(); + if (__result_float >= __result_max) { + return nanoseconds::max(); + } + + _Rep __result_min = numeric_limits<__ns_rep>::min(); + if (__result_float <= __result_min) { + return nanoseconds::min(); + } + + return nanoseconds(static_cast<__ns_rep>(__result_float)); +} + +template <class _Rep, class _Period> +inline _LIBCPP_HIDE_FROM_ABI __enable_if_t<!is_floating_point<_Rep>::value, chrono::nanoseconds> +__safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d) { + using namespace chrono; + if (__d.count() == 0) { + return nanoseconds(0); + } + + using __ratio = ratio_divide<_Period, nano>; + using __ns_rep = nanoseconds::rep; + __ns_rep __result_max = numeric_limits<__ns_rep>::max(); + if (__d.count() > 0 && __d.count() > __result_max / __ratio::num) { + return nanoseconds::max(); + } + + __ns_rep __result_min = numeric_limits<__ns_rep>::min(); + if (__d.count() < 0 && __d.count() < __result_min / __ratio::num) { + return nanoseconds::min(); + } + + __ns_rep __result = __d.count() * __ratio::num / __ratio::den; + if (__result == 0) { + return nanoseconds(1); + } + + return nanoseconds(__result); +} + +#ifndef _LIBCPP_HAS_NO_THREADS +template <class _Predicate> +void condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred) { + while (!__pred()) + wait(__lk); +} + +template <class _Clock, class _Duration> +cv_status condition_variable::wait_until(unique_lock<mutex>& __lk, const chrono::time_point<_Clock, _Duration>& __t) { + using namespace chrono; + using __clock_tp_ns = time_point<_Clock, nanoseconds>; + + typename _Clock::time_point __now = _Clock::now(); + if (__t <= __now) + return cv_status::timeout; + + __clock_tp_ns __t_ns = __clock_tp_ns(std::__safe_nanosecond_cast(__t.time_since_epoch())); + + __do_timed_wait(__lk, __t_ns); + return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout; +} + +template <class _Clock, class _Duration, class _Predicate> +bool condition_variable::wait_until( + unique_lock<mutex>& __lk, const chrono::time_point<_Clock, _Duration>& __t, _Predicate __pred) { + while (!__pred()) { + if (wait_until(__lk, __t) == cv_status::timeout) + return __pred(); + } + return true; +} + +template <class _Rep, class _Period> +cv_status condition_variable::wait_for(unique_lock<mutex>& __lk, const chrono::duration<_Rep, _Period>& __d) { + using namespace chrono; + if (__d <= __d.zero()) + return cv_status::timeout; + using __ns_rep = nanoseconds::rep; + steady_clock::time_point __c_now = steady_clock::now(); + +# if defined(_LIBCPP_HAS_COND_CLOCKWAIT) + using __clock_tp_ns = time_point<steady_clock, nanoseconds>; + __ns_rep __now_count_ns = std::__safe_nanosecond_cast(__c_now.time_since_epoch()).count(); +# else + using __clock_tp_ns = time_point<system_clock, nanoseconds>; + __ns_rep __now_count_ns = std::__safe_nanosecond_cast(system_clock::now().time_since_epoch()).count(); +# endif + + __ns_rep __d_ns_count = std::__safe_nanosecond_cast(__d).count(); + + if (__now_count_ns > numeric_limits<__ns_rep>::max() - __d_ns_count) { + __do_timed_wait(__lk, __clock_tp_ns::max()); + } else { + __do_timed_wait(__lk, __clock_tp_ns(nanoseconds(__now_count_ns + __d_ns_count))); + } + + return steady_clock::now() - __c_now < __d ? cv_status::no_timeout : cv_status::timeout; +} + +template <class _Rep, class _Period, class _Predicate> +inline bool +condition_variable::wait_for(unique_lock<mutex>& __lk, const chrono::duration<_Rep, _Period>& __d, _Predicate __pred) { + return wait_until(__lk, chrono::steady_clock::now() + __d, std::move(__pred)); +} + +# if defined(_LIBCPP_HAS_COND_CLOCKWAIT) +inline void condition_variable::__do_timed_wait( + unique_lock<mutex>& __lk, chrono::time_point<chrono::steady_clock, chrono::nanoseconds> __tp) _NOEXCEPT { + using namespace chrono; + if (!__lk.owns_lock()) + __throw_system_error(EPERM, "condition_variable::timed wait: mutex not locked"); + nanoseconds __d = __tp.time_since_epoch(); + timespec __ts; + seconds __s = duration_cast<seconds>(__d); + using __ts_sec = decltype(__ts.tv_sec); + const __ts_sec __ts_sec_max = numeric_limits<__ts_sec>::max(); + if (__s.count() < __ts_sec_max) { + __ts.tv_sec = static_cast<__ts_sec>(__s.count()); + __ts.tv_nsec = (__d - __s).count(); + } else { + __ts.tv_sec = __ts_sec_max; + __ts.tv_nsec = giga::num - 1; + } + int __ec = pthread_cond_clockwait(&__cv_, __lk.mutex()->native_handle(), CLOCK_MONOTONIC, &__ts); + if (__ec != 0 && __ec != ETIMEDOUT) + __throw_system_error(__ec, "condition_variable timed_wait failed"); +} +# endif // _LIBCPP_HAS_COND_CLOCKWAIT + +template <class _Clock> +inline void condition_variable::__do_timed_wait(unique_lock<mutex>& __lk, + chrono::time_point<_Clock, chrono::nanoseconds> __tp) _NOEXCEPT { + wait_for(__lk, __tp - _Clock::now()); +} + +#endif // _LIBCPP_HAS_NO_THREADS + +_LIBCPP_END_NAMESPACE_STD + +_LIBCPP_POP_MACROS + +#endif // _LIBCPP___CONDITION_VARIABLE_CONDITION_VARIABLE_H
diff --git a/third_party/llvm-project/libcxx/include/__config b/third_party/llvm-project/libcxx/include/__config index 40c9deb..6716058 100644 --- a/third_party/llvm-project/libcxx/include/__config +++ b/third_party/llvm-project/libcxx/include/__config
@@ -23,6 +23,7 @@ #endif #if defined(__apple_build_version__) +// Given AppleClang XX.Y.Z, _LIBCPP_APPLE_CLANG_VER is XXYZ (e.g. AppleClang 14.0.3 => 1403) # define _LIBCPP_COMPILER_CLANG_BASED # define _LIBCPP_APPLE_CLANG_VER (__apple_build_version__ / 10000) #elif defined(__clang__) @@ -50,6 +51,7 @@ # define _LIBCPP_FREESTANDING # endif +// NOLINTBEGIN(libcpp-cpp-version-check) # ifndef _LIBCPP_STD_VER # if __cplusplus <= 201103L # define _LIBCPP_STD_VER 11 @@ -64,6 +66,7 @@ # define _LIBCPP_STD_VER 23 # endif # endif // _LIBCPP_STD_VER +// NOLINTEND(libcpp-cpp-version-check) # if defined(__ELF__) # define _LIBCPP_OBJECT_FORMAT_ELF 1 @@ -134,6 +137,15 @@ # define _LIBCPP_ABI_DO_NOT_EXPORT_VECTOR_BASE_COMMON // According to the Standard, `bitset::operator[] const` returns bool # define _LIBCPP_ABI_BITSET_VECTOR_BOOL_CONST_SUBSCRIPT_RETURN_BOOL +// Fix the implementation of CityHash used for std::hash<fundamental-type>. +// This is an ABI break because `std::hash` will return a different result, +// which means that hashing the same object in translation units built against +// different versions of libc++ can return inconsistent results. This is especially +// tricky since std::hash is used in the implementation of unordered containers. +// +// The incorrect implementation of CityHash has the problem that it drops some +// bits on the floor. +# define _LIBCPP_ABI_FIX_CITYHASH_IMPLEMENTATION // Remove the base 10 implementation of std::to_chars from the dylib. // The implementation moved to the header, but we still export the symbols from // the dylib for backwards compatibility. @@ -155,6 +167,12 @@ # if defined(__FreeBSD__) # define _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR # endif +// For XCOFF linkers, we have problems if we see a weak hidden version of a symbol +// in user code (like you get with -fvisibility-inlines-hidden) and then a strong def +// in the library, so we need to always rely on the library version. +# if defined(_AIX) +# define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION +# endif # endif # if defined(_LIBCPP_BUILDING_LIBRARY) || _LIBCPP_ABI_VERSION >= 2 @@ -172,6 +190,7 @@ # define _LIBCPP_TOSTRING2(x) #x # define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x) +// NOLINTNEXTLINE(libcpp-cpp-version-check) # if __cplusplus < 201103L # define _LIBCPP_CXX03_LANG # endif @@ -439,7 +458,7 @@ # endif # if !defined(__cpp_exceptions) || __cpp_exceptions < 199711L -# define _LIBCPP_NO_EXCEPTIONS +# define _LIBCPP_HAS_NO_EXCEPTIONS # endif # define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp) @@ -656,7 +675,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD -# if _LIBCPP_STD_VER > 14 +# if _LIBCPP_STD_VER >= 17 # define _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM \ _LIBCPP_BEGIN_NAMESPACE_STD inline namespace __fs { namespace filesystem { # else @@ -677,12 +696,6 @@ # define _LIBCPP_HAS_NO_INT128 # endif -# ifndef __cpp_consteval -# define _LIBCPP_CONSTEVAL _LIBCPP_CONSTEXPR -# else -# define _LIBCPP_CONSTEVAL consteval -# endif - # if __has_attribute(__malloc__) # define _LIBCPP_NOALIAS __attribute__((__malloc__)) # else @@ -767,10 +780,10 @@ // Deprecations warnings are always enabled, except when users explicitly opt-out // by defining _LIBCPP_DISABLE_DEPRECATION_WARNINGS. # if !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) -# if __has_attribute(deprecated) -# define _LIBCPP_DEPRECATED __attribute__((deprecated)) -# define _LIBCPP_DEPRECATED_(m) __attribute__((deprecated(m))) -# elif _LIBCPP_STD_VER > 11 +# if __has_attribute(__deprecated__) +# define _LIBCPP_DEPRECATED __attribute__((__deprecated__)) +# define _LIBCPP_DEPRECATED_(m) __attribute__((__deprecated__(m))) +# elif _LIBCPP_STD_VER >= 14 # define _LIBCPP_DEPRECATED [[deprecated]] # define _LIBCPP_DEPRECATED_(m) [[deprecated(m)]] # else @@ -788,19 +801,19 @@ # define _LIBCPP_DEPRECATED_IN_CXX11 # endif -# if _LIBCPP_STD_VER > 11 +# if _LIBCPP_STD_VER >= 14 # define _LIBCPP_DEPRECATED_IN_CXX14 _LIBCPP_DEPRECATED # else # define _LIBCPP_DEPRECATED_IN_CXX14 # endif -# if _LIBCPP_STD_VER > 14 +# if _LIBCPP_STD_VER >= 17 # define _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_DEPRECATED # else # define _LIBCPP_DEPRECATED_IN_CXX17 # endif -# if _LIBCPP_STD_VER > 17 +# if _LIBCPP_STD_VER >= 20 # define _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_DEPRECATED # else # define _LIBCPP_DEPRECATED_IN_CXX20 @@ -830,37 +843,43 @@ # endif # if _LIBCPP_STD_VER <= 11 -# define _LIBCPP_EXPLICIT_AFTER_CXX11 +# define _LIBCPP_EXPLICIT_SINCE_CXX14 # else -# define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit +# define _LIBCPP_EXPLICIT_SINCE_CXX14 explicit # endif -# if _LIBCPP_STD_VER > 11 +# if _LIBCPP_STD_VER >= 23 +# define _LIBCPP_EXPLICIT_SINCE_CXX23 explicit +# else +# define _LIBCPP_EXPLICIT_SINCE_CXX23 +# endif + +# if _LIBCPP_STD_VER >= 14 # define _LIBCPP_CONSTEXPR_SINCE_CXX14 constexpr # else # define _LIBCPP_CONSTEXPR_SINCE_CXX14 # endif -# if _LIBCPP_STD_VER > 14 +# if _LIBCPP_STD_VER >= 17 # define _LIBCPP_CONSTEXPR_SINCE_CXX17 constexpr # else # define _LIBCPP_CONSTEXPR_SINCE_CXX17 # endif -# if _LIBCPP_STD_VER > 17 +# if _LIBCPP_STD_VER >= 20 # define _LIBCPP_CONSTEXPR_SINCE_CXX20 constexpr # else # define _LIBCPP_CONSTEXPR_SINCE_CXX20 # endif -# if _LIBCPP_STD_VER > 20 +# if _LIBCPP_STD_VER >= 23 # define _LIBCPP_CONSTEXPR_SINCE_CXX23 constexpr # else # define _LIBCPP_CONSTEXPR_SINCE_CXX23 # endif # if __has_cpp_attribute(nodiscard) -# define _LIBCPP_NODISCARD [[nodiscard]] +# define _LIBCPP_NODISCARD [[__nodiscard__]] # else // We can't use GCC's [[gnu::warn_unused_result]] and // __attribute__((warn_unused_result)), because GCC does not silence them via @@ -876,7 +895,7 @@ # define _LIBCPP_NODISCARD_EXT # endif -# if _LIBCPP_STD_VER > 17 || !defined(_LIBCPP_DISABLE_NODISCARD_EXT) +# if _LIBCPP_STD_VER >= 20 || !defined(_LIBCPP_DISABLE_NODISCARD_EXT) # define _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_NODISCARD # else # define _LIBCPP_NODISCARD_AFTER_CXX17 @@ -895,7 +914,7 @@ // Try to find out if RTTI is disabled. # if !defined(__cpp_rtti) || __cpp_rtti < 199711L -# define _LIBCPP_NO_RTTI +# define _LIBCPP_HAS_NO_RTTI # endif # ifndef _LIBCPP_WEAK @@ -1042,7 +1061,7 @@ # define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) # endif -# if _LIBCPP_STD_VER > 17 +# if _LIBCPP_STD_VER >= 20 # define _LIBCPP_CONSTINIT constinit # elif __has_attribute(__require_constant_initialization__) # define _LIBCPP_CONSTINIT __attribute__((__require_constant_initialization__)) @@ -1179,7 +1198,7 @@ // [[msvc::no_unique_address]], this should be preferred though. # define _LIBCPP_NO_UNIQUE_ADDRESS [[msvc::no_unique_address]] # elif __has_cpp_attribute(no_unique_address) -# define _LIBCPP_NO_UNIQUE_ADDRESS [[no_unique_address]] +# define _LIBCPP_NO_UNIQUE_ADDRESS [[__no_unique_address__]] # else # define _LIBCPP_NO_UNIQUE_ADDRESS /* nothing */ // Note that this can be replaced by #error as soon as clang-cl @@ -1227,12 +1246,12 @@ // functions are declared by the C library. # define _LIBCPP_HAS_NO_C8RTOMB_MBRTOC8 // GNU libc 2.36 and newer declare c8rtomb() and mbrtoc8() in C++ modes if -// __cpp_char8_t is defined or if C2X extensions are enabled. Unfortunately, -// determining the latter depends on internal GNU libc details. If the -// __cpp_char8_t feature test macro is not defined, then a char8_t typedef -// will be declared as well. -# if defined(_LIBCPP_GLIBC_PREREQ) && defined(__GLIBC_USE) -# if _LIBCPP_GLIBC_PREREQ(2, 36) && (defined(__cpp_char8_t) || __GLIBC_USE(ISOC2X)) +// __cpp_char8_t is defined or if C2X extensions are enabled. Determining +// the latter depends on internal GNU libc details that are not appropriate +// to depend on here, so any declarations present when __cpp_char8_t is not +// defined are ignored. +# if defined(_LIBCPP_GLIBC_PREREQ) +# if _LIBCPP_GLIBC_PREREQ(2, 36) && defined(__cpp_char8_t) # undef _LIBCPP_HAS_NO_C8RTOMB_MBRTOC8 # endif # endif @@ -1242,13 +1261,25 @@ // macro is used to mark them as such, which suppresses the // '-Wctad-maybe-unsupported' compiler warning when CTAD is used in user code // with these classes. -#if _LIBCPP_STD_VER >= 17 -# define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) \ - template <class ..._Tag> \ - _ClassName(typename _Tag::__allow_ctad...) -> _ClassName<_Tag...> -#else -# define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) static_assert(true, "") -#endif +# if _LIBCPP_STD_VER >= 17 +# ifdef _LIBCPP_COMPILER_CLANG_BASED +# define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) \ + template <class... _Tag> \ + [[maybe_unused]] _ClassName(typename _Tag::__allow_ctad...)->_ClassName<_Tag...> +# else +# define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(ClassName) \ + template <class... _Tag> \ + ClassName(typename _Tag::__allow_ctad...)->ClassName<_Tag...> +# endif +# else +# define _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(_ClassName) static_assert(true, "") +# endif + +// TODO(varconst): currently, there are bugs in Clang's intrinsics when handling Objective-C++ `id`, so don't use +// compiler intrinsics in the Objective-C++ mode. +# ifdef __OBJC__ +# define _LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS +# endif #endif // __cplusplus
diff --git a/third_party/llvm-project/libcxx/include/__coroutine/coroutine_handle.h b/third_party/llvm-project/libcxx/include/__coroutine/coroutine_handle.h index 0a6cc1c..8390b49 100644 --- a/third_party/llvm-project/libcxx/include/__coroutine/coroutine_handle.h +++ b/third_party/llvm-project/libcxx/include/__coroutine/coroutine_handle.h
@@ -21,7 +21,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -198,6 +198,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // __LIBCPP_STD_VER > 17 +#endif // __LIBCPP_STD_VER >= 20 #endif // _LIBCPP___COROUTINE_COROUTINE_HANDLE_H
diff --git a/third_party/llvm-project/libcxx/include/__coroutine/coroutine_traits.h b/third_party/llvm-project/libcxx/include/__coroutine/coroutine_traits.h index d513075..7122cc8 100644 --- a/third_party/llvm-project/libcxx/include/__coroutine/coroutine_traits.h +++ b/third_party/llvm-project/libcxx/include/__coroutine/coroutine_traits.h
@@ -16,7 +16,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -48,6 +48,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // __LIBCPP_STD_VER > 17 +#endif // __LIBCPP_STD_VER >= 20 #endif // _LIBCPP___COROUTINE_COROUTINE_TRAITS_H
diff --git a/third_party/llvm-project/libcxx/include/__coroutine/noop_coroutine_handle.h b/third_party/llvm-project/libcxx/include/__coroutine/noop_coroutine_handle.h index 2993047..9b7802d 100644 --- a/third_party/llvm-project/libcxx/include/__coroutine/noop_coroutine_handle.h +++ b/third_party/llvm-project/libcxx/include/__coroutine/noop_coroutine_handle.h
@@ -16,7 +16,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -107,6 +107,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // __LIBCPP_STD_VER > 17 +#endif // __LIBCPP_STD_VER >= 20 #endif // _LIBCPP___COROUTINE_NOOP_COROUTINE_HANDLE_H
diff --git a/third_party/llvm-project/libcxx/include/__coroutine/trivial_awaitables.h b/third_party/llvm-project/libcxx/include/__coroutine/trivial_awaitables.h index bbbae7a..0e4b08e 100644 --- a/third_party/llvm-project/libcxx/include/__coroutine/trivial_awaitables.h +++ b/third_party/llvm-project/libcxx/include/__coroutine/trivial_awaitables.h
@@ -16,7 +16,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_BEGIN_NAMESPACE_STD @@ -41,6 +41,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // __LIBCPP_STD_VER > 17 +#endif // __LIBCPP_STD_VER >= 20 #endif // __LIBCPP___COROUTINE_TRIVIAL_AWAITABLES_H
diff --git a/third_party/llvm-project/libcxx/include/__debug b/third_party/llvm-project/libcxx/include/__debug index 140cc91..ccbfae7 100644 --- a/third_party/llvm-project/libcxx/include/__debug +++ b/third_party/llvm-project/libcxx/include/__debug
@@ -98,8 +98,8 @@ { typedef typename _Cont::const_iterator iterator; const iterator* __j = static_cast<const iterator*>(__i); - _Cont* _Cp = static_cast<_Cont*>(__c_); - return _Cp->__dereferenceable(__j); + _Cont* __cp = static_cast<_Cont*>(__c_); + return __cp->__dereferenceable(__j); } template <class _Cont> @@ -108,8 +108,8 @@ { typedef typename _Cont::const_iterator iterator; const iterator* __j = static_cast<const iterator*>(__i); - _Cont* _Cp = static_cast<_Cont*>(__c_); - return _Cp->__decrementable(__j); + _Cont* __cp = static_cast<_Cont*>(__c_); + return __cp->__decrementable(__j); } template <class _Cont> @@ -118,8 +118,8 @@ { typedef typename _Cont::const_iterator iterator; const iterator* __j = static_cast<const iterator*>(__i); - _Cont* _Cp = static_cast<_Cont*>(__c_); - return _Cp->__addable(__j, __n); + _Cont* __cp = static_cast<_Cont*>(__c_); + return __cp->__addable(__j, __n); } template <class _Cont> @@ -128,8 +128,8 @@ { typedef typename _Cont::const_iterator iterator; const iterator* __j = static_cast<const iterator*>(__i); - _Cont* _Cp = static_cast<_Cont*>(__c_); - return _Cp->__subscriptable(__j, __n); + _Cont* __cp = static_cast<_Cont*>(__c_); + return __cp->__subscriptable(__j, __n); } class _LIBCPP_TYPE_VIS __libcpp_db
diff --git a/third_party/llvm-project/libcxx/include/__exception/exception.h b/third_party/llvm-project/libcxx/include/__exception/exception.h new file mode 100644 index 0000000..49a58dd --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__exception/exception.h
@@ -0,0 +1,91 @@ +//===----------------------------------------------------------------------===// +// +// 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___EXCEPTION_EXCEPTION_H +#define _LIBCPP___EXCEPTION_EXCEPTION_H + +#include <__config> + +// <vcruntime_exception.h> defines its own std::exception and std::bad_exception types, +// which we use in order to be ABI-compatible with other STLs on Windows. +#if defined(_LIBCPP_ABI_VCRUNTIME) +# include <vcruntime_exception.h> +#endif + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +namespace std { // purposefully not using versioning namespace + +#if defined(_LIBCPP_ABI_VCRUNTIME) && (!defined(_HAS_EXCEPTIONS) || _HAS_EXCEPTIONS != 0) +// The std::exception class was already included above, but we're explicit about this condition here for clarity. + +#elif defined(_LIBCPP_ABI_VCRUNTIME) && _HAS_EXCEPTIONS == 0 +// However, <vcruntime_exception.h> does not define std::exception and std::bad_exception +// when _HAS_EXCEPTIONS == 0. +// +// Since libc++ still wants to provide the std::exception hierarchy even when _HAS_EXCEPTIONS == 0 +// (after all those are simply types like any other), we define an ABI-compatible version +// of the VCRuntime std::exception and std::bad_exception types in that mode. + +struct __std_exception_data { + char const* _What; + bool _DoFree; +}; + +class exception { // base of all library exceptions +public: + exception() _NOEXCEPT : __data_() {} + + explicit exception(char const* __message) _NOEXCEPT : __data_() { + __data_._What = __message; + __data_._DoFree = true; + } + + exception(exception const&) _NOEXCEPT {} + + exception& operator=(exception const&) _NOEXCEPT { return *this; } + + virtual ~exception() _NOEXCEPT {} + + virtual char const* what() const _NOEXCEPT { return __data_._What ? __data_._What : "Unknown exception"; } + +private: + __std_exception_data __data_; +}; + +class bad_exception : public exception { +public: + bad_exception() _NOEXCEPT : exception("bad exception") {} +}; + +#else // !defined(_LIBCPP_ABI_VCRUNTIME) +// On all other platforms, we define our own std::exception and std::bad_exception types +// regardless of whether exceptions are turned on as a language feature. + +class _LIBCPP_EXCEPTION_ABI exception { +public: + _LIBCPP_HIDE_FROM_ABI exception() _NOEXCEPT {} + _LIBCPP_HIDE_FROM_ABI exception(const exception&) _NOEXCEPT = default; + + virtual ~exception() _NOEXCEPT; + virtual const char* what() const _NOEXCEPT; +}; + +class _LIBCPP_EXCEPTION_ABI bad_exception : public exception { +public: + _LIBCPP_HIDE_FROM_ABI bad_exception() _NOEXCEPT {} + ~bad_exception() _NOEXCEPT override; + const char* what() const _NOEXCEPT override; +}; +#endif // !_LIBCPP_ABI_VCRUNTIME + +} // namespace std + +#endif // _LIBCPP___EXCEPTION_EXCEPTION_H
diff --git a/third_party/llvm-project/libcxx/include/__exception/exception_ptr.h b/third_party/llvm-project/libcxx/include/__exception/exception_ptr.h new file mode 100644 index 0000000..cac4a88 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__exception/exception_ptr.h
@@ -0,0 +1,109 @@ +//===----------------------------------------------------------------------===// +// +// 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___EXCEPTION_EXCEPTION_PTR_H +#define _LIBCPP___EXCEPTION_EXCEPTION_PTR_H + +#include <__config> +#include <__exception/operations.h> +#include <__memory/addressof.h> +#include <cstddef> +#include <cstdlib> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +namespace std { // purposefully not using versioning namespace + +#ifndef _LIBCPP_ABI_MICROSOFT + +class _LIBCPP_TYPE_VIS exception_ptr { + void* __ptr_; + +public: + _LIBCPP_HIDE_FROM_ABI exception_ptr() _NOEXCEPT : __ptr_() {} + _LIBCPP_HIDE_FROM_ABI exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {} + + exception_ptr(const exception_ptr&) _NOEXCEPT; + exception_ptr& operator=(const exception_ptr&) _NOEXCEPT; + ~exception_ptr() _NOEXCEPT; + + _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return __ptr_ != nullptr; } + + friend _LIBCPP_HIDE_FROM_ABI bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT { + return __x.__ptr_ == __y.__ptr_; + } + + friend _LIBCPP_HIDE_FROM_ABI bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT { + return !(__x == __y); + } + + friend _LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT; + friend _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr); +}; + +template <class _Ep> +_LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT { +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS + try { + throw __e; + } catch (...) { + return current_exception(); + } +# else + ((void)__e); + std::abort(); +# endif +} + +#else // _LIBCPP_ABI_MICROSOFT + +class _LIBCPP_TYPE_VIS exception_ptr { + _LIBCPP_DIAGNOSTIC_PUSH + _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wunused-private-field") + void* __ptr1_; + void* __ptr2_; + _LIBCPP_DIAGNOSTIC_POP + +public: + exception_ptr() _NOEXCEPT; + exception_ptr(nullptr_t) _NOEXCEPT; + exception_ptr(const exception_ptr& __other) _NOEXCEPT; + exception_ptr& operator=(const exception_ptr& __other) _NOEXCEPT; + exception_ptr& operator=(nullptr_t) _NOEXCEPT; + ~exception_ptr() _NOEXCEPT; + explicit operator bool() const _NOEXCEPT; +}; + +_LIBCPP_FUNC_VIS bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT; + +inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT { + return !(__x == __y); +} + +_LIBCPP_FUNC_VIS void swap(exception_ptr&, exception_ptr&) _NOEXCEPT; + +_LIBCPP_FUNC_VIS exception_ptr __copy_exception_ptr(void* __except, const void* __ptr); +_LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT; +_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr); + +// This is a built-in template function which automagically extracts the required +// information. +template <class _E> +void* __GetExceptionInfo(_E); + +template <class _Ep> +_LIBCPP_HIDE_FROM_ABI exception_ptr make_exception_ptr(_Ep __e) _NOEXCEPT { + return __copy_exception_ptr(std::addressof(__e), __GetExceptionInfo(__e)); +} + +#endif // _LIBCPP_ABI_MICROSOFT +} // namespace std + +#endif // _LIBCPP___EXCEPTION_EXCEPTION_PTR_H
diff --git a/third_party/llvm-project/libcxx/include/__exception/nested_exception.h b/third_party/llvm-project/libcxx/include/__exception/nested_exception.h new file mode 100644 index 0000000..182c7dd --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__exception/nested_exception.h
@@ -0,0 +1,101 @@ +//===----------------------------------------------------------------------===// +// +// 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___EXCEPTION_NESTED_EXCEPTION_H +#define _LIBCPP___EXCEPTION_NESTED_EXCEPTION_H + +#include <__config> +#include <__exception/exception_ptr.h> +#include <__memory/addressof.h> +#include <__type_traits/decay.h> +#include <__type_traits/is_base_of.h> +#include <__type_traits/is_class.h> +#include <__type_traits/is_convertible.h> +#include <__type_traits/is_copy_constructible.h> +#include <__type_traits/is_final.h> +#include <__type_traits/is_polymorphic.h> +#include <__utility/forward.h> +#include <cstddef> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +namespace std { // purposefully not using versioning namespace + +class _LIBCPP_EXCEPTION_ABI nested_exception { + exception_ptr __ptr_; + +public: + nested_exception() _NOEXCEPT; + // nested_exception(const nested_exception&) noexcept = default; + // nested_exception& operator=(const nested_exception&) noexcept = default; + virtual ~nested_exception() _NOEXCEPT; + + // access functions + _LIBCPP_NORETURN void rethrow_nested() const; + _LIBCPP_HIDE_FROM_ABI exception_ptr nested_ptr() const _NOEXCEPT { return __ptr_; } +}; + +template <class _Tp> +struct __nested : public _Tp, public nested_exception { + _LIBCPP_HIDE_FROM_ABI explicit __nested(const _Tp& __t) : _Tp(__t) {} +}; + +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS +template <class _Tp, class _Up, bool> +struct __throw_with_nested; + +template <class _Tp, class _Up> +struct __throw_with_nested<_Tp, _Up, true> { + _LIBCPP_NORETURN static inline _LIBCPP_INLINE_VISIBILITY void __do_throw(_Tp&& __t) { + throw __nested<_Up>(std::forward<_Tp>(__t)); + } +}; + +template <class _Tp, class _Up> +struct __throw_with_nested<_Tp, _Up, false> { + _LIBCPP_NORETURN static inline _LIBCPP_INLINE_VISIBILITY void __do_throw(_Tp&& __t) { throw std::forward<_Tp>(__t); } +}; +#endif + +template <class _Tp> +_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI void throw_with_nested(_Tp&& __t) { +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS + using _Up = __decay_t<_Tp>; + static_assert(is_copy_constructible<_Up>::value, "type thrown must be CopyConstructible"); + __throw_with_nested<_Tp, + _Up, + is_class<_Up>::value && !is_base_of<nested_exception, _Up>::value && + !__libcpp_is_final<_Up>::value>::__do_throw(std::forward<_Tp>(__t)); +#else + ((void)__t); + // FIXME: Make this abort +#endif +} + +template <class _From, class _To> +struct __can_dynamic_cast + : _BoolConstant< is_polymorphic<_From>::value && + (!is_base_of<_To, _From>::value || is_convertible<const _From*, const _To*>::value)> {}; + +template <class _Ep> +inline _LIBCPP_HIDE_FROM_ABI void +rethrow_if_nested(const _Ep& __e, __enable_if_t< __can_dynamic_cast<_Ep, nested_exception>::value>* = 0) { + const nested_exception* __nep = dynamic_cast<const nested_exception*>(std::addressof(__e)); + if (__nep) + __nep->rethrow_nested(); +} + +template <class _Ep> +inline _LIBCPP_HIDE_FROM_ABI void +rethrow_if_nested(const _Ep&, __enable_if_t<!__can_dynamic_cast<_Ep, nested_exception>::value>* = 0) {} + +} // namespace std + +#endif // _LIBCPP___EXCEPTION_NESTED_EXCEPTION_H
diff --git a/third_party/llvm-project/libcxx/include/__exception/operations.h b/third_party/llvm-project/libcxx/include/__exception/operations.h new file mode 100644 index 0000000..e8c5ba6 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__exception/operations.h
@@ -0,0 +1,42 @@ +//===----------------------------------------------------------------------===// +// +// 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___EXCEPTION_OPERATIONS_H +#define _LIBCPP___EXCEPTION_OPERATIONS_H + +#include <__availability> +#include <__config> +#include <cstddef> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +namespace std { // purposefully not using versioning namespace +#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS) || \ + defined(_LIBCPP_BUILDING_LIBRARY) +using unexpected_handler = void (*)(); +_LIBCPP_FUNC_VIS unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT; +_LIBCPP_FUNC_VIS unexpected_handler get_unexpected() _NOEXCEPT; +_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void unexpected(); +#endif + +using terminate_handler = void (*)(); +_LIBCPP_FUNC_VIS terminate_handler set_terminate(terminate_handler) _NOEXCEPT; +_LIBCPP_FUNC_VIS terminate_handler get_terminate() _NOEXCEPT; + +_LIBCPP_FUNC_VIS bool uncaught_exception() _NOEXCEPT; +_LIBCPP_FUNC_VIS _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS int uncaught_exceptions() _NOEXCEPT; + +class _LIBCPP_TYPE_VIS exception_ptr; + +_LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT; +_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr); +} // namespace std + +#endif // _LIBCPP___EXCEPTION_OPERATIONS_H
diff --git a/third_party/llvm-project/libcxx/include/__exception/terminate.h b/third_party/llvm-project/libcxx/include/__exception/terminate.h new file mode 100644 index 0000000..d8dd964 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__exception/terminate.h
@@ -0,0 +1,22 @@ +//===----------------------------------------------------------------------===// +// +// 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___EXCEPTION_TERMINATE_H +#define _LIBCPP___EXCEPTION_TERMINATE_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +namespace std { // purposefully not using versioning namespace +_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void terminate() _NOEXCEPT; +} // namespace std + +#endif // _LIBCPP___EXCEPTION_TERMINATE_H
diff --git a/third_party/llvm-project/libcxx/include/__expected/bad_expected_access.h b/third_party/llvm-project/libcxx/include/__expected/bad_expected_access.h index 361eab4..e7a568c 100644 --- a/third_party/llvm-project/libcxx/include/__expected/bad_expected_access.h +++ b/third_party/llvm-project/libcxx/include/__expected/bad_expected_access.h
@@ -10,10 +10,9 @@ #define _LIBCPP___EXPECTED_BAD_EXPECTED_ACCESS_H #include <__config> +#include <__exception/exception.h> #include <__utility/move.h> -#include <exception> - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif
diff --git a/third_party/llvm-project/libcxx/include/__expected/expected.h b/third_party/llvm-project/libcxx/include/__expected/expected.h index e1f590c..3ff8fbc 100644 --- a/third_party/llvm-project/libcxx/include/__expected/expected.h +++ b/third_party/llvm-project/libcxx/include/__expected/expected.h
@@ -49,7 +49,7 @@ #include <__utility/in_place.h> #include <__utility/move.h> #include <__utility/swap.h> -#include <cstdlib> // for std::abort +#include <__verbose_abort> #include <initializer_list> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -64,11 +64,11 @@ template <class _Err, class _Arg> _LIBCPP_HIDE_FROM_ABI void __throw_bad_expected_access(_Arg&& __arg) { -# ifndef _LIBCPP_NO_EXCEPTIONS +# ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw bad_expected_access<_Err>(std::forward<_Arg>(__arg)); # else (void)__arg; - std::abort(); + _LIBCPP_VERBOSE_ABORT("bad_expected_access was thrown in -fno-exceptions mode"); # endif } @@ -292,7 +292,8 @@ "be reverted to the previous state in case an exception is thrown during the assignment."); _T2 __tmp(std::move(__oldval)); std::destroy_at(std::addressof(__oldval)); - __exception_guard __trans([&] { std::construct_at(std::addressof(__oldval), std::move(__tmp)); }); + auto __trans = + std::__make_exception_guard([&] { std::construct_at(std::addressof(__oldval), std::move(__tmp)); }); std::construct_at(std::addressof(__newval), std::forward<_Args>(__args)...); __trans.__complete(); } @@ -451,7 +452,7 @@ if constexpr (is_nothrow_move_constructible_v<_Err>) { _Err __tmp(std::move(__with_err.__union_.__unex_)); std::destroy_at(std::addressof(__with_err.__union_.__unex_)); - __exception_guard __trans([&] { + auto __trans = std::__make_exception_guard([&] { std::construct_at(std::addressof(__with_err.__union_.__unex_), std::move(__tmp)); }); std::construct_at(std::addressof(__with_err.__union_.__val_), std::move(__with_val.__union_.__val_)); @@ -464,7 +465,7 @@ "that it can be reverted to the previous state in case an exception is thrown during swap."); _Tp __tmp(std::move(__with_val.__union_.__val_)); std::destroy_at(std::addressof(__with_val.__union_.__val_)); - __exception_guard __trans([&] { + auto __trans = std::__make_exception_guard([&] { std::construct_at(std::addressof(__with_val.__union_.__val_), std::move(__tmp)); }); std::construct_at(std::addressof(__with_val.__union_.__unex_), std::move(__with_err.__union_.__unex_));
diff --git a/third_party/llvm-project/libcxx/include/__expected/unexpected.h b/third_party/llvm-project/libcxx/include/__expected/unexpected.h index 075963a..75a057b 100644 --- a/third_party/llvm-project/libcxx/include/__expected/unexpected.h +++ b/third_party/llvm-project/libcxx/include/__expected/unexpected.h
@@ -64,8 +64,8 @@ _LIBCPP_HIDE_FROM_ABI constexpr unexpected(unexpected&&) = default; template <class _Error = _Err> - requires(!is_same_v<remove_cvref_t<_Error>, unexpected> && // - !is_same_v<remove_cvref_t<_Error>, in_place_t> && // + requires(!is_same_v<remove_cvref_t<_Error>, unexpected> && // + !is_same_v<remove_cvref_t<_Error>, in_place_t> && // is_constructible_v<_Err, _Error>) _LIBCPP_HIDE_FROM_ABI constexpr explicit unexpected(_Error&& __error) // noexcept(is_nothrow_constructible_v<_Err, _Error>) // strengthened
diff --git a/third_party/llvm-project/libcxx/include/__filesystem/directory_entry.h b/third_party/llvm-project/libcxx/include/__filesystem/directory_entry.h index b17eaaa..111dcbd 100644 --- a/third_party/llvm-project/libcxx/include/__filesystem/directory_entry.h +++ b/third_party/llvm-project/libcxx/include/__filesystem/directory_entry.h
@@ -12,8 +12,8 @@ #include <__availability> #include <__chrono/time_point.h> +#include <__compare/ordering.h> #include <__config> -#include <__errc> #include <__filesystem/file_status.h> #include <__filesystem/file_time_type.h> #include <__filesystem/file_type.h> @@ -21,11 +21,12 @@ #include <__filesystem/operations.h> #include <__filesystem/path.h> #include <__filesystem/perms.h> +#include <__system_error/errc.h> +#include <__system_error/error_code.h> +#include <__utility/move.h> #include <__utility/unreachable.h> #include <cstdint> -#include <cstdlib> #include <iosfwd> -#include <system_error> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__filesystem/directory_iterator.h b/third_party/llvm-project/libcxx/include/__filesystem/directory_iterator.h index 5ff2f01..d74c8be 100644 --- a/third_party/llvm-project/libcxx/include/__filesystem/directory_iterator.h +++ b/third_party/llvm-project/libcxx/include/__filesystem/directory_iterator.h
@@ -20,8 +20,9 @@ #include <__memory/shared_ptr.h> #include <__ranges/enable_borrowed_range.h> #include <__ranges/enable_view.h> +#include <__system_error/error_code.h> +#include <__utility/move.h> #include <cstddef> -#include <system_error> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -148,7 +149,7 @@ _LIBCPP_END_NAMESPACE_FILESYSTEM -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <> _LIBCPP_AVAILABILITY_FILESYSTEM @@ -158,7 +159,7 @@ _LIBCPP_AVAILABILITY_FILESYSTEM inline constexpr bool _VSTD::ranges::enable_view<_VSTD_FS::directory_iterator> = true; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP_CXX03_LANG
diff --git a/third_party/llvm-project/libcxx/include/__filesystem/filesystem_error.h b/third_party/llvm-project/libcxx/include/__filesystem/filesystem_error.h index effe699..7860fc4 100644 --- a/third_party/llvm-project/libcxx/include/__filesystem/filesystem_error.h +++ b/third_party/llvm-project/libcxx/include/__filesystem/filesystem_error.h
@@ -14,11 +14,13 @@ #include <__config> #include <__filesystem/path.h> #include <__memory/shared_ptr.h> +#include <__system_error/error_code.h> +#include <__system_error/system_error.h> #include <__utility/forward.h> +#include <__verbose_abort> #include <iosfwd> #include <new> -#include <system_error> -#include <type_traits> +#include <string> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -86,13 +88,13 @@ template <class... _Args> _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS void __throw_filesystem_error(_Args&&... __args) { throw filesystem_error(_VSTD::forward<_Args>(__args)...); } #else void __throw_filesystem_error(_Args&&...) { - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("filesystem_error was thrown in -fno-exceptions mode"); } #endif _LIBCPP_AVAILABILITY_FILESYSTEM_POP
diff --git a/third_party/llvm-project/libcxx/include/__filesystem/operations.h b/third_party/llvm-project/libcxx/include/__filesystem/operations.h index f48d301..6bf58d8 100644 --- a/third_party/llvm-project/libcxx/include/__filesystem/operations.h +++ b/third_party/llvm-project/libcxx/include/__filesystem/operations.h
@@ -21,8 +21,8 @@ #include <__filesystem/perm_options.h> #include <__filesystem/perms.h> #include <__filesystem/space_info.h> +#include <__system_error/error_code.h> #include <cstdint> -#include <system_error> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__filesystem/path.h b/third_party/llvm-project/libcxx/include/__filesystem/path.h index 4e6912f..0ab66d2 100644 --- a/third_party/llvm-project/libcxx/include/__filesystem/path.h +++ b/third_party/llvm-project/libcxx/include/__filesystem/path.h
@@ -14,12 +14,17 @@ #include <__algorithm/replace_copy.h> #include <__availability> #include <__config> +#include <__functional/unary_function.h> +#include <__fwd/hash.h> #include <__iterator/back_insert_iterator.h> #include <__iterator/iterator_traits.h> +#include <__type_traits/decay.h> +#include <__type_traits/is_pointer.h> +#include <__type_traits/remove_const.h> +#include <__type_traits/remove_pointer.h> #include <cstddef> #include <string> #include <string_view> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) # include <iomanip> // for quoted @@ -139,7 +144,7 @@ } }; -template <class _Source, class _DS = typename decay<_Source>::type, +template <class _Source, class _DS = __decay_t<_Source>, class _UnqualPtrType = __remove_const_t<__remove_pointer_t<_DS> >, bool _IsCharPtr = is_pointer<_DS>::value&& @@ -1086,6 +1091,17 @@ _LIBCPP_END_NAMESPACE_FILESYSTEM +_LIBCPP_BEGIN_NAMESPACE_STD + +template <> +struct _LIBCPP_AVAILABILITY_FILESYSTEM hash<_VSTD_FS::path> : __unary_function<_VSTD_FS::path, size_t> { + _LIBCPP_HIDE_FROM_ABI size_t operator()(_VSTD_FS::path const& __p) const noexcept { + return _VSTD_FS::hash_value(__p); + } +}; + +_LIBCPP_END_NAMESPACE_STD + #endif // _LIBCPP_CXX03_LANG #endif // _LIBCPP___FILESYSTEM_PATH_H
diff --git a/third_party/llvm-project/libcxx/include/__filesystem/recursive_directory_iterator.h b/third_party/llvm-project/libcxx/include/__filesystem/recursive_directory_iterator.h index b20d201..ac40dc8 100644 --- a/third_party/llvm-project/libcxx/include/__filesystem/recursive_directory_iterator.h +++ b/third_party/llvm-project/libcxx/include/__filesystem/recursive_directory_iterator.h
@@ -19,8 +19,9 @@ #include <__memory/shared_ptr.h> #include <__ranges/enable_borrowed_range.h> #include <__ranges/enable_view.h> +#include <__system_error/error_code.h> +#include <__utility/move.h> #include <cstddef> -#include <system_error> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -168,7 +169,7 @@ _LIBCPP_END_NAMESPACE_FILESYSTEM -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <> _LIBCPP_AVAILABILITY_FILESYSTEM @@ -178,7 +179,7 @@ _LIBCPP_AVAILABILITY_FILESYSTEM inline constexpr bool _VSTD::ranges::enable_view<_VSTD_FS::recursive_directory_iterator> = true; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #endif // _LIBCPP_CXX03_LANG
diff --git a/third_party/llvm-project/libcxx/include/__filesystem/space_info.h b/third_party/llvm-project/libcxx/include/__filesystem/space_info.h index d0747e3..25fcb9a 100644 --- a/third_party/llvm-project/libcxx/include/__filesystem/space_info.h +++ b/third_party/llvm-project/libcxx/include/__filesystem/space_info.h
@@ -29,7 +29,7 @@ uintmax_t free; uintmax_t available; -# if _LIBCPP_STD_VER > 17 +# if _LIBCPP_STD_VER >= 20 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const space_info&, const space_info&) = default; # endif };
diff --git a/third_party/llvm-project/libcxx/include/__filesystem/u8path.h b/third_party/llvm-project/libcxx/include/__filesystem/u8path.h index d35faa1..ebc1159 100644 --- a/third_party/llvm-project/libcxx/include/__filesystem/u8path.h +++ b/third_party/llvm-project/libcxx/include/__filesystem/u8path.h
@@ -15,7 +15,6 @@ #include <__config> #include <__filesystem/path.h> #include <string> -#include <type_traits> // Only required on Windows for __widen_from_utf8, and included conservatively // because it requires support for localization.
diff --git a/third_party/llvm-project/libcxx/include/__format/buffer.h b/third_party/llvm-project/libcxx/include/__format/buffer.h index ddfe767..0f669ba 100644 --- a/third_party/llvm-project/libcxx/include/__format/buffer.h +++ b/third_party/llvm-project/libcxx/include/__format/buffer.h
@@ -27,10 +27,11 @@ #include <__iterator/incrementable_traits.h> #include <__iterator/iterator_traits.h> #include <__iterator/wrap_iter.h> +#include <__memory/addressof.h> +#include <__type_traits/add_pointer.h> #include <__utility/move.h> #include <cstddef> #include <string_view> -#include <type_traits> #include <vector> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -42,7 +43,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace __format { @@ -564,7 +565,7 @@ } // namespace __format -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/concepts.h b/third_party/llvm-project/libcxx/include/__format/concepts.h index fe4a7b9..62552f8 100644 --- a/third_party/llvm-project/libcxx/include/__format/concepts.h +++ b/third_party/llvm-project/libcxx/include/__format/concepts.h
@@ -18,7 +18,6 @@ #include <__type_traits/is_specialization.h> #include <__utility/pair.h> #include <tuple> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -26,7 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 /// The character type specializations of \ref formatter. template <class _CharT> @@ -56,7 +55,7 @@ { __cf.format(__t, __fc) } -> same_as<__fmt_iter_for<_CharT>>; }; -# if _LIBCPP_STD_VER > 20 +# if _LIBCPP_STD_VER >= 23 template <class _Tp, class _CharT> concept formattable = __formattable<_Tp, _CharT>; @@ -66,12 +65,11 @@ // TODO FMT Add a test to validate we fail when using that concept after P2165 // has been implemented. template <class _Tp> -concept __fmt_pair_like = __is_specialization_v<_Tp, pair> || - // Use a requires since tuple_size_v may fail to instantiate, - (__is_specialization_v<_Tp, tuple> && requires { tuple_size_v<_Tp> == 2; }); +concept __fmt_pair_like = + __is_specialization_v<_Tp, pair> || (__is_specialization_v<_Tp, tuple> && tuple_size_v<_Tp> == 2); -# endif //_LIBCPP_STD_VER > 20 -#endif //_LIBCPP_STD_VER > 17 +# endif //_LIBCPP_STD_VER >= 23 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/container_adaptor.h b/third_party/llvm-project/libcxx/include/__format/container_adaptor.h index 62b6981..5b95f60 100644 --- a/third_party/llvm-project/libcxx/include/__format/container_adaptor.h +++ b/third_party/llvm-project/libcxx/include/__format/container_adaptor.h
@@ -19,12 +19,16 @@ #include <__format/concepts.h> #include <__format/formatter.h> #include <__format/range_default_formatter.h> +#include <__ranges/all.h> +#include <__ranges/ref_view.h> +#include <__type_traits/is_const.h> +#include <__type_traits/maybe_const.h> #include <queue> #include <stack> _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 // [container.adaptors.format] only specifies the library should provide the // formatter specializations, not which header should provide them. @@ -33,10 +37,11 @@ // adaptor headers. To use the format functions users already include <format>. template <class _Adaptor, class _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __formatter_container_adaptor { +struct _LIBCPP_TEMPLATE_VIS __formatter_container_adaptor { private: - using __maybe_const_adaptor = __fmt_maybe_const<_Adaptor, _CharT>; - formatter<typename _Adaptor::container_type, _CharT> __underlying_; + using __maybe_const_container = __fmt_maybe_const<typename _Adaptor::container_type, _CharT>; + using __maybe_const_adaptor = __maybe_const<is_const_v<__maybe_const_container>, _Adaptor>; + formatter<ranges::ref_view<__maybe_const_container>, _CharT> __underlying_; public: template <class _ParseContext> @@ -52,18 +57,18 @@ }; template <class _CharT, class _Tp, formattable<_CharT> _Container> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<queue<_Tp, _Container>, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<queue<_Tp, _Container>, _CharT> : public __formatter_container_adaptor<queue<_Tp, _Container>, _CharT> {}; template <class _CharT, class _Tp, class _Container, class _Compare> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<priority_queue<_Tp, _Container, _Compare>, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<priority_queue<_Tp, _Container, _Compare>, _CharT> : public __formatter_container_adaptor<priority_queue<_Tp, _Container, _Compare>, _CharT> {}; template <class _CharT, class _Tp, formattable<_CharT> _Container> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<stack<_Tp, _Container>, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<stack<_Tp, _Container>, _CharT> : public __formatter_container_adaptor<stack<_Tp, _Container>, _CharT> {}; -#endif //_LIBCPP_STD_VER > 20 +#endif //_LIBCPP_STD_VER >= 23 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/enable_insertable.h b/third_party/llvm-project/libcxx/include/__format/enable_insertable.h index 71b4252..86ef94a 100644 --- a/third_party/llvm-project/libcxx/include/__format/enable_insertable.h +++ b/third_party/llvm-project/libcxx/include/__format/enable_insertable.h
@@ -18,7 +18,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace __format { @@ -28,7 +28,7 @@ } // namespace __format -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/escaped_output_table.h b/third_party/llvm-project/libcxx/include/__format/escaped_output_table.h index bd2994b..222847e 100644 --- a/third_party/llvm-project/libcxx/include/__format/escaped_output_table.h +++ b/third_party/llvm-project/libcxx/include/__format/escaped_output_table.h
@@ -72,7 +72,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 namespace __escaped_output_table { @@ -1031,7 +1031,7 @@ } // namespace __escaped_output_table -#endif //_LIBCPP_STD_VER > 20 +#endif //_LIBCPP_STD_VER >= 23 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/extended_grapheme_cluster_table.h b/third_party/llvm-project/libcxx/include/__format/extended_grapheme_cluster_table.h index 1ffcfeb..bd6d39f 100644 --- a/third_party/llvm-project/libcxx/include/__format/extended_grapheme_cluster_table.h +++ b/third_party/llvm-project/libcxx/include/__format/extended_grapheme_cluster_table.h
@@ -73,7 +73,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace __extended_grapheme_custer_property_boundary { @@ -1654,7 +1654,7 @@ } // namespace __extended_grapheme_custer_property_boundary -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/format_arg.h b/third_party/llvm-project/libcxx/include/__format/format_arg.h index 771a03f..7e37dd4 100644 --- a/third_party/llvm-project/libcxx/include/__format/format_arg.h +++ b/third_party/llvm-project/libcxx/include/__format/format_arg.h
@@ -18,6 +18,7 @@ #include <__format/format_parse_context.h> #include <__functional/invoke.h> #include <__memory/addressof.h> +#include <__utility/declval.h> #include <__utility/forward.h> #include <__utility/unreachable.h> #include <__variant/monostate.h> @@ -30,7 +31,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace __format { /// The type stored in @ref basic_format_arg. @@ -94,7 +95,7 @@ // This function is not user obervable, so it can directly use the non-standard // types of the "variant". See __arg_t for more details. template <class _Visitor, class _Context> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT decltype(auto) +_LIBCPP_HIDE_FROM_ABI decltype(auto) __visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) { switch (__arg.__type_) { case __format::__arg_t::__none: @@ -224,7 +225,7 @@ }; template <class _Context> -class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT basic_format_arg { +class _LIBCPP_TEMPLATE_VIS basic_format_arg { public: class _LIBCPP_TEMPLATE_VIS handle; @@ -276,7 +277,7 @@ // This function is user facing, so it must wrap the non-standard types of // the "variant" in a handle to stay conforming. See __arg_t for more details. template <class _Visitor, class _Context> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT decltype(auto) +_LIBCPP_HIDE_FROM_ABI decltype(auto) visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) { switch (__arg.__type_) { # ifndef _LIBCPP_HAS_NO_INT128 @@ -295,7 +296,7 @@ } } -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/format_arg_store.h b/third_party/llvm-project/libcxx/include/__format/format_arg_store.h index 6f4f4c3..b9a36e5 100644 --- a/third_party/llvm-project/libcxx/include/__format/format_arg_store.h +++ b/third_party/llvm-project/libcxx/include/__format/format_arg_store.h
@@ -19,15 +19,16 @@ #include <__config> #include <__format/concepts.h> #include <__format/format_arg.h> +#include <__type_traits/conditional.h> +#include <__type_traits/extent.h> +#include <__type_traits/is_same.h> #include <__utility/forward.h> -#include <cstring> #include <string> #include <string_view> -#include <type_traits> _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace __format { @@ -142,21 +143,24 @@ // // Note this version can't be constrained avoiding ambiguous overloads. // That means it can be instantiated by disabled formatters. To solve this, a -// constrained version for not formattable formatters is added. That overload -// is marked as deleted to fail creating a storage type for disabled formatters. +// constrained version for not formattable formatters is added. template <class _Context, class _Tp> consteval __arg_t __determine_arg_t() { return __arg_t::__handle; } +// The overload for not formattable types allows triggering the static +// assertion below. template <class _Context, class _Tp> requires(!__formattable<_Tp, typename _Context::char_type>) -consteval __arg_t __determine_arg_t() = delete; +consteval __arg_t __determine_arg_t() { + return __arg_t::__none; +} template <class _Context, class _Tp> _LIBCPP_HIDE_FROM_ABI basic_format_arg<_Context> __create_format_arg(_Tp&& __value) noexcept { constexpr __arg_t __arg = __determine_arg_t<_Context, remove_cvref_t<_Tp>>(); - static_assert(__arg != __arg_t::__none); + static_assert(__arg != __arg_t::__none, "the supplied type is not formattable"); // Not all types can be used to directly initialize the // __basic_format_arg_value. First handle all types needing adjustment, the @@ -247,7 +251,7 @@ _Storage __storage; }; -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/format_args.h b/third_party/llvm-project/libcxx/include/__format/format_args.h index 8b8fbde..c2e7c96 100644 --- a/third_party/llvm-project/libcxx/include/__format/format_args.h +++ b/third_party/llvm-project/libcxx/include/__format/format_args.h
@@ -24,10 +24,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Context> -class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT basic_format_args { +class _LIBCPP_TEMPLATE_VIS basic_format_args { public: _LIBCPP_HIDE_FROM_ABI basic_format_args() noexcept = default; @@ -71,9 +71,11 @@ const basic_format_arg<_Context>* __args_; }; }; -_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(basic_format_args); -#endif //_LIBCPP_STD_VER > 17 +template <class _Context, class... _Args> +basic_format_args(__format_arg_store<_Context, _Args...>) -> basic_format_args<_Context>; + +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/format_context.h b/third_party/llvm-project/libcxx/include/__format/format_context.h index 85e00eb..521131d 100644 --- a/third_party/llvm-project/libcxx/include/__format/format_context.h +++ b/third_party/llvm-project/libcxx/include/__format/format_context.h
@@ -37,11 +37,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _OutIt, class _CharT> requires output_iterator<_OutIt, const _CharT&> -class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT basic_format_context; +class _LIBCPP_TEMPLATE_VIS basic_format_context; #ifndef _LIBCPP_HAS_NO_LOCALIZATION /** @@ -80,7 +80,6 @@ class // clang-format off _LIBCPP_TEMPLATE_VIS - _LIBCPP_AVAILABILITY_FORMAT _LIBCPP_PREFERRED_NAME(format_context) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wformat_context)) // clang-format on @@ -162,7 +161,7 @@ // Here the width of an element in input is determined dynamically. // Note when the top-level element has no width the retargeting is not needed. template <class _CharT> -class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT +class _LIBCPP_TEMPLATE_VIS basic_format_context<typename __format::__retarget_buffer<_CharT>::__iterator, _CharT> { public: using iterator = typename __format::__retarget_buffer<_CharT>::__iterator; @@ -216,7 +215,7 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(basic_format_context); -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/format_error.h b/third_party/llvm-project/libcxx/include/__format/format_error.h index 002d1a4..5f9b7da 100644 --- a/third_party/llvm-project/libcxx/include/__format/format_error.h +++ b/third_party/llvm-project/libcxx/include/__format/format_error.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 class _LIBCPP_EXCEPTION_ABI format_error : public runtime_error { public: @@ -40,7 +40,7 @@ _LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_format_error(const char* __s) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw format_error(__s); #else (void)__s; @@ -48,7 +48,7 @@ #endif } -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/format_functions.h b/third_party/llvm-project/libcxx/include/__format/format_functions.h index 185148c..60b40cb 100644 --- a/third_party/llvm-project/libcxx/include/__format/format_functions.h +++ b/third_party/llvm-project/libcxx/include/__format/format_functions.h
@@ -38,7 +38,9 @@ #include <__format/formatter_string.h> #include <__format/parser_std_format_spec.h> #include <__iterator/back_insert_iterator.h> +#include <__iterator/concepts.h> #include <__iterator/incrementable_traits.h> +#include <__iterator/readable_traits.h> // iter_value_t #include <__variant/monostate.h> #include <array> #include <string> @@ -54,7 +56,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // TODO FMT Evaluate which templates should be external templates. This // improves the efficiency of the header. However since the header is still @@ -147,41 +149,44 @@ size_t __size_; }; -_LIBCPP_HIDE_FROM_ABI -constexpr void __compile_time_validate_integral(__arg_t __type) { - switch (__type) { - case __arg_t::__int: - case __arg_t::__long_long: - case __arg_t::__i128: - case __arg_t::__unsigned: - case __arg_t::__unsigned_long_long: - case __arg_t::__u128: - return; - - default: - std::__throw_format_error("Argument isn't an integral type"); - } -} - +// [format.string.std]/8 +// If { arg-idopt } is used in a width or precision, the value of the +// corresponding formatting argument is used in its place. If the +// corresponding formatting argument is not of standard signed or unsigned +// integer type, or its value is negative for precision or non-positive for +// width, an exception of type format_error is thrown. +// // _HasPrecision does the formatter have a precision? template <class _CharT, class _Tp, bool _HasPrecision = false> -_LIBCPP_HIDE_FROM_ABI constexpr void -__compile_time_validate_argument(basic_format_parse_context<_CharT>& __parse_ctx, - __compile_time_basic_format_context<_CharT>& __ctx) { +_LIBCPP_HIDE_FROM_ABI constexpr void __compile_time_validate_argument( + basic_format_parse_context<_CharT>& __parse_ctx, __compile_time_basic_format_context<_CharT>& __ctx) { + auto __validate_type = [](__arg_t __type) { + // LWG3720 originally allowed "signed or unsigned integer types", however + // the final version explicitly changed it to "*standard* signed or unsigned + // integer types". It's trivial to use 128-bit integrals in libc++'s + // implementation, but other implementations may not implement it. + // (Using a width or precision, that does not fit in 64-bits, sounds very + // unlikely in real world code.) + switch (__type) { + case __arg_t::__int: + case __arg_t::__long_long: + case __arg_t::__unsigned: + case __arg_t::__unsigned_long_long: + return; + + default: + std::__throw_format_error("Replacement argument isn't a standard signed or unsigned integer type"); + } + }; + formatter<_Tp, _CharT> __formatter; __parse_ctx.advance_to(__formatter.parse(__parse_ctx)); - // [format.string.std]/7 - // ... If the corresponding formatting argument is not of integral type, or - // its value is negative for precision or non-positive for width, an - // exception of type format_error is thrown. - // - // Validate whether the arguments are integrals. if (__formatter.__parser_.__width_as_arg_) - __format::__compile_time_validate_integral(__ctx.arg(__formatter.__parser_.__width_)); + __validate_type(__ctx.arg(__formatter.__parser_.__width_)); if constexpr (_HasPrecision) if (__formatter.__parser_.__precision_as_arg_) - __format::__compile_time_validate_integral(__ctx.arg(__formatter.__parser_.__precision_)); + __validate_type(__ctx.arg(__formatter.__parser_.__precision_)); } // This function is not user facing, so it can directly use the non-standard types of the "variant". @@ -236,21 +241,22 @@ std::__throw_format_error("Invalid argument"); } -template <class _CharT, class _ParseCtx, class _Ctx> -_LIBCPP_HIDE_FROM_ABI constexpr const _CharT* -__handle_replacement_field(const _CharT* __begin, const _CharT* __end, +template <contiguous_iterator _Iterator, class _ParseCtx, class _Ctx> +_LIBCPP_HIDE_FROM_ABI constexpr _Iterator +__handle_replacement_field(_Iterator __begin, _Iterator __end, _ParseCtx& __parse_ctx, _Ctx& __ctx) { + using _CharT = iter_value_t<_Iterator>; __format::__parse_number_result __r = __format::__parse_arg_id(__begin, __end, __parse_ctx); - bool __parse = *__r.__ptr == _CharT(':'); - switch (*__r.__ptr) { + bool __parse = *__r.__last == _CharT(':'); + switch (*__r.__last) { case _CharT(':'): // The arg-id has a format-specifier, advance the input to the format-spec. - __parse_ctx.advance_to(__r.__ptr + 1); + __parse_ctx.advance_to(__r.__last + 1); break; case _CharT('}'): // The arg-id has no format-specifier. - __parse_ctx.advance_to(__r.__ptr); + __parse_ctx.advance_to(__r.__last); break; default: std::__throw_format_error("The replacement field arg-id should terminate at a ':' or '}'"); @@ -258,10 +264,12 @@ if constexpr (same_as<_Ctx, __compile_time_basic_format_context<_CharT>>) { __arg_t __type = __ctx.arg(__r.__value); - if (__type == __arg_t::__handle) + if (__type == __arg_t::__none) + std::__throw_format_error("Argument index out of bounds"); + else if (__type == __arg_t::__handle) __ctx.__handle(__r.__value).__parse(__parse_ctx); - else - __format::__compile_time_visit_format_arg(__parse_ctx, __ctx, __type); + else if (__parse) + __format::__compile_time_visit_format_arg(__parse_ctx, __ctx, __type); } else _VSTD::__visit_format_arg( [&](auto __arg) { @@ -291,8 +299,8 @@ using _CharT = typename _ParseCtx::char_type; static_assert(same_as<typename _Ctx::char_type, _CharT>); - const _CharT* __begin = __parse_ctx.begin(); - const _CharT* __end = __parse_ctx.end(); + auto __begin = __parse_ctx.begin(); + auto __end = __parse_ctx.end(); typename _Ctx::iterator __out_it = __ctx.out(); while (__begin != __end) { switch (*__begin) { @@ -339,7 +347,7 @@ _Context{__types_.data(), __handles_.data(), sizeof...(_Args)}); } - _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT constexpr basic_string_view<_CharT> get() const noexcept { + _LIBCPP_HIDE_FROM_ABI constexpr basic_string_view<_CharT> get() const noexcept { return __str_; } @@ -404,21 +412,21 @@ // https://reviews.llvm.org/D110499#inline-1180704 // TODO FMT Evaluate whether we want to file a Clang bug report regarding this. template <output_iterator<const char&> _OutIt> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt vformat_to(_OutIt __out_it, string_view __fmt, format_args __args) { return _VSTD::__vformat_to(_VSTD::move(__out_it), __fmt, __args); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <output_iterator<const wchar_t&> _OutIt> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt vformat_to(_OutIt __out_it, wstring_view __fmt, wformat_args __args) { return _VSTD::__vformat_to(_VSTD::move(__out_it), __fmt, __args); } #endif template <output_iterator<const char&> _OutIt, class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt format_to(_OutIt __out_it, format_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::vformat_to(_VSTD::move(__out_it), __fmt.get(), _VSTD::make_format_args(__args...)); @@ -426,14 +434,17 @@ #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <output_iterator<const wchar_t&> _OutIt, class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt format_to(_OutIt __out_it, wformat_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::vformat_to(_VSTD::move(__out_it), __fmt.get(), _VSTD::make_wformat_args(__args...)); } #endif -_LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string +// TODO FMT This needs to be a template or std::to_chars(floating-point) availability markup +// fires too eagerly, see http://llvm.org/PR61563. +template <class = void> +_LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI string vformat(string_view __fmt, format_args __args) { string __res; _VSTD::vformat_to(_VSTD::back_inserter(__res), __fmt, __args); @@ -441,7 +452,10 @@ } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring +// TODO FMT This needs to be a template or std::to_chars(floating-point) availability markup +// fires too eagerly, see http://llvm.org/PR61563. +template <class = void> +_LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI wstring vformat(wstring_view __fmt, wformat_args __args) { wstring __res; _VSTD::vformat_to(_VSTD::back_inserter(__res), __fmt, __args); @@ -450,14 +464,14 @@ #endif template <class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string format(format_string<_Args...> __fmt, +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI string format(format_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::vformat(__fmt.get(), _VSTD::make_format_args(__args...)); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI wstring format(wformat_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::vformat(__fmt.get(), _VSTD::make_wformat_args(__args...)); } @@ -474,14 +488,14 @@ } template <output_iterator<const char&> _OutIt, class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt> +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, format_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::__vformat_to_n<format_context>(_VSTD::move(__out_it), __n, __fmt.get(), _VSTD::make_format_args(__args...)); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <output_iterator<const wchar_t&> _OutIt, class... _Args> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt> +_LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, wformat_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::__vformat_to_n<wformat_context>(_VSTD::move(__out_it), __n, __fmt.get(), _VSTD::make_wformat_args(__args...)); @@ -497,14 +511,14 @@ } template <class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t formatted_size(format_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::__vformatted_size(__fmt.get(), basic_format_args{_VSTD::make_format_args(__args...)}); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t formatted_size(wformat_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::__vformatted_size(__fmt.get(), basic_format_args{_VSTD::make_wformat_args(__args...)}); } @@ -531,7 +545,7 @@ } template <output_iterator<const char&> _OutIt> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt vformat_to( +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt vformat_to( _OutIt __out_it, locale __loc, string_view __fmt, format_args __args) { return _VSTD::__vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt, __args); @@ -539,7 +553,7 @@ #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <output_iterator<const wchar_t&> _OutIt> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt vformat_to( +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt vformat_to( _OutIt __out_it, locale __loc, wstring_view __fmt, wformat_args __args) { return _VSTD::__vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt, __args); @@ -547,7 +561,7 @@ #endif template <output_iterator<const char&> _OutIt, class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt format_to(_OutIt __out_it, locale __loc, format_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt.get(), _VSTD::make_format_args(__args...)); @@ -555,14 +569,17 @@ #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <output_iterator<const wchar_t&> _OutIt, class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT _OutIt +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _OutIt format_to(_OutIt __out_it, locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::vformat_to(_VSTD::move(__out_it), _VSTD::move(__loc), __fmt.get(), _VSTD::make_wformat_args(__args...)); } #endif -_LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string +// TODO FMT This needs to be a template or std::to_chars(floating-point) availability markup +// fires too eagerly, see http://llvm.org/PR61563. +template <class = void> +_LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI string vformat(locale __loc, string_view __fmt, format_args __args) { string __res; _VSTD::vformat_to(_VSTD::back_inserter(__res), _VSTD::move(__loc), __fmt, @@ -571,7 +588,10 @@ } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -_LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring +// TODO FMT This needs to be a template or std::to_chars(floating-point) availability markup +// fires too eagerly, see http://llvm.org/PR61563. +template <class = void> +_LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI wstring vformat(locale __loc, wstring_view __fmt, wformat_args __args) { wstring __res; _VSTD::vformat_to(_VSTD::back_inserter(__res), _VSTD::move(__loc), __fmt, @@ -581,7 +601,7 @@ #endif template <class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT string format(locale __loc, +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI string format(locale __loc, format_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::vformat(_VSTD::move(__loc), __fmt.get(), @@ -590,7 +610,7 @@ #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT wstring +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI wstring format(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::vformat(_VSTD::move(__loc), __fmt.get(), _VSTD::make_wformat_args(__args...)); @@ -609,7 +629,7 @@ } template <output_iterator<const char&> _OutIt, class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt> +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc, format_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::__vformat_to_n<format_context>(_VSTD::move(__out_it), __n, _VSTD::move(__loc), __fmt.get(), @@ -618,7 +638,7 @@ #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <output_iterator<const wchar_t&> _OutIt, class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT format_to_n_result<_OutIt> +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> format_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::__vformat_to_n<wformat_context>(_VSTD::move(__out_it), __n, _VSTD::move(__loc), __fmt.get(), @@ -636,14 +656,14 @@ } template <class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t formatted_size(locale __loc, format_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::__vformatted_size(_VSTD::move(__loc), __fmt.get(), basic_format_args{_VSTD::make_format_args(__args...)}); } #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <class... _Args> -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_FORMAT size_t +_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t formatted_size(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::__vformatted_size(_VSTD::move(__loc), __fmt.get(), basic_format_args{_VSTD::make_wformat_args(__args...)}); } @@ -652,7 +672,7 @@ #endif // _LIBCPP_HAS_NO_LOCALIZATION -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/format_fwd.h b/third_party/llvm-project/libcxx/include/__format/format_fwd.h index f7c72e2..120b2fc 100644 --- a/third_party/llvm-project/libcxx/include/__format/format_fwd.h +++ b/third_party/llvm-project/libcxx/include/__format/format_fwd.h
@@ -20,19 +20,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Context> -class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT basic_format_arg; +class _LIBCPP_TEMPLATE_VIS basic_format_arg; template <class _OutIt, class _CharT> requires output_iterator<_OutIt, const _CharT&> -class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT basic_format_context; +class _LIBCPP_TEMPLATE_VIS basic_format_context; template <class _Tp, class _CharT = char> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter; +struct _LIBCPP_TEMPLATE_VIS formatter; -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/format_parse_context.h b/third_party/llvm-project/libcxx/include/__format/format_parse_context.h index 30e3a7d..79f53f7 100644 --- a/third_party/llvm-project/libcxx/include/__format/format_parse_context.h +++ b/third_party/llvm-project/libcxx/include/__format/format_parse_context.h
@@ -12,6 +12,7 @@ #include <__config> #include <__format/format_error.h> +#include <__type_traits/is_constant_evaluated.h> #include <string_view> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -20,10 +21,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _CharT> -class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT basic_format_parse_context { +class _LIBCPP_TEMPLATE_VIS basic_format_parse_context { public: using char_type = _CharT; using const_iterator = typename basic_string_view<_CharT>::const_iterator; @@ -58,6 +59,18 @@ if (__indexing_ == __unknown) __indexing_ = __automatic; + + // Throws an exception to make the expression a non core constant + // expression as required by: + // [format.parse.ctx]/8 + // Remarks: Let cur-arg-id be the value of next_arg_id_ prior to this + // call. Call expressions where cur-arg-id >= num_args_ is true are not + // core constant expressions (7.7 [expr.const]). + // Note: the Throws clause [format.parse.ctx]/9 doesn't specify the + // behavior when id >= num_args_. + if (is_constant_evaluated() && __next_arg_id_ >= __num_args_) + std::__throw_format_error("Argument index outside the valid range"); + return __next_arg_id_++; } _LIBCPP_HIDE_FROM_ABI constexpr void check_arg_id(size_t __id) { @@ -93,7 +106,7 @@ using wformat_parse_context = basic_format_parse_context<wchar_t>; #endif -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/format_string.h b/third_party/llvm-project/libcxx/include/__format/format_string.h index d9caf86..bec3fe1 100644 --- a/third_party/llvm-project/libcxx/include/__format/format_string.h +++ b/third_party/llvm-project/libcxx/include/__format/format_string.h
@@ -13,6 +13,8 @@ #include <__assert> #include <__config> #include <__format/format_error.h> +#include <__iterator/concepts.h> +#include <__iterator/readable_traits.h> // iter_value_t #include <cstddef> #include <cstdint> @@ -22,22 +24,22 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace __format { -template <class _CharT> +template <contiguous_iterator _Iterator> struct _LIBCPP_TEMPLATE_VIS __parse_number_result { - const _CharT* __ptr; + _Iterator __last; uint32_t __value; }; -template <class _CharT> -__parse_number_result(const _CharT*, uint32_t) -> __parse_number_result<_CharT>; +template <contiguous_iterator _Iterator> +__parse_number_result(_Iterator, uint32_t) -> __parse_number_result<_Iterator>; -template <class _CharT> -_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_CharT> -__parse_number(const _CharT* __begin, const _CharT* __end); +template <contiguous_iterator _Iterator> +_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_Iterator> +__parse_number(_Iterator __begin, _Iterator __end); /** * The maximum value of a numeric argument. @@ -53,16 +55,16 @@ inline constexpr uint32_t __number_max = INT32_MAX; namespace __detail { -template <class _CharT> -_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_CharT> -__parse_zero(const _CharT* __begin, const _CharT*, auto& __parse_ctx) { +template <contiguous_iterator _Iterator> +_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_Iterator> +__parse_zero(_Iterator __begin, _Iterator, auto& __parse_ctx) { __parse_ctx.check_arg_id(0); return {++__begin, 0}; // can never be larger than the maximum. } -template <class _CharT> -_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_CharT> -__parse_automatic(const _CharT* __begin, const _CharT*, auto& __parse_ctx) { +template <contiguous_iterator _Iterator> +_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_Iterator> +__parse_automatic(_Iterator __begin, _Iterator, auto& __parse_ctx) { size_t __value = __parse_ctx.next_arg_id(); _LIBCPP_ASSERT(__value <= __number_max, "Compilers don't support this number of arguments"); @@ -70,10 +72,10 @@ return {__begin, uint32_t(__value)}; } -template <class _CharT> -_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_CharT> -__parse_manual(const _CharT* __begin, const _CharT* __end, auto& __parse_ctx) { - __parse_number_result<_CharT> __r = __format::__parse_number(__begin, __end); +template <contiguous_iterator _Iterator> +_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_Iterator> +__parse_manual(_Iterator __begin, _Iterator __end, auto& __parse_ctx) { + __parse_number_result<_Iterator> __r = __format::__parse_number(__begin, __end); __parse_ctx.check_arg_id(__r.__value); return __r; } @@ -86,9 +88,10 @@ * The number is used for the 31-bit values @em width and @em precision. This * allows a maximum value of 2147483647. */ -template <class _CharT> -_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_CharT> -__parse_number(const _CharT* __begin, const _CharT* __end_input) { +template <contiguous_iterator _Iterator> +_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_Iterator> +__parse_number(_Iterator __begin, _Iterator __end_input) { + using _CharT = iter_value_t<_Iterator>; static_assert(__format::__number_max == INT32_MAX, "The algorithm is implemented based on this value."); /* @@ -98,7 +101,7 @@ * - Does the value exceed width of an uint32_t? (Switching to uint64_t would * have the same issue, but with a higher maximum.) */ - const _CharT* __end = __end_input - __begin > 9 ? __begin + 9 : __end_input; + _Iterator __end = __end_input - __begin > 9 ? __begin + 9 : __end_input; uint32_t __value = *__begin - _CharT('0'); while (++__begin != __end) { if (*__begin < _CharT('0') || *__begin > _CharT('9')) @@ -134,9 +137,10 @@ * The parser will return a pointer beyond the last consumed character. This * should be the closing '}' of the arg-id. */ -template <class _CharT> -_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_CharT> -__parse_arg_id(const _CharT* __begin, const _CharT* __end, auto& __parse_ctx) { +template <contiguous_iterator _Iterator> +_LIBCPP_HIDE_FROM_ABI constexpr __parse_number_result<_Iterator> +__parse_arg_id(_Iterator __begin, _Iterator __end, auto& __parse_ctx) { + using _CharT = iter_value_t<_Iterator>; switch (*__begin) { case _CharT('0'): return __detail::__parse_zero(__begin, __end, __parse_ctx); @@ -156,7 +160,7 @@ } // namespace __format -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/format_to_n_result.h b/third_party/llvm-project/libcxx/include/__format/format_to_n_result.h index f1ed9a0..6f30546 100644 --- a/third_party/llvm-project/libcxx/include/__format/format_to_n_result.h +++ b/third_party/llvm-project/libcxx/include/__format/format_to_n_result.h
@@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _OutIt> struct _LIBCPP_TEMPLATE_VIS format_to_n_result { @@ -28,7 +28,7 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(format_to_n_result); -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/formatter.h b/third_party/llvm-project/libcxx/include/__format/formatter.h index 900a09a..172b2d5 100644 --- a/third_party/llvm-project/libcxx/include/__format/formatter.h +++ b/third_party/llvm-project/libcxx/include/__format/formatter.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 /// The default formatter template. /// @@ -32,13 +32,13 @@ /// - is_copy_assignable<F>, and /// - is_move_assignable<F>. template <class _Tp, class _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter { +struct _LIBCPP_TEMPLATE_VIS formatter { formatter() = delete; formatter(const formatter&) = delete; formatter& operator=(const formatter&) = delete; }; -# if _LIBCPP_STD_VER > 20 +# if _LIBCPP_STD_VER >= 23 template <class _Tp> _LIBCPP_HIDE_FROM_ABI constexpr void __set_debug_format(_Tp& __formatter) { @@ -46,8 +46,8 @@ __formatter.set_debug_format(); } -# endif // _LIBCPP_STD_VER > 20 -#endif // _LIBCPP_STD_VER > 17 +# endif // _LIBCPP_STD_VER >= 23 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/formatter_bool.h b/third_party/llvm-project/libcxx/include/__format/formatter_bool.h index 0d005a1..1fb7575 100644 --- a/third_party/llvm-project/libcxx/include/__format/formatter_bool.h +++ b/third_party/llvm-project/libcxx/include/__format/formatter_bool.h
@@ -33,10 +33,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<bool, _CharT> { +struct _LIBCPP_TEMPLATE_VIS formatter<bool, _CharT> { public: _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) -> decltype(__parse_ctx.begin()) { @@ -71,7 +71,7 @@ __format_spec::__parser<_CharT> __parser_; }; -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/formatter_char.h b/third_party/llvm-project/libcxx/include/__format/formatter_char.h index 8a92e74..7d63c04 100644 --- a/third_party/llvm-project/libcxx/include/__format/formatter_char.h +++ b/third_party/llvm-project/libcxx/include/__format/formatter_char.h
@@ -28,10 +28,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __formatter_char { +struct _LIBCPP_TEMPLATE_VIS __formatter_char { public: _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) -> decltype(__parse_ctx.begin()) { @@ -44,7 +44,7 @@ if (__parser_.__type_ == __format_spec::__type::__default || __parser_.__type_ == __format_spec::__type::__char) return __formatter::__format_char(__value, __ctx.out(), __parser_.__get_parsed_std_specifications(__ctx)); -# if _LIBCPP_STD_VER > 20 +# if _LIBCPP_STD_VER >= 23 if (__parser_.__type_ == __format_spec::__type::__debug) return __formatter::__format_escaped_char(__value, __ctx.out(), __parser_.__get_parsed_std_specifications(__ctx)); # endif @@ -66,7 +66,7 @@ return format(static_cast<wchar_t>(__value), __ctx); } -# if _LIBCPP_STD_VER > 20 +# if _LIBCPP_STD_VER >= 23 _LIBCPP_HIDE_FROM_ABI constexpr void set_debug_format() { __parser_.__type_ = __format_spec::__type::__debug; } # endif @@ -74,19 +74,19 @@ }; template <> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<char, char> : public __formatter_char<char> {}; +struct _LIBCPP_TEMPLATE_VIS formatter<char, char> : public __formatter_char<char> {}; # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<char, wchar_t> : public __formatter_char<wchar_t> {}; +struct _LIBCPP_TEMPLATE_VIS formatter<char, wchar_t> : public __formatter_char<wchar_t> {}; template <> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<wchar_t, wchar_t> : public __formatter_char<wchar_t> { +struct _LIBCPP_TEMPLATE_VIS formatter<wchar_t, wchar_t> : public __formatter_char<wchar_t> { }; # endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/formatter_floating_point.h b/third_party/llvm-project/libcxx/include/__format/formatter_floating_point.h index a544b53..12c7e58 100644 --- a/third_party/llvm-project/libcxx/include/__format/formatter_floating_point.h +++ b/third_party/llvm-project/libcxx/include/__format/formatter_floating_point.h
@@ -16,6 +16,9 @@ #include <__algorithm/min.h> #include <__algorithm/rotate.h> #include <__algorithm/transform.h> +#include <__charconv/chars_format.h> +#include <__charconv/to_chars_floating_point.h> +#include <__charconv/to_chars_result.h> #include <__concepts/arithmetic.h> #include <__concepts/same_as.h> #include <__config> @@ -26,9 +29,12 @@ #include <__format/formatter_output.h> #include <__format/parser_std_format_spec.h> #include <__memory/allocator.h> +#include <__system_error/errc.h> +#include <__type_traits/conditional.h> #include <__utility/move.h> #include <__utility/unreachable.h> -#include <charconv> +#include <cmath> +#include <cstddef> #ifndef _LIBCPP_HAS_NO_LOCALIZATION # include <locale> @@ -43,7 +49,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace __formatter { @@ -404,7 +410,6 @@ // In fixed mode the algorithm truncates trailing spaces and possibly the // radix point. There's no good guess for the position of the radix point // therefore scan the output after the first digit. - __result.__radix_point = _VSTD::find(__first, __result.__last, '.'); } } @@ -665,7 +670,7 @@ if (__result.__exponent == __result.__last) // if P > X >= -4, the conversion is with style f or F and precision P - 1 - X. // By including the radix point it calculates P - (1 + X) - __p -= __result.__radix_point - __buffer.begin(); + __p -= __result.__radix_point - __result.__integral; else // otherwise, the conversion is with style e or E and precision P - 1. --__p; @@ -739,16 +744,16 @@ }; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<float, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<float, _CharT> : public __formatter_floating_point<_CharT> {}; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<double, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<double, _CharT> : public __formatter_floating_point<_CharT> {}; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<long double, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<long double, _CharT> : public __formatter_floating_point<_CharT> {}; -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/formatter_integer.h b/third_party/llvm-project/libcxx/include/__format/formatter_integer.h index b4be9f9..0e14410 100644 --- a/third_party/llvm-project/libcxx/include/__format/formatter_integer.h +++ b/third_party/llvm-project/libcxx/include/__format/formatter_integer.h
@@ -19,8 +19,8 @@ #include <__format/formatter_integral.h> #include <__format/formatter_output.h> #include <__format/parser_std_format_spec.h> +#include <__type_traits/is_same.h> #include <__type_traits/make_32_64_or_128_bit.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -28,10 +28,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <__fmt_char_type _CharT> - struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __formatter_integer { + struct _LIBCPP_TEMPLATE_VIS __formatter_integer { public: _LIBCPP_HIDE_FROM_ABI constexpr auto @@ -60,47 +60,47 @@ // Signed integral types. template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<signed char, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<signed char, _CharT> : public __formatter_integer<_CharT> {}; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<short, _CharT> : public __formatter_integer<_CharT> { +struct _LIBCPP_TEMPLATE_VIS formatter<short, _CharT> : public __formatter_integer<_CharT> { }; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<int, _CharT> : public __formatter_integer<_CharT> {}; +struct _LIBCPP_TEMPLATE_VIS formatter<int, _CharT> : public __formatter_integer<_CharT> {}; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<long, _CharT> : public __formatter_integer<_CharT> {}; +struct _LIBCPP_TEMPLATE_VIS formatter<long, _CharT> : public __formatter_integer<_CharT> {}; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<long long, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<long long, _CharT> : public __formatter_integer<_CharT> {}; # ifndef _LIBCPP_HAS_NO_INT128 template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<__int128_t, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<__int128_t, _CharT> : public __formatter_integer<_CharT> {}; # endif // Unsigned integral types. template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<unsigned char, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<unsigned char, _CharT> : public __formatter_integer<_CharT> {}; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<unsigned short, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<unsigned short, _CharT> : public __formatter_integer<_CharT> {}; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<unsigned, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<unsigned, _CharT> : public __formatter_integer<_CharT> {}; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<unsigned long, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<unsigned long, _CharT> : public __formatter_integer<_CharT> {}; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<unsigned long long, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<unsigned long long, _CharT> : public __formatter_integer<_CharT> {}; # ifndef _LIBCPP_HAS_NO_INT128 template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<__uint128_t, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<__uint128_t, _CharT> : public __formatter_integer<_CharT> {}; # endif -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/formatter_integral.h b/third_party/llvm-project/libcxx/include/__format/formatter_integral.h index fe3a063..80d2457 100644 --- a/third_party/llvm-project/libcxx/include/__format/formatter_integral.h +++ b/third_party/llvm-project/libcxx/include/__format/formatter_integral.h
@@ -10,6 +10,9 @@ #ifndef _LIBCPP___FORMAT_FORMATTER_INTEGRAL_H #define _LIBCPP___FORMAT_FORMATTER_INTEGRAL_H +#include <__charconv/to_chars_integral.h> +#include <__charconv/to_chars_result.h> +#include <__charconv/traits.h> #include <__concepts/arithmetic.h> #include <__concepts/same_as.h> #include <__config> @@ -17,11 +20,13 @@ #include <__format/format_error.h> #include <__format/formatter_output.h> #include <__format/parser_std_format_spec.h> +#include <__system_error/errc.h> +#include <__type_traits/make_unsigned.h> #include <__utility/unreachable.h> #include <array> -#include <charconv> #include <limits> #include <string> +#include <string_view> #ifndef _LIBCPP_HAS_NO_LOCALIZATION # include <locale> @@ -36,7 +41,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace __formatter { @@ -354,7 +359,7 @@ } // namespace __formatter -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/formatter_output.h b/third_party/llvm-project/libcxx/include/__format/formatter_output.h index 4676925..f751d8a 100644 --- a/third_party/llvm-project/libcxx/include/__format/formatter_output.h +++ b/third_party/llvm-project/libcxx/include/__format/formatter_output.h
@@ -12,7 +12,10 @@ #include <__algorithm/ranges_copy.h> #include <__algorithm/ranges_fill_n.h> +#include <__algorithm/ranges_for_each.h> #include <__algorithm/ranges_transform.h> +#include <__charconv/to_chars_integral.h> +#include <__charconv/to_chars_result.h> #include <__chrono/statically_widen.h> #include <__concepts/same_as.h> #include <__config> @@ -23,10 +26,12 @@ #include <__format/parser_std_format_spec.h> #include <__format/unicode.h> #include <__iterator/back_insert_iterator.h> +#include <__iterator/concepts.h> +#include <__iterator/readable_traits.h> // iter_value_t +#include <__system_error/errc.h> #include <__type_traits/make_unsigned.h> #include <__utility/move.h> #include <__utility/unreachable.h> -#include <charconv> #include <cstddef> #include <string> #include <string_view> @@ -37,7 +42,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace __formatter { @@ -261,11 +266,11 @@ return __formatter::__fill(_VSTD::move(__out_it), __padding.__after_, __specs.__fill_); } -template <class _CharT, class _ParserCharT> +template <contiguous_iterator _Iterator, class _ParserCharT> _LIBCPP_HIDE_FROM_ABI auto -__write(const _CharT* __first, - const _CharT* __last, - output_iterator<const _CharT&> auto __out_it, +__write(_Iterator __first, + _Iterator __last, + output_iterator<const iter_value_t<_Iterator>&> auto __out_it, __format_spec::__parsed_specifications<_ParserCharT> __specs, ptrdiff_t __size) -> decltype(__out_it) { _LIBCPP_ASSERT(__first <= __last, "Not a valid range"); @@ -275,11 +280,11 @@ /// \overload /// /// Calls the function above where \a __size = \a __last - \a __first. -template <class _CharT, class _ParserCharT> +template <contiguous_iterator _Iterator, class _ParserCharT> _LIBCPP_HIDE_FROM_ABI auto -__write(const _CharT* __first, - const _CharT* __last, - output_iterator<const _CharT&> auto __out_it, +__write(_Iterator __first, + _Iterator __last, + output_iterator<const iter_value_t<_Iterator>&> auto __out_it, __format_spec::__parsed_specifications<_ParserCharT> __specs) -> decltype(__out_it) { _LIBCPP_ASSERT(__first <= __last, "Not a valid range"); return __formatter::__write(__first, __last, _VSTD::move(__out_it), __specs, __last - __first); @@ -359,7 +364,7 @@ template <class _CharT> _LIBCPP_HIDE_FROM_ABI int __truncate(basic_string_view<_CharT>& __str, int __precision) { - __format_spec::__column_width_result<_CharT> __result = + __format_spec::__column_width_result __result = __format_spec::__estimate_column_width(__str, __precision, __format_spec::__column_width_rounding::__down); __str = basic_string_view<_CharT>{__str.begin(), __result.__last_}; return __result.__width_; @@ -382,7 +387,7 @@ return __formatter::__write(__str.begin(), __str.end(), _VSTD::move(__out_it), __specs, __size); } -# if _LIBCPP_STD_VER > 20 +# if _LIBCPP_STD_VER >= 23 struct __nul_terminator {}; @@ -501,36 +506,17 @@ __unicode::__code_point_view<_CharT> __view{__values.begin(), __values.end()}; while (!__view.__at_end()) { - const _CharT* __first = __view.__position(); - typename __unicode::__consume_p2286_result __result = __view.__consume_p2286(); - if (__result.__ill_formed_size == 0) { - if (!__formatter::__is_escaped_sequence_written(__str, __result.__value, __mark)) + auto __first = __view.__position(); + typename __unicode::__consume_result __result = __view.__consume(); + if (__result.__status == __unicode::__consume_result::__ok) { + if (!__formatter::__is_escaped_sequence_written(__str, __result.__code_point, __mark)) // 2.2.1.3 - Add the character ranges::copy(__first, __view.__position(), std::back_insert_iterator(__str)); - } else { // 2.2.3 sequence of ill-formed code units - // The number of code-units in __result.__value depends on the character type being used. - if constexpr (sizeof(_CharT) == 1) { - _LIBCPP_ASSERT(__result.__ill_formed_size == 1 || __result.__ill_formed_size == 4, - "illegal number of invalid code units."); - if (__result.__ill_formed_size == 1) // ill-formed, one code unit - __formatter::__write_escape_ill_formed_code_unit(__str, __result.__value & 0xff); - else { // out of valid range, four code units - // The code point was properly encoded, decode the value. - __formatter::__write_escape_ill_formed_code_unit(__str, __result.__value >> 18 | 0xf0); - __formatter::__write_escape_ill_formed_code_unit(__str, (__result.__value >> 12 & 0x3f) | 0x80); - __formatter::__write_escape_ill_formed_code_unit(__str, (__result.__value >> 6 & 0x3f) | 0x80); - __formatter::__write_escape_ill_formed_code_unit(__str, (__result.__value & 0x3f) | 0x80); - } - } else if constexpr (sizeof(_CharT) == 2) { - _LIBCPP_ASSERT(__result.__ill_formed_size == 1, "for UTF-16 at most one invalid code unit"); - __formatter::__write_escape_ill_formed_code_unit(__str, __result.__value & 0xffff); - } else { - static_assert(sizeof(_CharT) == 4, "unsupported character width"); - _LIBCPP_ASSERT(__result.__ill_formed_size == 1, "for UTF-32 one code unit is one code point"); - __formatter::__write_escape_ill_formed_code_unit(__str, __result.__value); - } + ranges::for_each(__first, __view.__position(), [&](_CharT __value) { + __formatter::__write_escape_ill_formed_code_unit(__str, __formatter::__to_char32(__value)); + }); } } } @@ -559,11 +545,11 @@ return __formatter::__write_string(basic_string_view{__str}, _VSTD::move(__out_it), __specs); } -# endif // _LIBCPP_STD_VER > 20 +# endif // _LIBCPP_STD_VER >= 23 } // namespace __formatter -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/formatter_pointer.h b/third_party/llvm-project/libcxx/include/__format/formatter_pointer.h index 31b49e1..48d8372 100644 --- a/third_party/llvm-project/libcxx/include/__format/formatter_pointer.h +++ b/third_party/llvm-project/libcxx/include/__format/formatter_pointer.h
@@ -27,13 +27,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <__fmt_char_type _CharT> struct _LIBCPP_TEMPLATE_VIS __formatter_pointer { public: - constexpr __formatter_pointer() { __parser_.__alignment_ = __format_spec::__alignment::__right; } - _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) -> decltype(__parse_ctx.begin()) { auto __result = __parser_.__parse(__parse_ctx, __format_spec::__fields_pointer); @@ -48,7 +46,7 @@ return __formatter::__format_integer(reinterpret_cast<uintptr_t>(__ptr), __ctx, __specs); } - __format_spec::__parser<_CharT> __parser_; + __format_spec::__parser<_CharT> __parser_{.__alignment_ = __format_spec::__alignment::__right}; }; // [format.formatter.spec]/2.4 @@ -57,16 +55,16 @@ // - template<> struct formatter<void*, charT>; // - template<> struct formatter<const void*, charT>; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<nullptr_t, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<nullptr_t, _CharT> : public __formatter_pointer<_CharT> {}; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<void*, _CharT> : public __formatter_pointer<_CharT> { +struct _LIBCPP_TEMPLATE_VIS formatter<void*, _CharT> : public __formatter_pointer<_CharT> { }; template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<const void*, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<const void*, _CharT> : public __formatter_pointer<_CharT> {}; -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/formatter_string.h b/third_party/llvm-project/libcxx/include/__format/formatter_string.h index 606fb79..c14518b 100644 --- a/third_party/llvm-project/libcxx/include/__format/formatter_string.h +++ b/third_party/llvm-project/libcxx/include/__format/formatter_string.h
@@ -27,7 +27,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <__fmt_char_type _CharT> struct _LIBCPP_TEMPLATE_VIS __formatter_string { @@ -40,7 +40,7 @@ } _LIBCPP_HIDE_FROM_ABI auto format(basic_string_view<_CharT> __str, auto& __ctx) const -> decltype(__ctx.out()) { -# if _LIBCPP_STD_VER > 20 +# if _LIBCPP_STD_VER >= 23 if (__parser_.__type_ == __format_spec::__type::__debug) return __formatter::__format_escaped_string(__str, __ctx.out(), __parser_.__get_parsed_std_specifications(__ctx)); # endif @@ -48,7 +48,7 @@ return __formatter::__write_string(__str, __ctx.out(), __parser_.__get_parsed_std_specifications(__ctx)); } -# if _LIBCPP_STD_VER > 20 +# if _LIBCPP_STD_VER >= 23 _LIBCPP_HIDE_FROM_ABI constexpr void set_debug_format() { __parser_.__type_ = __format_spec::__type::__debug; } # endif @@ -57,7 +57,7 @@ // Formatter const char*. template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<const _CharT*, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<const _CharT*, _CharT> : public __formatter_string<_CharT> { using _Base = __formatter_string<_CharT>; @@ -66,7 +66,7 @@ "prevented an invalid pointer."); __format_spec::__parsed_specifications<_CharT> __specs = _Base::__parser_.__get_parsed_std_specifications(__ctx); -# if _LIBCPP_STD_VER > 20 +# if _LIBCPP_STD_VER >= 23 if (_Base::__parser_.__type_ == __format_spec::__type::__debug) return __formatter::__format_escaped_string(basic_string_view<_CharT>{__str}, __ctx.out(), __specs); # endif @@ -95,7 +95,7 @@ // Formatter char*. template <__fmt_char_type _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<_CharT*, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<_CharT*, _CharT> : public formatter<const _CharT*, _CharT> { using _Base = formatter<const _CharT*, _CharT>; @@ -106,7 +106,7 @@ // Formatter char[]. template <__fmt_char_type _CharT, size_t _Size> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<_CharT[_Size], _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<_CharT[_Size], _CharT> : public __formatter_string<_CharT> { using _Base = __formatter_string<_CharT>; @@ -115,20 +115,9 @@ } }; -// Formatter const char[]. -template <__fmt_char_type _CharT, size_t _Size> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<const _CharT[_Size], _CharT> - : public __formatter_string<_CharT> { - using _Base = __formatter_string<_CharT>; - - _LIBCPP_HIDE_FROM_ABI auto format(const _CharT __str[_Size], auto& __ctx) const -> decltype(__ctx.out()) { - return _Base::format(basic_string_view<_CharT>(__str, _Size), __ctx); - } -}; - // Formatter std::string. template <__fmt_char_type _CharT, class _Traits, class _Allocator> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<basic_string<_CharT, _Traits, _Allocator>, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<basic_string<_CharT, _Traits, _Allocator>, _CharT> : public __formatter_string<_CharT> { using _Base = __formatter_string<_CharT>; @@ -141,7 +130,7 @@ // Formatter std::string_view. template <__fmt_char_type _CharT, class _Traits> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<basic_string_view<_CharT, _Traits>, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<basic_string_view<_CharT, _Traits>, _CharT> : public __formatter_string<_CharT> { using _Base = __formatter_string<_CharT>; @@ -152,7 +141,7 @@ } }; -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/formatter_tuple.h b/third_party/llvm-project/libcxx/include/__format/formatter_tuple.h index 82f5ada..9d6367b 100644 --- a/third_party/llvm-project/libcxx/include/__format/formatter_tuple.h +++ b/third_party/llvm-project/libcxx/include/__format/formatter_tuple.h
@@ -14,6 +14,7 @@ #include <__availability> #include <__chrono/statically_widen.h> #include <__config> +#include <__format/buffer.h> #include <__format/concepts.h> #include <__format/format_args.h> #include <__format/format_context.h> @@ -35,50 +36,55 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <__fmt_char_type _CharT, class _Tuple, formattable<_CharT>... _Args> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __formatter_tuple { - _LIBCPP_HIDE_FROM_ABI constexpr void set_separator(basic_string_view<_CharT> __separator) { +struct _LIBCPP_TEMPLATE_VIS __formatter_tuple { + _LIBCPP_HIDE_FROM_ABI constexpr void set_separator(basic_string_view<_CharT> __separator) noexcept { __separator_ = __separator; } _LIBCPP_HIDE_FROM_ABI constexpr void - set_brackets(basic_string_view<_CharT> __opening_bracket, basic_string_view<_CharT> __closing_bracket) { + set_brackets(basic_string_view<_CharT> __opening_bracket, basic_string_view<_CharT> __closing_bracket) noexcept { __opening_bracket_ = __opening_bracket; __closing_bracket_ = __closing_bracket; } template <class _ParseContext> _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __parse_ctx) { - const _CharT* __begin = __parser_.__parse(__parse_ctx, __format_spec::__fields_tuple); + auto __begin = __parser_.__parse(__parse_ctx, __format_spec::__fields_tuple); - // [format.tuple]/7 - // ... For each element e in underlying_, if e.set_debug_format() - // is a valid expression, calls e.set_debug_format(). - // TODO FMT this can be removed when P2733 is accepted. - std::__for_each_index_sequence(make_index_sequence<sizeof...(_Args)>(), [&]<size_t _Index> { - std::__set_debug_format(std::get<_Index>(__underlying_)); - }); - - const _CharT* __end = __parse_ctx.end(); - if (__begin == __end) - return __begin; - - if (*__begin == _CharT('m')) { - if constexpr (sizeof...(_Args) == 2) { - set_separator(_LIBCPP_STATICALLY_WIDEN(_CharT, ": ")); + auto __end = __parse_ctx.end(); + if (__begin != __end) { + if (*__begin == _CharT('m')) { + if constexpr (sizeof...(_Args) == 2) { + set_separator(_LIBCPP_STATICALLY_WIDEN(_CharT, ": ")); + set_brackets({}, {}); + ++__begin; + } else + std::__throw_format_error("The format specifier m requires a pair or a two-element tuple"); + } else if (*__begin == _CharT('n')) { set_brackets({}, {}); ++__begin; - } else - std::__throw_format_error("The format specifier m requires a pair or a two-element tuple"); - } else if (*__begin == _CharT('n')) { - set_brackets({}, {}); - ++__begin; + } } if (__begin != __end && *__begin != _CharT('}')) std::__throw_format_error("The format-spec should consume the input or end with a '}'"); + __parse_ctx.advance_to(__begin); + + // [format.tuple]/7 + // ... For each element e in underlying_, if e.set_debug_format() + // is a valid expression, calls e.set_debug_format(). + std::__for_each_index_sequence(make_index_sequence<sizeof...(_Args)>(), [&]<size_t _Index> { + auto& __formatter = std::get<_Index>(__underlying_); + __formatter.parse(__parse_ctx); + // Unlike the range_formatter we don't guard against evil parsers. Since + // this format-spec never has a format-spec for the underlying type + // adding the test would give additional overhead. + std::__set_debug_format(__formatter); + }); + return __begin; } @@ -91,26 +97,25 @@ if (!__specs.__has_width()) return __format_tuple(__tuple, __ctx); - basic_string<_CharT> __str; - - // Since the output is written to a different iterator a new context is - // created. Since the underlying formatter uses the default formatting it - // doesn't need a locale or the formatting arguments. So creating a new - // context works. - // - // This solution works for this formatter, but it will not work for the - // range_formatter. In that patch a generic solution is work in progress. - // Once that is finished it can be used here. (The range_formatter will use - // these features so it's easier to add it there and then port it.) - // - // TODO FMT Use formatting wrapping used in the range_formatter. - basic_format_context __c = std::__format_context_create( - back_insert_iterator{__str}, - basic_format_args<basic_format_context<back_insert_iterator<basic_string<_CharT>>, _CharT>>{}); + // The size of the buffer needed is: + // - open bracket characters + // - close bracket character + // - n elements where every element may have a different size + // - (n -1) separators + // The size of the element is hard to predict, knowing the type helps but + // it depends on the format-spec. As an initial estimate we guess 6 + // characters. + // Typically both brackets are 1 character and the separator is 2 + // characters. Which means there will be + // (n - 1) * 2 + 1 + 1 = n * 2 character + // So estimate 8 times the range size as buffer. + __format::__retarget_buffer<_CharT> __buffer{8 * tuple_size_v<_Tuple>}; + basic_format_context<typename __format::__retarget_buffer<_CharT>::__iterator, _CharT> __c{ + __buffer.__make_output_iterator(), __ctx}; __format_tuple(__tuple, __c); - return __formatter::__write_string_no_precision(basic_string_view{__str}, __ctx.out(), __specs); + return __formatter::__write_string_no_precision(basic_string_view{__buffer.__view()}, __ctx.out(), __specs); } template <class _FormatContext> @@ -120,35 +125,7 @@ std::__for_each_index_sequence(make_index_sequence<sizeof...(_Args)>(), [&]<size_t _Index> { if constexpr (_Index) __ctx.advance_to(std::ranges::copy(__separator_, __ctx.out()).out); - - // During review Victor suggested to make the exposition only - // __underlying_ member a local variable. Currently the Standard - // requires nested debug-enabled formatter specializations not to - // output escaped output. P2733 fixes that bug, once accepted the - // code below can be used. - // (Note when a paper allows parsing a tuple-underlying-spec the - // exposition only member needs to be a class member. Earlier - // revisions of P2286 proposed that, but this was not pursued, - // due to time constrains and complexity of the matter.) - // TODO FMT This can be updated after P2733 is accepted. -# if 0 - // P2286 uses an exposition only member in the formatter - // tuple<formatter<remove_cvref_t<_Args>, _CharT>...> __underlying_; - // This was used in earlier versions of the paper since - // __underlying_.parse(...) was called. This is no longer the case - // so we can reduce the scope of the formatter. - // - // It does require the underlying's parse effect to be moved here too. - using _Arg = tuple_element<_Index, decltype(__tuple)>; - formatter<remove_cvref_t<_Args>, _CharT> __underlying; - - // [format.tuple]/7 - // ... For each element e in underlying_, if e.set_debug_format() - // is a valid expression, calls e.set_debug_format(). - std::__set_debug_format(__underlying); -# else __ctx.advance_to(std::get<_Index>(__underlying_).format(std::get<_Index>(__tuple), __ctx)); -# endif }); return std::ranges::copy(__closing_bracket_, __ctx.out()).out; @@ -164,14 +141,14 @@ }; template <__fmt_char_type _CharT, formattable<_CharT>... _Args> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<pair<_Args...>, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<pair<_Args...>, _CharT> : public __formatter_tuple<_CharT, pair<_Args...>, _Args...> {}; template <__fmt_char_type _CharT, formattable<_CharT>... _Args> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<tuple<_Args...>, _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<tuple<_Args...>, _CharT> : public __formatter_tuple<_CharT, tuple<_Args...>, _Args...> {}; -#endif //_LIBCPP_STD_VER > 20 +#endif //_LIBCPP_STD_VER >= 23 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/parser_std_format_spec.h b/third_party/llvm-project/libcxx/include/__format/parser_std_format_spec.h index c03cec9..620ce4f 100644 --- a/third_party/llvm-project/libcxx/include/__format/parser_std_format_spec.h +++ b/third_party/llvm-project/libcxx/include/__format/parser_std_format_spec.h
@@ -28,11 +28,13 @@ #include <__format/format_parse_context.h> #include <__format/format_string.h> #include <__format/unicode.h> +#include <__iterator/concepts.h> +#include <__iterator/readable_traits.h> // iter_value_t +#include <__type_traits/common_type.h> +#include <__type_traits/is_trivially_copyable.h> #include <__variant/monostate.h> -#include <bit> #include <cstdint> #include <string_view> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -43,13 +45,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace __format_spec { -template <class _CharT> -_LIBCPP_HIDE_FROM_ABI constexpr __format::__parse_number_result< _CharT> -__parse_arg_id(const _CharT* __begin, const _CharT* __end, auto& __parse_ctx) { +template <contiguous_iterator _Iterator> +_LIBCPP_HIDE_FROM_ABI constexpr __format::__parse_number_result<_Iterator> +__parse_arg_id(_Iterator __begin, _Iterator __end, auto& __parse_ctx) { + using _CharT = iter_value_t<_Iterator>; // This function is a wrapper to call the real parser. But it does the // validation for the pre-conditions and post-conditions. if (__begin == __end) @@ -57,10 +60,10 @@ __format::__parse_number_result __r = __format::__parse_arg_id(__begin, __end, __parse_ctx); - if (__r.__ptr == __end || *__r.__ptr != _CharT('}')) + if (__r.__last == __end || *__r.__last != _CharT('}')) std::__throw_format_error("Invalid arg-id"); - ++__r.__ptr; + ++__r.__last; return __r; } @@ -78,22 +81,33 @@ return _VSTD::__visit_format_arg( [](auto __arg) -> uint32_t { using _Type = decltype(__arg); - if constexpr (integral<_Type>) { + if constexpr (same_as<_Type, monostate>) + std::__throw_format_error("Argument index out of bounds"); + + // [format.string.std]/8 + // If { arg-idopt } is used in a width or precision, the value of the + // corresponding formatting argument is used in its place. If the + // corresponding formatting argument is not of standard signed or unsigned + // integer type, or its value is negative for precision or non-positive for + // width, an exception of type format_error is thrown. + // + // When an integral is used in a format function, it is stored as one of + // the types checked below. Other integral types are promoted. For example, + // a signed char is stored as an int. + if constexpr (same_as<_Type, int> || same_as<_Type, unsigned int> || // + same_as<_Type, long long> || same_as<_Type, unsigned long long>) { if constexpr (signed_integral<_Type>) { if (__arg < 0) std::__throw_format_error("A format-spec arg-id replacement shouldn't have a negative value"); } using _CT = common_type_t<_Type, decltype(__format::__number_max)>; - if (static_cast<_CT>(__arg) > - static_cast<_CT>(__format::__number_max)) + if (static_cast<_CT>(__arg) > static_cast<_CT>(__format::__number_max)) std::__throw_format_error("A format-spec arg-id replacement exceeds the maximum supported value"); return __arg; - } else if constexpr (same_as<_Type, monostate>) - std::__throw_format_error("Argument index out of bounds"); - else - std::__throw_format_error("A format-spec arg-id replacement argument isn't an integral type"); + } else + std::__throw_format_error("Replacement argument isn't a standard signed or unsigned integer type"); }, __format_arg); } @@ -116,7 +130,7 @@ // formatters use the colon to mark the beginning of the // underlying-format-spec. To avoid parsing ambiguities these formatter // specializations prohibit the use of the colon as a fill character. - uint8_t __allow_colon_in_fill_ : 1 {false}; + uint8_t __use_range_fill_ : 1 {false}; }; // By not placing this constant in the formatter class it's not duplicated for @@ -137,9 +151,10 @@ inline constexpr __fields __fields_string{.__precision_ = true, .__type_ = true}; inline constexpr __fields __fields_pointer{.__type_ = true}; -# if _LIBCPP_STD_VER > 20 -inline constexpr __fields __fields_tuple{.__type_ = false, .__allow_colon_in_fill_ = true}; -inline constexpr __fields __fields_range{.__type_ = false, .__allow_colon_in_fill_ = true}; +# if _LIBCPP_STD_VER >= 23 +inline constexpr __fields __fields_tuple{.__use_range_fill_ = true}; +inline constexpr __fields __fields_range{.__use_range_fill_ = true}; +inline constexpr __fields __fields_fill_align_width{}; # endif enum class _LIBCPP_ENUM_VIS __alignment : uint8_t { @@ -196,6 +211,7 @@ struct __chrono { __alignment __alignment_ : 3; bool __locale_specific_form_ : 1; + bool __hour_ : 1; bool __weekday_name_ : 1; bool __weekday_ : 1; bool __day_of_year_ : 1; @@ -268,12 +284,12 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto __parse(basic_format_parse_context<_CharT>& __parse_ctx, __fields __fields) -> decltype(__parse_ctx.begin()) { - const _CharT* __begin = __parse_ctx.begin(); - const _CharT* __end = __parse_ctx.end(); + auto __begin = __parse_ctx.begin(); + auto __end = __parse_ctx.end(); if (__begin == __end) return __begin; - if (__parse_fill_align(__begin, __end, __fields.__allow_colon_in_fill_) && __begin == __end) + if (__parse_fill_align(__begin, __end, __fields.__use_range_fill_) && __begin == __end) return __begin; if (__fields.__sign_ && __parse_sign(__begin) && __begin == __end) @@ -326,6 +342,7 @@ .__chrono_ = __chrono{.__alignment_ = __alignment_, .__locale_specific_form_ = __locale_specific_form_, + .__hour_ = __hour_, .__weekday_name_ = __weekday_name_, .__weekday_ = __weekday_, .__day_of_year_ = __day_of_year_, @@ -345,6 +362,8 @@ // These flags are only used for formatting chrono. Since the struct has // padding space left it's added to this structure. + bool __hour_ : 1 {false}; + bool __weekday_name_ : 1 {false}; bool __weekday_ : 1 {false}; @@ -353,7 +372,7 @@ bool __month_name_ : 1 {false}; - uint8_t __reserved_1_ : 3 {0}; + uint8_t __reserved_1_ : 2 {0}; uint8_t __reserved_2_ : 6 {0}; // These two flags are only used internally and not part of the // __parsed_specifications. Therefore put them at the end. @@ -391,8 +410,8 @@ } // range-fill and tuple-fill are identical - _LIBCPP_HIDE_FROM_ABI constexpr bool - __parse_fill_align(const _CharT*& __begin, const _CharT* __end, bool __use_range_fill) { + template <contiguous_iterator _Iterator> + _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_fill_align(_Iterator& __begin, _Iterator __end, bool __use_range_fill) { _LIBCPP_ASSERT(__begin != __end, "when called with an empty input the function will cause " "undefined behavior by evaluating data not in the input"); if (__begin + 1 != __end) { @@ -415,7 +434,8 @@ return true; } - _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_sign(const _CharT*& __begin) { + template <contiguous_iterator _Iterator> + _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_sign(_Iterator& __begin) { switch (*__begin) { case _CharT('-'): __sign_ = __sign::__minus; @@ -433,7 +453,8 @@ return true; } - _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_alternate_form(const _CharT*& __begin) { + template <contiguous_iterator _Iterator> + _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_alternate_form(_Iterator& __begin) { if (*__begin != _CharT('#')) return false; @@ -442,7 +463,8 @@ return true; } - _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_zero_padding(const _CharT*& __begin) { + template <contiguous_iterator _Iterator> + _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_zero_padding(_Iterator& __begin) { if (*__begin != _CharT('0')) return false; @@ -452,7 +474,8 @@ return true; } - _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_width(const _CharT*& __begin, const _CharT* __end, auto& __parse_ctx) { + template <contiguous_iterator _Iterator> + _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_width(_Iterator& __begin, _Iterator __end, auto& __parse_ctx) { if (*__begin == _CharT('0')) std::__throw_format_error("A format-spec width field shouldn't have a leading zero"); @@ -460,7 +483,7 @@ __format::__parse_number_result __r = __format_spec::__parse_arg_id(++__begin, __end, __parse_ctx); __width_as_arg_ = true; __width_ = __r.__value; - __begin = __r.__ptr; + __begin = __r.__last; return true; } @@ -471,12 +494,12 @@ __width_ = __r.__value; _LIBCPP_ASSERT(__width_ != 0, "A zero value isn't allowed and should be impossible, " "due to validations in this function"); - __begin = __r.__ptr; + __begin = __r.__last; return true; } - _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_precision(const _CharT*& __begin, const _CharT* __end, - auto& __parse_ctx) { + template <contiguous_iterator _Iterator> + _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_precision(_Iterator& __begin, _Iterator __end, auto& __parse_ctx) { if (*__begin != _CharT('.')) return false; @@ -488,7 +511,7 @@ __format::__parse_number_result __arg_id = __format_spec::__parse_arg_id(++__begin, __end, __parse_ctx); __precision_as_arg_ = true; __precision_ = __arg_id.__value; - __begin = __arg_id.__ptr; + __begin = __arg_id.__last; return true; } @@ -498,11 +521,12 @@ __format::__parse_number_result __r = __format::__parse_number(__begin, __end); __precision_ = __r.__value; __precision_as_arg_ = false; - __begin = __r.__ptr; + __begin = __r.__last; return true; } - _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_locale_specific_form(const _CharT*& __begin) { + template <contiguous_iterator _Iterator> + _LIBCPP_HIDE_FROM_ABI constexpr bool __parse_locale_specific_form(_Iterator& __begin) { if (*__begin != _CharT('L')) return false; @@ -511,7 +535,8 @@ return true; } - _LIBCPP_HIDE_FROM_ABI constexpr void __parse_type(const _CharT*& __begin) { + template <contiguous_iterator _Iterator> + _LIBCPP_HIDE_FROM_ABI constexpr void __parse_type(_Iterator& __begin) { // Determines the type. It does not validate whether the selected type is // valid. Most formatters have optional fields that are only allowed for // certain types. These parsers need to do validation after the type has @@ -569,7 +594,7 @@ case 'x': __type_ = __type::__hexadecimal_lower_case; break; -# if _LIBCPP_STD_VER > 20 +# if _LIBCPP_STD_VER >= 23 case '?': __type_ = __type::__debug; break; @@ -734,18 +759,18 @@ } } -template <class _CharT> +template <contiguous_iterator _Iterator> struct __column_width_result { /// The number of output columns. size_t __width_; /// One beyond the last code unit used in the estimation. /// /// This limits the original output to fit in the wanted number of columns. - const _CharT* __last_; + _Iterator __last_; }; -template <class _CharT> -__column_width_result(size_t, const _CharT*) -> __column_width_result<_CharT>; +template <contiguous_iterator _Iterator> +__column_width_result(size_t, _Iterator) -> __column_width_result<_Iterator>; /// Since a column width can be two it's possible that the requested column /// width can't be achieved. Depending on the intended usage the policy can be @@ -812,12 +837,13 @@ return __detail::__column_width_4(__c); } -template <class _CharT> -_LIBCPP_HIDE_FROM_ABI constexpr __column_width_result<_CharT> __estimate_column_width_grapheme_clustering( - const _CharT* __first, const _CharT* __last, size_t __maximum, __column_width_rounding __rounding) noexcept { +template <contiguous_iterator _Iterator> +_LIBCPP_HIDE_FROM_ABI constexpr __column_width_result<_Iterator> __estimate_column_width_grapheme_clustering( + _Iterator __first, _Iterator __last, size_t __maximum, __column_width_rounding __rounding) noexcept { + using _CharT = iter_value_t<_Iterator>; __unicode::__extended_grapheme_cluster_view<_CharT> __view{__first, __last}; - __column_width_result<_CharT> __result{0, __first}; + __column_width_result<_Iterator> __result{0, __first}; while (__result.__last_ != __last && __result.__width_ <= __maximum) { typename __unicode::__extended_grapheme_cluster_view<_CharT>::__cluster __cluster = __view.__consume(); int __width = __detail::__column_width(__cluster.__code_point_); @@ -884,8 +910,8 @@ /// \param __rounding Selects the rounding method. /// \c __down result.__width_ <= __maximum /// \c __up result.__width_ <= __maximum + 1 -template <class _CharT> -_LIBCPP_HIDE_FROM_ABI constexpr __column_width_result<_CharT> __estimate_column_width( +template <class _CharT, class _Iterator = typename basic_string_view<_CharT>::const_iterator> +_LIBCPP_HIDE_FROM_ABI constexpr __column_width_result<_Iterator> __estimate_column_width( basic_string_view<_CharT> __str, size_t __maximum, __column_width_rounding __rounding) noexcept { // The width estimation is done in two steps: // - Quickly process for the ASCII part. ASCII has the following properties @@ -904,7 +930,7 @@ // need to scan one code unit beyond the requested precision. When this code // unit is non-ASCII we omit the current code unit and let the Grapheme // clustering algorithm do its work. - const _CharT* __it = __str.begin(); + auto __it = __str.begin(); if (__format_spec::__is_ascii(*__it)) { do { --__maximum; @@ -932,7 +958,7 @@ } # else // !defined(_LIBCPP_HAS_NO_UNICODE) template <class _CharT> -_LIBCPP_HIDE_FROM_ABI constexpr __column_width_result<_CharT> +_LIBCPP_HIDE_FROM_ABI constexpr __column_width_result<typename basic_string_view<_CharT>::const_iterator> __estimate_column_width(basic_string_view<_CharT> __str, size_t __maximum, __column_width_rounding) noexcept { // When Unicode isn't supported assume ASCII and every code unit is one code // point. In ASCII the estimated column width is always one. Thus there's no @@ -945,7 +971,7 @@ } // namespace __format_spec -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/range_default_formatter.h b/third_party/llvm-project/libcxx/include/__format/range_default_formatter.h index 774887b..3954f98 100644 --- a/third_party/llvm-project/libcxx/include/__format/range_default_formatter.h +++ b/third_party/llvm-project/libcxx/include/__format/range_default_formatter.h
@@ -14,6 +14,7 @@ # pragma GCC system_header #endif +#include <__algorithm/ranges_copy.h> #include <__availability> #include <__chrono/statically_widen.h> #include <__concepts/same_as.h> @@ -21,7 +22,10 @@ #include <__format/concepts.h> #include <__format/formatter.h> #include <__format/range_formatter.h> +#include <__iterator/back_insert_iterator.h> #include <__ranges/concepts.h> +#include <__ranges/data.h> +#include <__ranges/size.h> #include <__type_traits/remove_cvref.h> #include <__utility/pair.h> #include <string_view> @@ -29,7 +33,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <class _Rp, class _CharT> concept __const_formattable_range = @@ -83,40 +87,23 @@ return range_format::sequence; }(); -// This is a non-standard work-around to fix instantiation of -// formatter<const _CharT[N], _CharT> -// const _CharT[N] satisfies the ranges::input_range concept. -// remove_cvref_t<const _CharT[N]> is _CharT[N] so it does not satisfy the -// requirement of the above specialization. Instead it will instantiate the -// primary template, which is ill-formed. -// -// An alternative solution is to remove the offending formatter. -// -// https://godbolt.org/z/bqjhhaexx -// -// The removal is proposed in LWG3833, but use the work-around until the issue -// has been adopted. -// TODO FMT Implement LWG3833. -template <class _CharT, size_t N> -inline constexpr range_format format_kind<const _CharT[N]> = range_format::disabled; - template <range_format _Kp, ranges::input_range _Rp, class _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __range_default_formatter; +struct _LIBCPP_TEMPLATE_VIS __range_default_formatter; // Required specializations template <ranges::input_range _Rp, class _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __range_default_formatter<range_format::sequence, _Rp, _CharT> { +struct _LIBCPP_TEMPLATE_VIS __range_default_formatter<range_format::sequence, _Rp, _CharT> { private: using __maybe_const_r = __fmt_maybe_const<_Rp, _CharT>; range_formatter<remove_cvref_t<ranges::range_reference_t<__maybe_const_r>>, _CharT> __underlying_; public: - _LIBCPP_HIDE_FROM_ABI constexpr void set_separator(basic_string_view<_CharT> __separator) { + _LIBCPP_HIDE_FROM_ABI constexpr void set_separator(basic_string_view<_CharT> __separator) noexcept { __underlying_.set_separator(__separator); } _LIBCPP_HIDE_FROM_ABI constexpr void - set_brackets(basic_string_view<_CharT> __opening_bracket, basic_string_view<_CharT> __closing_bracket) { + set_brackets(basic_string_view<_CharT> __opening_bracket, basic_string_view<_CharT> __closing_bracket) noexcept { __underlying_.set_brackets(__opening_bracket, __closing_bracket); } @@ -132,7 +119,7 @@ }; template <ranges::input_range _Rp, class _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __range_default_formatter<range_format::map, _Rp, _CharT> { +struct _LIBCPP_TEMPLATE_VIS __range_default_formatter<range_format::map, _Rp, _CharT> { private: using __maybe_const_map = __fmt_maybe_const<_Rp, _CharT>; using __element_type = remove_cvref_t<ranges::range_reference_t<__maybe_const_map>>; @@ -160,7 +147,7 @@ }; template <ranges::input_range _Rp, class _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __range_default_formatter<range_format::set, _Rp, _CharT> { +struct _LIBCPP_TEMPLATE_VIS __range_default_formatter<range_format::set, _Rp, _CharT> { private: using __maybe_const_set = __fmt_maybe_const<_Rp, _CharT>; using __element_type = remove_cvref_t<ranges::range_reference_t<__maybe_const_set>>; @@ -185,16 +172,48 @@ template <range_format _Kp, ranges::input_range _Rp, class _CharT> requires(_Kp == range_format::string || _Kp == range_format::debug_string) -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT __range_default_formatter<_Kp, _Rp, _CharT> { - __range_default_formatter() = delete; // TODO FMT Implement +struct _LIBCPP_TEMPLATE_VIS __range_default_formatter<_Kp, _Rp, _CharT> { +private: + // This deviates from the Standard, there the exposition only type is + // formatter<basic_string<charT>, charT> underlying_; + // Using a string_view allows the format function to avoid a copy of the + // input range when it is a contigious range. + formatter<basic_string_view<_CharT>, _CharT> __underlying_; + +public: + template <class _ParseContext> + _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __ctx) { + typename _ParseContext::iterator __i = __underlying_.parse(__ctx); + if constexpr (_Kp == range_format::debug_string) + __underlying_.set_debug_format(); + return __i; + } + + template <class _FormatContext> + _LIBCPP_HIDE_FROM_ABI typename _FormatContext::iterator + format(conditional_t<ranges::input_range<const _Rp>, const _Rp&, _Rp&> __range, _FormatContext& __ctx) const { + // When the range is contiguous use a basic_string_view instead to avoid a + // copy of the underlying data. The basic_string_view formatter + // specialization is the "basic" string formatter in libc++. + if constexpr (ranges::contiguous_range<_Rp> && std::ranges::sized_range<_Rp>) + return __underlying_.format(basic_string_view<_CharT>{ranges::data(__range), ranges::size(__range)}, __ctx); + else { + // P2106's from_range has not been implemented yet. Instead use a simple + // copy operation. + // TODO FMT use basic_string's "from_range" constructor. + // return __underlying_.format(basic_string<_CharT>{from_range, __range}, __ctx); + basic_string<_CharT> __str; + std::ranges::copy(__range, back_insert_iterator{__str}); + return __underlying_.format(static_cast<basic_string_view<_CharT>>(__str), __ctx); + } + } }; template <ranges::input_range _Rp, class _CharT> requires(format_kind<_Rp> != range_format::disabled && formattable<ranges::range_reference_t<_Rp>, _CharT>) -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<_Rp, _CharT> - : __range_default_formatter<format_kind<_Rp>, _Rp, _CharT> {}; +struct _LIBCPP_TEMPLATE_VIS formatter<_Rp, _CharT> : __range_default_formatter<format_kind<_Rp>, _Rp, _CharT> {}; -#endif //_LIBCPP_STD_VER > 20 +#endif //_LIBCPP_STD_VER >= 23 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/range_formatter.h b/third_party/llvm-project/libcxx/include/__format/range_formatter.h index 9ea61a7..0af233e 100644 --- a/third_party/llvm-project/libcxx/include/__format/range_formatter.h +++ b/third_party/llvm-project/libcxx/include/__format/range_formatter.h
@@ -36,49 +36,78 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <class _Tp, class _CharT = char> requires same_as<remove_cvref_t<_Tp>, _Tp> && formattable<_Tp, _CharT> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT range_formatter { - _LIBCPP_HIDE_FROM_ABI constexpr void set_separator(basic_string_view<_CharT> __separator) { +struct _LIBCPP_TEMPLATE_VIS range_formatter { + _LIBCPP_HIDE_FROM_ABI constexpr void set_separator(basic_string_view<_CharT> __separator) noexcept { __separator_ = __separator; } _LIBCPP_HIDE_FROM_ABI constexpr void - set_brackets(basic_string_view<_CharT> __opening_bracket, basic_string_view<_CharT> __closing_bracket) { + set_brackets(basic_string_view<_CharT> __opening_bracket, basic_string_view<_CharT> __closing_bracket) noexcept { __opening_bracket_ = __opening_bracket; __closing_bracket_ = __closing_bracket; } - _LIBCPP_HIDE_FROM_ABI constexpr formatter<_Tp, _CharT>& underlying() { return __underlying_; } - _LIBCPP_HIDE_FROM_ABI constexpr const formatter<_Tp, _CharT>& underlying() const { return __underlying_; } + _LIBCPP_HIDE_FROM_ABI constexpr formatter<_Tp, _CharT>& underlying() noexcept { return __underlying_; } + _LIBCPP_HIDE_FROM_ABI constexpr const formatter<_Tp, _CharT>& underlying() const noexcept { return __underlying_; } template <class _ParseContext> _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator parse(_ParseContext& __parse_ctx) { - const _CharT* __begin = __parser_.__parse(__parse_ctx, __format_spec::__fields_range); - const _CharT* __end = __parse_ctx.end(); - if (__begin == __end) - return __begin; + auto __begin = __parser_.__parse(__parse_ctx, __format_spec::__fields_range); + auto __end = __parse_ctx.end(); + // Note the cases where __begin == __end in this code only happens when the + // replacement-field has no terminating }, or when the parse is manually + // called with a format-spec. The former is an error and the latter means + // using a formatter without the format functions or print. + if (__begin == __end) [[unlikely]] + return __parse_empty_range_underlying_spec(__parse_ctx, __begin); // The n field overrides a possible m type, therefore delay applying the // effect of n until the type has been procesed. bool __clear_brackets = (*__begin == _CharT('n')); if (__clear_brackets) { ++__begin; - if (__begin == __end) { + if (__begin == __end) [[unlikely]] { // Since there is no more data, clear the brackets before returning. set_brackets({}, {}); - return __begin; + return __parse_empty_range_underlying_spec(__parse_ctx, __begin); } } __parse_type(__begin, __end); if (__clear_brackets) set_brackets({}, {}); - if (__begin == __end) - return __begin; + if (__begin == __end) [[unlikely]] + return __parse_empty_range_underlying_spec(__parse_ctx, __begin); bool __has_range_underlying_spec = *__begin == _CharT(':'); + if (__has_range_underlying_spec) { + // range-underlying-spec: + // : format-spec + ++__begin; + } else if (__begin != __end && *__begin != _CharT('}')) + // When there is no underlaying range the current parse should have + // consumed the format-spec. If not, the not consumed input will be + // processed by the underlying. For example {:-} for a range in invalid, + // the sign field is not present. Without this check the underlying_ will + // get -} as input which my be valid. + std::__throw_format_error("The format-spec should consume the input or end with a '}'"); + + __parse_ctx.advance_to(__begin); + __begin = __underlying_.parse(__parse_ctx); + + // This test should not be required if __has_range_underlying_spec is false. + // However this test makes sure the underlying formatter left the parser in + // a valid state. (Note this is not a full protection against evil parsers. + // For example + // } this is test for the next argument {} + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ + // could consume more than it should. + if (__begin != __end && *__begin != _CharT('}')) + std::__throw_format_error("The format-spec should consume the input or end with a '}'"); + if (__parser_.__type_ != __format_spec::__type::__default) { // [format.range.formatter]/6 // If the range-type is s or ?s, then there shall be no n option and no @@ -96,20 +125,6 @@ } else if (!__has_range_underlying_spec) std::__set_debug_format(__underlying_); - if (__has_range_underlying_spec) { - // range-underlying-spec: - // : format-spec - ++__begin; - if (__begin == __end) - return __begin; - - __parse_ctx.advance_to(__begin); - __begin = __underlying_.parse(__parse_ctx); - } - - if (__begin != __end && *__begin != _CharT('}')) - std::__throw_format_error("The format-spec should consume the input or end with a '}'"); - return __begin; } @@ -211,7 +226,8 @@ __format_spec::__parser<_CharT> __parser_{.__alignment_ = __format_spec::__alignment::__left}; private: - _LIBCPP_HIDE_FROM_ABI constexpr void __parse_type(const _CharT*& __begin, const _CharT* __end) { + template <contiguous_iterator _Iterator> + _LIBCPP_HIDE_FROM_ABI constexpr void __parse_type(_Iterator& __begin, _Iterator __end) { switch (*__begin) { case _CharT('m'): if constexpr (__fmt_pair_like<_Tp>) { @@ -242,13 +258,23 @@ } } + template <class _ParseContext> + _LIBCPP_HIDE_FROM_ABI constexpr typename _ParseContext::iterator + __parse_empty_range_underlying_spec(_ParseContext& __parse_ctx, typename _ParseContext::iterator __begin) { + __parse_ctx.advance_to(__begin); + [[maybe_unused]] typename _ParseContext::iterator __result = __underlying_.parse(__parse_ctx); + _LIBCPP_ASSERT(__result == __begin, + "the underlying's parse function should not advance the input beyond the end of the input"); + return __begin; + } + formatter<_Tp, _CharT> __underlying_; basic_string_view<_CharT> __separator_ = _LIBCPP_STATICALLY_WIDEN(_CharT, ", "); basic_string_view<_CharT> __opening_bracket_ = _LIBCPP_STATICALLY_WIDEN(_CharT, "["); basic_string_view<_CharT> __closing_bracket_ = _LIBCPP_STATICALLY_WIDEN(_CharT, "]"); }; -#endif //_LIBCPP_STD_VER > 20 +#endif //_LIBCPP_STD_VER >= 23 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__format/unicode.h b/third_party/llvm-project/libcxx/include/__format/unicode.h index 4327258..12aed50 100644 --- a/third_party/llvm-project/libcxx/include/__format/unicode.h +++ b/third_party/llvm-project/libcxx/include/__format/unicode.h
@@ -11,11 +11,15 @@ #define _LIBCPP___FORMAT_UNICODE_H #include <__assert> +#include <__bit/countl.h> +#include <__concepts/same_as.h> #include <__config> #include <__format/extended_grapheme_cluster_table.h> +#include <__iterator/concepts.h> +#include <__iterator/readable_traits.h> // iter_value_t #include <__type_traits/make_unsigned.h> #include <__utility/unreachable.h> -#include <bit> +#include <string_view> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -23,27 +27,32 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace __unicode { -# if _LIBCPP_STD_VER > 20 +// Helper struct for the result of a consume operation. +// +// The status value for a correct code point is 0. This allows a valid value to +// be used without masking. +// When the decoding fails it know the number of code units affected. For the +// current use-cases that value is not needed, therefore it is not stored. +// The escape routine needs the number of code units for both a valid and +// invalid character and keeps track of it itself. Doing it in this result +// unconditionally would give some overhead when the value is unneeded. +struct __consume_result { + // When __status == __ok it contains the decoded code point. + // Else it contains the replacement character U+FFFD + char32_t __code_point : 31; -/// The result of consuming a code point using P2286' semantics -/// -/// TODO FMT Combine __consume and __consume_p2286 in one function. -struct __consume_p2286_result { - // A size of 0 means well formed. This to differenciate between - // a valid code point and a code unit that's invalid like 0b11111xxx. - int __ill_formed_size; - - // If well formed the consumed code point. - // Otherwise the ill-formed code units as unsigned 8-bit values. They are - // stored in reverse order, to make it easier to extract the values. - char32_t __value; + enum : char32_t { + // Consumed a well-formed code point. + __ok = 0, + // Encountered invalid UTF-8 + __error = 1 + } __status : 1 {__ok}; }; - -# endif // _LIBCPP_STD_VER > 20 +static_assert(sizeof(__consume_result) == sizeof(char32_t)); # ifndef _LIBCPP_HAS_NO_UNICODE @@ -62,7 +71,39 @@ inline constexpr char32_t __replacement_character = U'\ufffd'; -_LIBCPP_HIDE_FROM_ABI constexpr bool __is_continuation(const char* __char, int __count) { +// The error of a consume operation. +// +// This sets the code point to the replacement character. This code point does +// not participate in the grapheme clustering, so grapheme clustering code can +// ignore the error status and always use the code point. +inline constexpr __consume_result __consume_result_error{__replacement_character, __consume_result::__error}; + +[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool __is_high_surrogate(char32_t __value) { + return __value >= 0xd800 && __value <= 0xdbff; +} + +[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool __is_low_surrogate(char32_t __value) { + return __value >= 0xdc00 && __value <= 0xdfff; +} + +// https://www.unicode.org/glossary/#surrogate_code_point +[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool __is_surrogate(char32_t __value) { + return __value >= 0xd800 && __value <= 0xdfff; +} + +// https://www.unicode.org/glossary/#code_point +[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool __is_code_point(char32_t __value) { + return __value <= 0x10ffff; +} + +// https://www.unicode.org/glossary/#unicode_scalar_value +[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool __is_scalar_value(char32_t __value) { + return __unicode::__is_code_point(__value) && !__unicode::__is_surrogate(__value); +} + +template <contiguous_iterator _Iterator> + requires same_as<iter_value_t<_Iterator>, char> +_LIBCPP_HIDE_FROM_ABI constexpr bool __is_continuation(_Iterator __char, int __count) { do { if ((*__char & 0b1000'0000) != 0b1000'0000) return false; @@ -82,68 +123,38 @@ /// UTF-8 specialization. template <> class __code_point_view<char> { + using _Iterator = basic_string_view<char>::const_iterator; + public: - _LIBCPP_HIDE_FROM_ABI constexpr explicit __code_point_view(const char* __first, const char* __last) + _LIBCPP_HIDE_FROM_ABI constexpr explicit __code_point_view(_Iterator __first, _Iterator __last) : __first_(__first), __last_(__last) {} _LIBCPP_HIDE_FROM_ABI constexpr bool __at_end() const noexcept { return __first_ == __last_; } - _LIBCPP_HIDE_FROM_ABI constexpr const char* __position() const noexcept { return __first_; } + _LIBCPP_HIDE_FROM_ABI constexpr _Iterator __position() const noexcept { return __first_; } - _LIBCPP_HIDE_FROM_ABI constexpr char32_t __consume() noexcept { - _LIBCPP_ASSERT(__first_ != __last_, "can't move beyond the end of input"); - - // Based on the number of leading 1 bits the number of code units in the - // code point can be determined. See - // https://en.wikipedia.org/wiki/UTF-8#Encoding - switch (_VSTD::countl_one(static_cast<unsigned char>(*__first_))) { - case 0: - return *__first_++; - - case 2: - if (__last_ - __first_ < 2 || !__unicode::__is_continuation(__first_ + 1, 1)) [[unlikely]] - break; - else { - char32_t __value = static_cast<unsigned char>(*__first_++) & 0x1f; - __value <<= 6; - __value |= static_cast<unsigned char>(*__first_++) & 0x3f; - return __value; - } - - case 3: - if (__last_ - __first_ < 3 || !__unicode::__is_continuation(__first_ + 1, 2)) [[unlikely]] - break; - else { - char32_t __value = static_cast<unsigned char>(*__first_++) & 0x0f; - __value <<= 6; - __value |= static_cast<unsigned char>(*__first_++) & 0x3f; - __value <<= 6; - __value |= static_cast<unsigned char>(*__first_++) & 0x3f; - return __value; - } - - case 4: - if (__last_ - __first_ < 4 || !__unicode::__is_continuation(__first_ + 1, 3)) [[unlikely]] - break; - else { - char32_t __value = static_cast<unsigned char>(*__first_++) & 0x07; - __value <<= 6; - __value |= static_cast<unsigned char>(*__first_++) & 0x3f; - __value <<= 6; - __value |= static_cast<unsigned char>(*__first_++) & 0x3f; - __value <<= 6; - __value |= static_cast<unsigned char>(*__first_++) & 0x3f; - return __value; - } - } - // An invalid number of leading ones can be garbage or a code unit in the - // middle of a code point. By consuming one code unit the parser may get - // "in sync" after a few code units. - ++__first_; - return __replacement_character; - } - -# if _LIBCPP_STD_VER > 20 - _LIBCPP_HIDE_FROM_ABI constexpr __consume_p2286_result __consume_p2286() noexcept { + // https://www.unicode.org/versions/latest/ch03.pdf#G7404 + // Based on Table 3-7, Well-Formed UTF-8 Byte Sequences + // + // Code Points First Byte Second Byte Third Byte Fourth Byte Remarks + // U+0000..U+007F 00..7F U+0000..U+007F 1 code unit range + // C0..C1 80..BF invalid overlong encoding + // U+0080..U+07FF C2..DF 80..BF U+0080..U+07FF 2 code unit range + // E0 80..9F 80..BF invalid overlong encoding + // U+0800..U+0FFF E0 A0..BF 80..BF U+0800..U+FFFF 3 code unit range + // U+1000..U+CFFF E1..EC 80..BF 80..BF + // U+D000..U+D7FF ED 80..9F 80..BF + // U+D800..U+DFFF ED A0..BF 80..BF invalid encoding of surrogate code point + // U+E000..U+FFFF EE..EF 80..BF 80..BF + // F0 80..8F 80..BF 80..BF invalid overlong encoding + // U+10000..U+3FFFF F0 90..BF 80..BF 80..BF U+10000..U+10FFFF 4 code unit range + // U+40000..U+FFFFF F1..F3 80..BF 80..BF 80..BF + // U+100000..U+10FFFF F4 80..8F 80..BF 80..BF + // F4 90..BF 80..BF 80..BF U+110000.. invalid code point range + // + // Unlike other parsers, these invalid entries are tested after decoding. + // - The parser always needs to consume these code units + // - The code is optimized for well-formed UTF-8 + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __consume_result __consume() noexcept { _LIBCPP_ASSERT(__first_ != __last_, "can't move beyond the end of input"); // Based on the number of leading 1 bits the number of code units in the @@ -151,64 +162,77 @@ // https://en.wikipedia.org/wiki/UTF-8#Encoding switch (std::countl_one(static_cast<unsigned char>(*__first_))) { case 0: - return {0, static_cast<unsigned char>(*__first_++)}; + return {static_cast<unsigned char>(*__first_++)}; - case 2: - if (__last_ - __first_ < 2) [[unlikely]] + case 2: { + if (__last_ - __first_ < 2 || !__unicode::__is_continuation(__first_ + 1, 1)) [[unlikely]] break; - if (__unicode::__is_continuation(__first_ + 1, 1)) { - char32_t __value = static_cast<unsigned char>(*__first_++) & 0x1f; - __value <<= 6; - __value |= static_cast<unsigned char>(*__first_++) & 0x3f; - return {0, __value}; - } - break; + char32_t __value = static_cast<unsigned char>(*__first_++) & 0x1f; + __value <<= 6; + __value |= static_cast<unsigned char>(*__first_++) & 0x3f; - case 3: - if (__last_ - __first_ < 3) [[unlikely]] + // These values should be encoded in 1 UTF-8 code unit. + if (__value < 0x0080) [[unlikely]] + return __consume_result_error; + + return {__value}; + } + + case 3: { + if (__last_ - __first_ < 3 || !__unicode::__is_continuation(__first_ + 1, 2)) [[unlikely]] break; - if (__unicode::__is_continuation(__first_ + 1, 2)) { - char32_t __value = static_cast<unsigned char>(*__first_++) & 0x0f; - __value <<= 6; - __value |= static_cast<unsigned char>(*__first_++) & 0x3f; - __value <<= 6; - __value |= static_cast<unsigned char>(*__first_++) & 0x3f; - return {0, __value}; - } - break; + char32_t __value = static_cast<unsigned char>(*__first_++) & 0x0f; + __value <<= 6; + __value |= static_cast<unsigned char>(*__first_++) & 0x3f; + __value <<= 6; + __value |= static_cast<unsigned char>(*__first_++) & 0x3f; - case 4: - if (__last_ - __first_ < 4) [[unlikely]] + // These values should be encoded in 1 or 2 UTF-8 code units. + if (__value < 0x0800) [[unlikely]] + return __consume_result_error; + + // A surrogate value is always encoded in 3 UTF-8 code units. + if (__unicode::__is_surrogate(__value)) [[unlikely]] + return __consume_result_error; + + return {__value}; + } + + case 4: { + if (__last_ - __first_ < 4 || !__unicode::__is_continuation(__first_ + 1, 3)) [[unlikely]] break; - if (__unicode::__is_continuation(__first_ + 1, 3)) { - char32_t __value = static_cast<unsigned char>(*__first_++) & 0x07; - __value <<= 6; - __value |= static_cast<unsigned char>(*__first_++) & 0x3f; - __value <<= 6; - __value |= static_cast<unsigned char>(*__first_++) & 0x3f; - __value <<= 6; - __value |= static_cast<unsigned char>(*__first_++) & 0x3f; + char32_t __value = static_cast<unsigned char>(*__first_++) & 0x07; + __value <<= 6; + __value |= static_cast<unsigned char>(*__first_++) & 0x3f; + __value <<= 6; + __value |= static_cast<unsigned char>(*__first_++) & 0x3f; + __value <<= 6; + __value |= static_cast<unsigned char>(*__first_++) & 0x3f; - if (__value > 0x10FFFF) // Outside the valid Unicode range? - return {4, __value}; + // These values should be encoded in 1, 2, or 3 UTF-8 code units. + if (__value < 0x10000) [[unlikely]] + return __consume_result_error; - return {0, __value}; - } - break; + // A value too large is always encoded in 4 UTF-8 code units. + if (!__unicode::__is_code_point(__value)) [[unlikely]] + return __consume_result_error; + + return {__value}; + } } // An invalid number of leading ones can be garbage or a code unit in the // middle of a code point. By consuming one code unit the parser may get // "in sync" after a few code units. - return {1, static_cast<unsigned char>(*__first_++)}; + ++__first_; + return __consume_result_error; } -# endif // _LIBCPP_STD_VER > 20 private: - const char* __first_; - const char* __last_; + _Iterator __first_; + _Iterator __last_; }; # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS @@ -225,75 +249,48 @@ /// - 4 UTF-32 (for example Linux) template <> class __code_point_view<wchar_t> { + using _Iterator = typename basic_string_view<wchar_t>::const_iterator; + public: static_assert(sizeof(wchar_t) == 2 || sizeof(wchar_t) == 4, "sizeof(wchar_t) has a not implemented value"); - _LIBCPP_HIDE_FROM_ABI constexpr explicit __code_point_view(const wchar_t* __first, const wchar_t* __last) + _LIBCPP_HIDE_FROM_ABI constexpr explicit __code_point_view(_Iterator __first, _Iterator __last) : __first_(__first), __last_(__last) {} - _LIBCPP_HIDE_FROM_ABI constexpr const wchar_t* __position() const noexcept { return __first_; } + _LIBCPP_HIDE_FROM_ABI constexpr _Iterator __position() const noexcept { return __first_; } _LIBCPP_HIDE_FROM_ABI constexpr bool __at_end() const noexcept { return __first_ == __last_; } - _LIBCPP_HIDE_FROM_ABI constexpr char32_t __consume() noexcept { + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __consume_result __consume() noexcept { _LIBCPP_ASSERT(__first_ != __last_, "can't move beyond the end of input"); + char32_t __value = static_cast<char32_t>(*__first_++); if constexpr (sizeof(wchar_t) == 2) { - char32_t __result = *__first_++; - // Is the code unit part of a surrogate pair? See - // https://en.wikipedia.org/wiki/UTF-16#U+D800_to_U+DFFF - if (__result >= 0xd800 && __result <= 0xDfff) { - // Malformed Unicode. - if (__first_ == __last_) [[unlikely]] - return __replacement_character; + if (__unicode::__is_low_surrogate(__value)) [[unlikely]] + return __consume_result_error; - __result -= 0xd800; - __result <<= 10; - __result += *__first_++ - 0xdc00; - __result += 0x10000; + if (__unicode::__is_high_surrogate(__value)) { + if (__first_ == __last_ || !__unicode::__is_low_surrogate(static_cast<char32_t>(*__first_))) [[unlikely]] + return __consume_result_error; + + __value -= 0xd800; + __value <<= 10; + __value += static_cast<char32_t>(*__first_++) - 0xdc00; + __value += 0x10000; + + if (!__unicode::__is_code_point(__value)) [[unlikely]] + return __consume_result_error; } - return __result; - - } else if constexpr (sizeof(wchar_t) == 4) { - char32_t __result = *__first_++; - if (__result > 0x10FFFF) [[unlikely]] - return __replacement_character; - return __result; } else { - __libcpp_unreachable(); - } - } - -# if _LIBCPP_STD_VER > 20 - _LIBCPP_HIDE_FROM_ABI constexpr __consume_p2286_result __consume_p2286() noexcept { - _LIBCPP_ASSERT(__first_ != __last_, "can't move beyond the end of input"); - - char32_t __result = *__first_++; - if constexpr (sizeof(wchar_t) == 2) { - // https://en.wikipedia.org/wiki/UTF-16#U+D800_to_U+DFFF - if (__is_surrogate_pair_high(__result)) { - // Malformed Unicode. - if (__first_ == __last_ || !__is_surrogate_pair_low(*(__first_ + 1))) [[unlikely]] - return {1, __result}; - - __result -= 0xd800; - __result <<= 10; - __result += *__first_++ - 0xdc00; - __result += 0x10000; - } else if (__is_surrogate_pair_low(__result)) - // A code point shouldn't start with the low surrogate pair - return {1, __result}; - } else { - if (__result > 0x10FFFF) [[unlikely]] - return {1, __result}; + if (!__unicode::__is_scalar_value(__value)) [[unlikely]] + return __consume_result_error; } - return {0, __result}; + return {__value}; } -# endif // _LIBCPP_STD_VER > 20 private: - const wchar_t* __first_; - const wchar_t* __last_; + _Iterator __first_; + _Iterator __last_; }; # endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS @@ -384,10 +381,12 @@ /// Therefore only this code point is extracted. template <class _CharT> class __extended_grapheme_cluster_view { + using _Iterator = typename basic_string_view<_CharT>::const_iterator; + public: - _LIBCPP_HIDE_FROM_ABI constexpr explicit __extended_grapheme_cluster_view(const _CharT* __first, const _CharT* __last) + _LIBCPP_HIDE_FROM_ABI constexpr explicit __extended_grapheme_cluster_view(_Iterator __first, _Iterator __last) : __code_point_view_(__first, __last), - __next_code_point_(__code_point_view_.__consume()), + __next_code_point_(__code_point_view_.__consume().__code_point), __next_prop_(__extended_grapheme_custer_property_boundary::__get_property(__next_code_point_)) {} struct __cluster { @@ -401,13 +400,14 @@ /// /// It's expected the caller has the start position and thus can determine /// the code unit range of the extended grapheme cluster. - const _CharT* __last_; + _Iterator __last_; }; _LIBCPP_HIDE_FROM_ABI constexpr __cluster __consume() { _LIBCPP_ASSERT( __next_prop_ != __extended_grapheme_custer_property_boundary::__property::__eot, "can't move beyond the end of input"); + char32_t __code_point = __next_code_point_; if (!__code_point_view_.__at_end()) return {__code_point, __get_break()}; @@ -422,17 +422,17 @@ char32_t __next_code_point_; __extended_grapheme_custer_property_boundary::__property __next_prop_; - _LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __get_break() { + _LIBCPP_HIDE_FROM_ABI constexpr _Iterator __get_break() { bool __ri_break_allowed = true; bool __has_extened_pictographic = false; while (true) { - const _CharT* __result = __code_point_view_.__position(); + _Iterator __result = __code_point_view_.__position(); __extended_grapheme_custer_property_boundary::__property __prev = __next_prop_; if (__code_point_view_.__at_end()) { __next_prop_ = __extended_grapheme_custer_property_boundary::__property::__eot; return __result; } - __next_code_point_ = __code_point_view_.__consume(); + __next_code_point_ = __code_point_view_.__consume().__code_point; __next_prop_ = __extended_grapheme_custer_property_boundary::__get_property(__next_code_point_); __has_extened_pictographic |= @@ -444,8 +444,8 @@ } }; -template <class _CharT> -__extended_grapheme_cluster_view(const _CharT*, const _CharT*) -> __extended_grapheme_cluster_view<_CharT>; +template <contiguous_iterator _Iterator> +__extended_grapheme_cluster_view(_Iterator, _Iterator) -> __extended_grapheme_cluster_view<iter_value_t<_Iterator>>; # else // _LIBCPP_HAS_NO_UNICODE @@ -453,36 +453,30 @@ // This makes it easier to write code agnostic of the _LIBCPP_HAS_NO_UNICODE define. template <class _CharT> class __code_point_view { + using _Iterator = typename basic_string_view<_CharT>::const_iterator; + public: - _LIBCPP_HIDE_FROM_ABI constexpr explicit __code_point_view(const _CharT* __first, const _CharT* __last) + _LIBCPP_HIDE_FROM_ABI constexpr explicit __code_point_view(_Iterator __first, _Iterator __last) : __first_(__first), __last_(__last) {} _LIBCPP_HIDE_FROM_ABI constexpr bool __at_end() const noexcept { return __first_ == __last_; } - _LIBCPP_HIDE_FROM_ABI constexpr const _CharT* __position() const noexcept { return __first_; } + _LIBCPP_HIDE_FROM_ABI constexpr _Iterator __position() const noexcept { return __first_; } - _LIBCPP_HIDE_FROM_ABI constexpr char32_t __consume() noexcept { + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __consume_result __consume() noexcept { _LIBCPP_ASSERT(__first_ != __last_, "can't move beyond the end of input"); - return *__first_++; + return {static_cast<char32_t>(*__first_++)}; } -# if _LIBCPP_STD_VER > 20 - _LIBCPP_HIDE_FROM_ABI constexpr __consume_p2286_result __consume_p2286() noexcept { - _LIBCPP_ASSERT(__first_ != __last_, "can't move beyond the end of input"); - - return {0, std::make_unsigned_t<_CharT>(*__first_++)}; - } -# endif // _LIBCPP_STD_VER > 20 - private: - const _CharT* __first_; - const _CharT* __last_; + _Iterator __first_; + _Iterator __last_; }; # endif // _LIBCPP_HAS_NO_UNICODE } // namespace __unicode -#endif //_LIBCPP_STD_VER > 17 +#endif //_LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__functional/bind.h b/third_party/llvm-project/libcxx/include/__functional/bind.h index 297e4e5..71ca6bd 100644 --- a/third_party/llvm-project/libcxx/include/__functional/bind.h +++ b/third_party/llvm-project/libcxx/include/__functional/bind.h
@@ -15,7 +15,6 @@ #include <__functional/weak_result_type.h> #include <cstddef> #include <tuple> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -30,9 +29,9 @@ is_bind_expression<__remove_cvref_t<_Tp> > > {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> -inline constexpr size_t is_bind_expression_v = is_bind_expression<_Tp>::value; +inline constexpr bool is_bind_expression_v = is_bind_expression<_Tp>::value; #endif template<class _Tp> @@ -42,9 +41,9 @@ is_placeholder<__remove_cvref_t<_Tp> > > {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> -inline constexpr size_t is_placeholder_v = is_placeholder<_Tp>::value; +inline constexpr int is_placeholder_v = is_placeholder<_Tp>::value; #endif namespace placeholders @@ -132,8 +131,8 @@ >::type __mu(_Ti&, _Uj& __uj) { - const size_t _Indx = is_placeholder<_Ti>::value - 1; - return _VSTD::forward<typename tuple_element<_Indx, _Uj>::type>(_VSTD::get<_Indx>(__uj)); + const size_t __indx = is_placeholder<_Ti>::value - 1; + return _VSTD::forward<typename tuple_element<__indx, _Uj>::type>(_VSTD::get<__indx>(__uj)); } template <class _Ti, class _Uj> @@ -264,11 +263,11 @@ } template<class _Fp, class ..._BoundArgs> -class __bind : public __weak_result_type<typename decay<_Fp>::type> +class __bind : public __weak_result_type<__decay_t<_Fp> > { protected: - typedef typename decay<_Fp>::type _Fd; - typedef tuple<typename decay<_BoundArgs>::type...> _Td; + using _Fd = __decay_t<_Fp>; + typedef tuple<__decay_t<_BoundArgs>...> _Td; private: _Fd __f_; _Td __bound_args_;
diff --git a/third_party/llvm-project/libcxx/include/__functional/bind_back.h b/third_party/llvm-project/libcxx/include/__functional/bind_back.h index f0a6e49..544315d 100644 --- a/third_party/llvm-project/libcxx/include/__functional/bind_back.h +++ b/third_party/llvm-project/libcxx/include/__functional/bind_back.h
@@ -16,7 +16,6 @@ #include <__utility/forward.h> #include <__utility/integer_sequence.h> #include <tuple> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -24,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <size_t _NBound, class = make_index_sequence<_NBound>> struct __bind_back_op; @@ -57,7 +56,7 @@ -> decltype( __bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(_VSTD::forward<_Fn>(__f), _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...))) { return __bind_back_t<decay_t<_Fn>, tuple<decay_t<_Args>...>>(_VSTD::forward<_Fn>(__f), _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__functional/bind_front.h b/third_party/llvm-project/libcxx/include/__functional/bind_front.h index 22fb3a6..109a83c 100644 --- a/third_party/llvm-project/libcxx/include/__functional/bind_front.h +++ b/third_party/llvm-project/libcxx/include/__functional/bind_front.h
@@ -14,7 +14,6 @@ #include <__functional/invoke.h> #include <__functional/perfect_forward.h> #include <__utility/forward.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -22,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 struct __bind_front_op { template <class ..._Args> @@ -51,7 +50,7 @@ return __bind_front_t<decay_t<_Fn>, decay_t<_Args>...>(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)...); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__functional/boyer_moore_searcher.h b/third_party/llvm-project/libcxx/include/__functional/boyer_moore_searcher.h index a675089..1e2d861 100644 --- a/third_party/llvm-project/libcxx/include/__functional/boyer_moore_searcher.h +++ b/third_party/llvm-project/libcxx/include/__functional/boyer_moore_searcher.h
@@ -25,7 +25,7 @@ #include <unordered_map> #include <vector> -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_PUSH_MACROS #include <__undef_macros> @@ -310,6 +310,6 @@ _LIBCPP_POP_MACROS -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 #endif // _LIBCPP___FUNCTIONAL_BOYER_MOORE_SEARCHER_H
diff --git a/third_party/llvm-project/libcxx/include/__functional/compose.h b/third_party/llvm-project/libcxx/include/__functional/compose.h index 25213f2..168131e 100644 --- a/third_party/llvm-project/libcxx/include/__functional/compose.h +++ b/third_party/llvm-project/libcxx/include/__functional/compose.h
@@ -14,7 +14,6 @@ #include <__functional/invoke.h> #include <__functional/perfect_forward.h> #include <__utility/forward.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -22,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 struct __compose_op { template<class _Fn1, class _Fn2, class ..._Args> @@ -45,7 +44,7 @@ -> decltype( __compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(_VSTD::forward<_Fn1>(__f1), _VSTD::forward<_Fn2>(__f2))) { return __compose_t<decay_t<_Fn1>, decay_t<_Fn2>>(_VSTD::forward<_Fn1>(__f1), _VSTD::forward<_Fn2>(__f2)); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__functional/default_searcher.h b/third_party/llvm-project/libcxx/include/__functional/default_searcher.h index e4151e5..222b4c6 100644 --- a/third_party/llvm-project/libcxx/include/__functional/default_searcher.h +++ b/third_party/llvm-project/libcxx/include/__functional/default_searcher.h
@@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 // default searcher template<class _ForwardIterator, class _BinaryPredicate = equal_to<>> @@ -50,7 +50,7 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(default_searcher); -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__functional/function.h b/third_party/llvm-project/libcxx/include/__functional/function.h index ca79d33..70ae6d1 100644 --- a/third_party/llvm-project/libcxx/include/__functional/function.h +++ b/third_party/llvm-project/libcxx/include/__functional/function.h
@@ -12,6 +12,7 @@ #include <__assert> #include <__config> +#include <__exception/exception.h> #include <__functional/binary_function.h> #include <__functional/invoke.h> #include <__functional/unary_function.h> @@ -23,15 +24,17 @@ #include <__memory/builtin_new_allocator.h> #include <__memory/compressed_pair.h> #include <__memory/unique_ptr.h> +#include <__type_traits/aligned_storage.h> +#include <__type_traits/is_trivially_copy_constructible.h> +#include <__type_traits/is_trivially_destructible.h> #include <__type_traits/strip_signature.h> #include <__utility/forward.h> #include <__utility/move.h> #include <__utility/piecewise_construct.h> #include <__utility/swap.h> -#include <exception> +#include <__verbose_abort> #include <new> #include <tuple> -#include <type_traits> #include <typeinfo> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -68,10 +71,10 @@ _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY void __throw_bad_function_call() { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw bad_function_call(); #else - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("bad_function_call was thrown in -fno-exceptions mode"); #endif } @@ -268,10 +271,10 @@ virtual void destroy() _NOEXCEPT = 0; virtual void destroy_deallocate() _NOEXCEPT = 0; virtual _Rp operator()(_ArgTypes&& ...) = 0; -#ifndef _LIBCPP_NO_RTTI +#ifndef _LIBCPP_HAS_NO_RTTI virtual const void* target(const type_info&) const _NOEXCEPT = 0; virtual const std::type_info& target_type() const _NOEXCEPT = 0; -#endif // _LIBCPP_NO_RTTI +#endif // _LIBCPP_HAS_NO_RTTI }; // __func implements __base for a given functor type. @@ -305,10 +308,10 @@ virtual void destroy() _NOEXCEPT; virtual void destroy_deallocate() _NOEXCEPT; virtual _Rp operator()(_ArgTypes&&... __arg); -#ifndef _LIBCPP_NO_RTTI +#ifndef _LIBCPP_HAS_NO_RTTI virtual const void* target(const type_info&) const _NOEXCEPT; virtual const std::type_info& target_type() const _NOEXCEPT; -#endif // _LIBCPP_NO_RTTI +#endif // _LIBCPP_HAS_NO_RTTI }; template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes> @@ -356,7 +359,7 @@ return __f_(_VSTD::forward<_ArgTypes>(__arg)...); } -#ifndef _LIBCPP_NO_RTTI +#ifndef _LIBCPP_HAS_NO_RTTI template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes> const void* @@ -374,7 +377,7 @@ return typeid(_Fp); } -#endif // _LIBCPP_NO_RTTI +#endif // _LIBCPP_HAS_NO_RTTI // __value_func creates a value-type from a __func. @@ -427,7 +430,7 @@ } template <class _Fp, - class = typename enable_if<!is_same<typename decay<_Fp>::type, __value_func>::value>::type> + class = typename enable_if<!is_same<__decay_t<_Fp>, __value_func>::value>::type> _LIBCPP_INLINE_VISIBILITY explicit __value_func(_Fp&& __f) : __value_func(_VSTD::forward<_Fp>(__f), allocator<_Fp>()) {} @@ -553,7 +556,7 @@ _LIBCPP_INLINE_VISIBILITY explicit operator bool() const _NOEXCEPT { return __f_ != nullptr; } -#ifndef _LIBCPP_NO_RTTI +#ifndef _LIBCPP_HAS_NO_RTTI _LIBCPP_INLINE_VISIBILITY const std::type_info& target_type() const _NOEXCEPT { @@ -569,7 +572,7 @@ return nullptr; return (const _Tp*)__f_->target(typeid(_Tp)); } -#endif // _LIBCPP_NO_RTTI +#endif // _LIBCPP_HAS_NO_RTTI }; // Storage for a functor object, to be used with __policy to manage copy and @@ -614,15 +617,15 @@ _LIBCPP_INLINE_VISIBILITY static const __policy* __create_empty() { - static const _LIBCPP_CONSTEXPR __policy __policy_ = {nullptr, nullptr, - true, -#ifndef _LIBCPP_NO_RTTI - &typeid(void) + static const _LIBCPP_CONSTEXPR __policy __policy = {nullptr, nullptr, + true, +#ifndef _LIBCPP_HAS_NO_RTTI + &typeid(void) #else - nullptr + nullptr #endif }; - return &__policy_; + return &__policy; } private: @@ -640,30 +643,30 @@ template <typename _Fun> _LIBCPP_INLINE_VISIBILITY static const __policy* __choose_policy(/* is_small = */ false_type) { - static const _LIBCPP_CONSTEXPR __policy __policy_ = { + static const _LIBCPP_CONSTEXPR __policy __policy = { &__large_clone<_Fun>, &__large_destroy<_Fun>, false, -#ifndef _LIBCPP_NO_RTTI +#ifndef _LIBCPP_HAS_NO_RTTI &typeid(typename _Fun::_Target) #else nullptr #endif }; - return &__policy_; + return &__policy; } template <typename _Fun> _LIBCPP_INLINE_VISIBILITY static const __policy* __choose_policy(/* is_small = */ true_type) { - static const _LIBCPP_CONSTEXPR __policy __policy_ = { + static const _LIBCPP_CONSTEXPR __policy __policy = { nullptr, nullptr, false, -#ifndef _LIBCPP_NO_RTTI +#ifndef _LIBCPP_HAS_NO_RTTI &typeid(typename _Fun::_Target) #else nullptr #endif }; - return &__policy_; + return &__policy; } }; @@ -770,7 +773,7 @@ } } - template <class _Fp, class = typename enable_if<!is_same<typename decay<_Fp>::type, __policy_func>::value>::type> + template <class _Fp, class = typename enable_if<!is_same<__decay_t<_Fp>, __policy_func>::value>::type> _LIBCPP_INLINE_VISIBILITY explicit __policy_func(_Fp&& __f) : __policy_(__policy::__create_empty()) { typedef __default_alloc_func<_Fp, _Rp(_ArgTypes...)> _Fun; @@ -861,7 +864,7 @@ return !__policy_->__is_null; } -#ifndef _LIBCPP_NO_RTTI +#ifndef _LIBCPP_HAS_NO_RTTI _LIBCPP_INLINE_VISIBILITY const std::type_info& target_type() const _NOEXCEPT { @@ -878,7 +881,7 @@ else return reinterpret_cast<const _Tp*>(&__buf_.__small); } -#endif // _LIBCPP_NO_RTTI +#endif // _LIBCPP_HAS_NO_RTTI }; #if defined(_LIBCPP_HAS_BLOCKS_RUNTIME) @@ -945,7 +948,7 @@ return _VSTD::__invoke(__f_, _VSTD::forward<_ArgTypes>(__arg)...); } -#ifndef _LIBCPP_NO_RTTI +#ifndef _LIBCPP_HAS_NO_RTTI virtual const void* target(type_info const& __ti) const _NOEXCEPT { if (__ti == typeid(__func::__block_type)) return &__f_; @@ -955,7 +958,7 @@ virtual const std::type_info& target_type() const _NOEXCEPT { return typeid(__func::__block_type); } -#endif // _LIBCPP_NO_RTTI +#endif // _LIBCPP_HAS_NO_RTTI }; #endif // _LIBCPP_HAS_EXTENSION_BLOCKS @@ -1026,7 +1029,7 @@ function& operator=(const function&); function& operator=(function&&) _NOEXCEPT; function& operator=(nullptr_t) _NOEXCEPT; - template<class _Fp, class = _EnableIfLValueCallable<typename decay<_Fp>::type>> + template<class _Fp, class = _EnableIfLValueCallable<__decay_t<_Fp>>> function& operator=(_Fp&&); ~function(); @@ -1056,12 +1059,12 @@ // function invocation: _Rp operator()(_ArgTypes...) const; -#ifndef _LIBCPP_NO_RTTI +#ifndef _LIBCPP_HAS_NO_RTTI // function target access: const std::type_info& target_type() const _NOEXCEPT; template <typename _Tp> _Tp* target() _NOEXCEPT; template <typename _Tp> const _Tp* target() const _NOEXCEPT; -#endif // _LIBCPP_NO_RTTI +#endif // _LIBCPP_HAS_NO_RTTI }; #if _LIBCPP_STD_VER >= 17 @@ -1156,7 +1159,7 @@ return __f_(_VSTD::forward<_ArgTypes>(__arg)...); } -#ifndef _LIBCPP_NO_RTTI +#ifndef _LIBCPP_HAS_NO_RTTI template<class _Rp, class ..._ArgTypes> const std::type_info& @@ -1181,7 +1184,7 @@ return __f_.template target<_Tp>(); } -#endif // _LIBCPP_NO_RTTI +#endif // _LIBCPP_HAS_NO_RTTI template <class _Rp, class... _ArgTypes> inline _LIBCPP_INLINE_VISIBILITY
diff --git a/third_party/llvm-project/libcxx/include/__functional/hash.h b/third_party/llvm-project/libcxx/include/__functional/hash.h index dfd8ea2..fec7f75 100644 --- a/third_party/llvm-project/libcxx/include/__functional/hash.h +++ b/third_party/llvm-project/libcxx/include/__functional/hash.h
@@ -13,7 +13,7 @@ #include <__functional/invoke.h> #include <__functional/unary_function.h> #include <__fwd/hash.h> -#include <__tuple_dir/sfinae_helpers.h> +#include <__tuple/sfinae_helpers.h> #include <__type_traits/is_copy_constructible.h> #include <__type_traits/is_default_constructible.h> #include <__type_traits/is_enum.h> @@ -35,7 +35,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _Size> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI _Size __loadword(const void* __p) { @@ -53,50 +53,88 @@ template <class _Size> struct __murmur2_or_cityhash<_Size, 32> { - inline _Size operator()(const void* __key, _Size __len) - _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK; + _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK + _Size operator()(const void* __key, _Size __len) const { + // murmur2 + const _Size __m = 0x5bd1e995; + const _Size __r = 24; + _Size __h = __len; + const unsigned char* __data = static_cast<const unsigned char*>(__key); + for (; __len >= 4; __data += 4, __len -= 4) + { + _Size __k = std::__loadword<_Size>(__data); + __k *= __m; + __k ^= __k >> __r; + __k *= __m; + __h *= __m; + __h ^= __k; + } + switch (__len) + { + case 3: + __h ^= static_cast<_Size>(__data[2] << 16); + _LIBCPP_FALLTHROUGH(); + case 2: + __h ^= static_cast<_Size>(__data[1] << 8); + _LIBCPP_FALLTHROUGH(); + case 1: + __h ^= __data[0]; + __h *= __m; + } + __h ^= __h >> 13; + __h *= __m; + __h ^= __h >> 15; + return __h; + } }; -// murmur2 -template <class _Size> -_Size -__murmur2_or_cityhash<_Size, 32>::operator()(const void* __key, _Size __len) -{ - const _Size __m = 0x5bd1e995; - const _Size __r = 24; - _Size __h = __len; - const unsigned char* __data = static_cast<const unsigned char*>(__key); - for (; __len >= 4; __data += 4, __len -= 4) - { - _Size __k = std::__loadword<_Size>(__data); - __k *= __m; - __k ^= __k >> __r; - __k *= __m; - __h *= __m; - __h ^= __k; - } - switch (__len) - { - case 3: - __h ^= static_cast<_Size>(__data[2] << 16); - _LIBCPP_FALLTHROUGH(); - case 2: - __h ^= static_cast<_Size>(__data[1] << 8); - _LIBCPP_FALLTHROUGH(); - case 1: - __h ^= __data[0]; - __h *= __m; - } - __h ^= __h >> 13; - __h *= __m; - __h ^= __h >> 15; - return __h; -} - template <class _Size> struct __murmur2_or_cityhash<_Size, 64> { - inline _Size operator()(const void* __key, _Size __len) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK; + // cityhash64 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK + _Size operator()(const void* __key, _Size __len) const { + const char* __s = static_cast<const char*>(__key); + if (__len <= 32) { + if (__len <= 16) { + return __hash_len_0_to_16(__s, __len); + } else { + return __hash_len_17_to_32(__s, __len); + } + } else if (__len <= 64) { + return __hash_len_33_to_64(__s, __len); + } + + // For strings over 64 bytes we hash the end first, and then as we + // loop we keep 56 bytes of state: v, w, x, y, and z. + _Size __x = std::__loadword<_Size>(__s + __len - 40); + _Size __y = std::__loadword<_Size>(__s + __len - 16) + + std::__loadword<_Size>(__s + __len - 56); + _Size __z = __hash_len_16(std::__loadword<_Size>(__s + __len - 48) + __len, + std::__loadword<_Size>(__s + __len - 24)); + pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z); + pair<_Size, _Size> __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x); + __x = __x * __k1 + std::__loadword<_Size>(__s); + + // Decrease len to the nearest multiple of 64, and operate on 64-byte chunks. + __len = (__len - 1) & ~static_cast<_Size>(63); + do { + __x = __rotate(__x + __y + __v.first + std::__loadword<_Size>(__s + 8), 37) * __k1; + __y = __rotate(__y + __v.second + std::__loadword<_Size>(__s + 48), 42) * __k1; + __x ^= __w.second; + __y += __v.first + std::__loadword<_Size>(__s + 40); + __z = __rotate(__z + __w.first, 33) * __k1; + __v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first); + __w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second, + __y + std::__loadword<_Size>(__s + 16)); + _VSTD::swap(__z, __x); + __s += 64; + __len -= 64; + } while (__len != 0); + return __hash_len_16( + __hash_len_16(__v.first, __w.first) + __shift_mix(__y) * __k1 + __z, + __hash_len_16(__v.second, __w.second) + __x); + } private: // Some primes between 2^63 and 2^64. @@ -105,21 +143,23 @@ static const _Size __k2 = 0x9ae16a3b2f90404fULL; static const _Size __k3 = 0xc949d7c7509e6557ULL; + _LIBCPP_HIDE_FROM_ABI static _Size __rotate(_Size __val, int __shift) { return __shift == 0 ? __val : ((__val >> __shift) | (__val << (64 - __shift))); } + _LIBCPP_HIDE_FROM_ABI static _Size __rotate_by_at_least_1(_Size __val, int __shift) { return (__val >> __shift) | (__val << (64 - __shift)); } + _LIBCPP_HIDE_FROM_ABI static _Size __shift_mix(_Size __val) { return __val ^ (__val >> 47); } - static _Size __hash_len_16(_Size __u, _Size __v) - _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK - { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK + static _Size __hash_len_16(_Size __u, _Size __v) { const _Size __mul = 0x9ddfea08eb382d69ULL; _Size __a = (__u ^ __v) * __mul; __a ^= (__a >> 47); @@ -129,9 +169,8 @@ return __b; } - static _Size __hash_len_0_to_16(const char* __s, _Size __len) - _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK - { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK + static _Size __hash_len_0_to_16(const char* __s, _Size __len) { if (__len > 8) { const _Size __a = std::__loadword<_Size>(__s); const _Size __b = std::__loadword<_Size>(__s + __len - 8); @@ -140,7 +179,11 @@ if (__len >= 4) { const uint32_t __a = std::__loadword<uint32_t>(__s); const uint32_t __b = std::__loadword<uint32_t>(__s + __len - 4); +#ifdef _LIBCPP_ABI_FIX_CITYHASH_IMPLEMENTATION return __hash_len_16(__len + (static_cast<_Size>(__a) << 3), __b); +#else + return __hash_len_16(__len + (__a << 3), __b); +#endif } if (__len > 0) { const unsigned char __a = static_cast<unsigned char>(__s[0]); @@ -154,9 +197,8 @@ return __k2; } - static _Size __hash_len_17_to_32(const char *__s, _Size __len) - _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK - { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK + static _Size __hash_len_17_to_32(const char *__s, _Size __len) { const _Size __a = std::__loadword<_Size>(__s) * __k1; const _Size __b = std::__loadword<_Size>(__s + 8); const _Size __c = std::__loadword<_Size>(__s + __len - 8) * __k2; @@ -167,9 +209,9 @@ // Return a 16-byte hash for 48 bytes. Quick and dirty. // Callers do best to use "random-looking" values for a and b. + _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static pair<_Size, _Size> __weak_hash_len_32_with_seeds( _Size __w, _Size __x, _Size __y, _Size __z, _Size __a, _Size __b) - _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK { __a += __w; __b = __rotate(__b + __a + __z, 21); @@ -181,9 +223,9 @@ } // Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty. + _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK static pair<_Size, _Size> __weak_hash_len_32_with_seeds( const char* __s, _Size __a, _Size __b) - _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK { return __weak_hash_len_32_with_seeds(std::__loadword<_Size>(__s), std::__loadword<_Size>(__s + 8), @@ -194,9 +236,8 @@ } // Return an 8-byte hash for 33 to 64 bytes. - static _Size __hash_len_33_to_64(const char *__s, size_t __len) - _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK - { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK + static _Size __hash_len_33_to_64(const char *__s, size_t __len) { _Size __z = std::__loadword<_Size>(__s + 24); _Size __a = std::__loadword<_Size>(__s) + (__len + std::__loadword<_Size>(__s + __len - 16)) * __k0; @@ -221,53 +262,6 @@ } }; -// cityhash64 -template <class _Size> -_Size -__murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len) -{ - const char* __s = static_cast<const char*>(__key); - if (__len <= 32) { - if (__len <= 16) { - return __hash_len_0_to_16(__s, __len); - } else { - return __hash_len_17_to_32(__s, __len); - } - } else if (__len <= 64) { - return __hash_len_33_to_64(__s, __len); - } - - // For strings over 64 bytes we hash the end first, and then as we - // loop we keep 56 bytes of state: v, w, x, y, and z. - _Size __x = std::__loadword<_Size>(__s + __len - 40); - _Size __y = std::__loadword<_Size>(__s + __len - 16) + - std::__loadword<_Size>(__s + __len - 56); - _Size __z = __hash_len_16(std::__loadword<_Size>(__s + __len - 48) + __len, - std::__loadword<_Size>(__s + __len - 24)); - pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z); - pair<_Size, _Size> __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x); - __x = __x * __k1 + std::__loadword<_Size>(__s); - - // Decrease len to the nearest multiple of 64, and operate on 64-byte chunks. - __len = (__len - 1) & ~static_cast<_Size>(63); - do { - __x = __rotate(__x + __y + __v.first + std::__loadword<_Size>(__s + 8), 37) * __k1; - __y = __rotate(__y + __v.second + std::__loadword<_Size>(__s + 48), 42) * __k1; - __x ^= __w.second; - __y += __v.first + std::__loadword<_Size>(__s + 40); - __z = __rotate(__z + __w.first, 33) * __k1; - __v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first); - __w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second, - __y + std::__loadword<_Size>(__s + 16)); - _VSTD::swap(__z, __x); - __s += 64; - __len -= 64; - } while (__len != 0); - return __hash_len_16( - __hash_len_16(__v.first, __w.first) + __shift_mix(__y) * __k1 + __z, - __hash_len_16(__v.second, __w.second) + __x); -} - template <class _Tp, size_t = sizeof(_Tp) / sizeof(size_t)> struct __scalar_hash; @@ -275,7 +269,7 @@ struct __scalar_hash<_Tp, 0> : public __unary_function<_Tp, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT { union @@ -293,7 +287,7 @@ struct __scalar_hash<_Tp, 1> : public __unary_function<_Tp, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT { union @@ -310,7 +304,7 @@ struct __scalar_hash<_Tp, 2> : public __unary_function<_Tp, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT { union @@ -331,7 +325,7 @@ struct __scalar_hash<_Tp, 3> : public __unary_function<_Tp, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT { union @@ -353,7 +347,7 @@ struct __scalar_hash<_Tp, 4> : public __unary_function<_Tp, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT { union @@ -377,7 +371,7 @@ size_t second; }; -_LIBCPP_INLINE_VISIBILITY +_LIBCPP_HIDE_FROM_ABI inline size_t __hash_combine(size_t __lhs, size_t __rhs) _NOEXCEPT { typedef __scalar_hash<_PairT> _HashT; const _PairT __p = {__lhs, __rhs}; @@ -388,7 +382,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<_Tp*> : public __unary_function<_Tp*, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp* __v) const _NOEXCEPT { union @@ -405,7 +399,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<bool> : public __unary_function<bool, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(bool __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -413,7 +407,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<char> : public __unary_function<char, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(char __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -421,7 +415,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<signed char> : public __unary_function<signed char, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(signed char __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -429,7 +423,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<unsigned char> : public __unary_function<unsigned char, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned char __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -438,7 +432,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<char8_t> : public __unary_function<char8_t, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(char8_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; #endif // !_LIBCPP_HAS_NO_CHAR8_T @@ -447,7 +441,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<char16_t> : public __unary_function<char16_t, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(char16_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -455,7 +449,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<char32_t> : public __unary_function<char32_t, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(char32_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -464,7 +458,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<wchar_t> : public __unary_function<wchar_t, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(wchar_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; #endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS @@ -473,7 +467,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<short> : public __unary_function<short, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(short __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -481,7 +475,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<unsigned short> : public __unary_function<unsigned short, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned short __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -489,7 +483,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<int> : public __unary_function<int, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(int __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -497,7 +491,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<unsigned int> : public __unary_function<unsigned int, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned int __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -505,7 +499,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<long> : public __unary_function<long, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(long __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -513,7 +507,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<unsigned long> : public __unary_function<unsigned long, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(unsigned long __v) const _NOEXCEPT {return static_cast<size_t>(__v);} }; @@ -549,7 +543,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<float> : public __scalar_hash<float> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(float __v) const _NOEXCEPT { // -0.0 and 0.0 should return same hash @@ -563,7 +557,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<double> : public __scalar_hash<double> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(double __v) const _NOEXCEPT { // -0.0 and 0.0 should return same hash @@ -577,7 +571,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<long double> : public __scalar_hash<long double> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(long double __v) const _NOEXCEPT { // -0.0 and 0.0 should return same hash @@ -627,7 +621,7 @@ struct _LIBCPP_TEMPLATE_VIS __enum_hash : public __unary_function<_Tp, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(_Tp __v) const _NOEXCEPT { typedef typename underlying_type<_Tp>::type type; @@ -646,13 +640,13 @@ { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <> struct _LIBCPP_TEMPLATE_VIS hash<nullptr_t> : public __unary_function<nullptr_t, size_t> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(nullptr_t) const _NOEXCEPT { return 662607004ull; } @@ -673,7 +667,7 @@ is_default_constructible<_Hash>::value >; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Type, class> using __enable_hash_helper_imp _LIBCPP_NODEBUG = _Type;
diff --git a/third_party/llvm-project/libcxx/include/__functional/identity.h b/third_party/llvm-project/libcxx/include/__functional/identity.h index 2fe3acc..421ba2f 100644 --- a/third_party/llvm-project/libcxx/include/__functional/identity.h +++ b/third_party/llvm-project/libcxx/include/__functional/identity.h
@@ -11,6 +11,7 @@ #define _LIBCPP___FUNCTIONAL_IDENTITY_H #include <__config> +#include <__type_traits/integral_constant.h> #include <__utility/forward.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -19,6 +20,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD +template <class _Tp> +struct __is_identity : false_type {}; + struct __identity { template <class _Tp> _LIBCPP_NODISCARD _LIBCPP_CONSTEXPR _Tp&& operator()(_Tp&& __t) const _NOEXCEPT { @@ -28,7 +32,10 @@ using is_transparent = void; }; -#if _LIBCPP_STD_VER > 17 +template <> +struct __is_identity<__identity> : true_type {}; + +#if _LIBCPP_STD_VER >= 20 struct identity { template<class _Tp> @@ -39,7 +46,11 @@ using is_transparent = void; }; -#endif // _LIBCPP_STD_VER > 17 + +template <> +struct __is_identity<identity> : true_type {}; + +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__functional/invoke.h b/third_party/llvm-project/libcxx/include/__functional/invoke.h index 48e6eac..82fd18d 100644 --- a/third_party/llvm-project/libcxx/include/__functional/invoke.h +++ b/third_party/llvm-project/libcxx/include/__functional/invoke.h
@@ -266,8 +266,8 @@ }; template <class _Fp, class _A0, - class _DecayFp = typename decay<_Fp>::type, - class _DecayA0 = typename decay<_A0>::type, + class _DecayFp = __decay_t<_Fp>, + class _DecayA0 = __decay_t<_A0>, class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> using __enable_if_bullet1 = typename enable_if < @@ -276,8 +276,8 @@ >::type; template <class _Fp, class _A0, - class _DecayFp = typename decay<_Fp>::type, - class _DecayA0 = typename decay<_A0>::type> + class _DecayFp = __decay_t<_Fp>, + class _DecayA0 = __decay_t<_A0> > using __enable_if_bullet2 = typename enable_if < is_member_function_pointer<_DecayFp>::value @@ -285,8 +285,8 @@ >::type; template <class _Fp, class _A0, - class _DecayFp = typename decay<_Fp>::type, - class _DecayA0 = typename decay<_A0>::type, + class _DecayFp = __decay_t<_Fp>, + class _DecayA0 = __decay_t<_A0>, class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> using __enable_if_bullet3 = typename enable_if < @@ -296,8 +296,8 @@ >::type; template <class _Fp, class _A0, - class _DecayFp = typename decay<_Fp>::type, - class _DecayA0 = typename decay<_A0>::type, + class _DecayFp = __decay_t<_Fp>, + class _DecayA0 = __decay_t<_A0>, class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> using __enable_if_bullet4 = typename enable_if < @@ -306,8 +306,8 @@ >::type; template <class _Fp, class _A0, - class _DecayFp = typename decay<_Fp>::type, - class _DecayA0 = typename decay<_A0>::type> + class _DecayFp = __decay_t<_Fp>, + class _DecayA0 = __decay_t<_A0> > using __enable_if_bullet5 = typename enable_if < is_member_object_pointer<_DecayFp>::value @@ -315,8 +315,8 @@ >::type; template <class _Fp, class _A0, - class _DecayFp = typename decay<_Fp>::type, - class _DecayA0 = typename decay<_A0>::type, + class _DecayFp = __decay_t<_Fp>, + class _DecayA0 = __decay_t<_A0>, class _ClassT = typename __member_pointer_class_type<_DecayFp>::type> using __enable_if_bullet6 = typename enable_if < @@ -488,7 +488,7 @@ } }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 // is_invocable @@ -539,7 +539,26 @@ return _VSTD::__invoke(_VSTD::forward<_Fn>(__f), _VSTD::forward<_Args>(__args)...); } -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 + +#if _LIBCPP_STD_VER >= 23 +template <class _Result, class _Fn, class... _Args> + requires is_invocable_r_v<_Result, _Fn, _Args...> +_LIBCPP_HIDE_FROM_ABI constexpr _Result +invoke_r(_Fn&& __f, _Args&&... __args) noexcept(is_nothrow_invocable_r_v<_Result, _Fn, _Args...>) { + if constexpr (is_void_v<_Result>) { + static_cast<void>(std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...)); + } else { + // TODO: Use reference_converts_from_temporary_v once implemented + // using _ImplicitInvokeResult = invoke_result_t<_Fn, _Args...>; + // static_assert(!reference_converts_from_temporary_v<_Result, _ImplicitInvokeResult>, + static_assert(true, + "Returning from invoke_r would bind a temporary object to the reference return type, " + "which would result in a dangling reference."); + return std::invoke(std::forward<_Fn>(__f), std::forward<_Args>(__args)...); + } +} +#endif _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__functional/is_transparent.h b/third_party/llvm-project/libcxx/include/__functional/is_transparent.h index c7a0ee9..c539a07 100644 --- a/third_party/llvm-project/libcxx/include/__functional/is_transparent.h +++ b/third_party/llvm-project/libcxx/include/__functional/is_transparent.h
@@ -11,7 +11,8 @@ #define _LIBCPP___FUNCTIONAL_IS_TRANSPARENT #include <__config> -#include <type_traits> +#include <__type_traits/integral_constant.h> +#include <__type_traits/void_t.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -19,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp, class, class = void> struct __is_transparent : false_type {};
diff --git a/third_party/llvm-project/libcxx/include/__functional/mem_fn.h b/third_party/llvm-project/libcxx/include/__functional/mem_fn.h index 8b51627..fe221dd 100644 --- a/third_party/llvm-project/libcxx/include/__functional/mem_fn.h +++ b/third_party/llvm-project/libcxx/include/__functional/mem_fn.h
@@ -15,7 +15,6 @@ #include <__functional/invoke.h> #include <__functional/weak_result_type.h> #include <__utility/forward.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__functional/not_fn.h b/third_party/llvm-project/libcxx/include/__functional/not_fn.h index 79d9a87..f148a40 100644 --- a/third_party/llvm-project/libcxx/include/__functional/not_fn.h +++ b/third_party/llvm-project/libcxx/include/__functional/not_fn.h
@@ -14,7 +14,6 @@ #include <__functional/invoke.h> #include <__functional/perfect_forward.h> #include <__utility/forward.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -22,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 struct __not_fn_op { template <class... _Args> @@ -47,7 +46,7 @@ return __not_fn_t<decay_t<_Fn>>(_VSTD::forward<_Fn>(__f)); } -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__functional/operations.h b/third_party/llvm-project/libcxx/include/__functional/operations.h index 8a781ef..3d0c364 100644 --- a/third_party/llvm-project/libcxx/include/__functional/operations.h +++ b/third_party/llvm-project/libcxx/include/__functional/operations.h
@@ -13,6 +13,8 @@ #include <__config> #include <__functional/binary_function.h> #include <__functional/unary_function.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/predicate_traits.h> #include <__utility/forward.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -23,7 +25,7 @@ // Arithmetic operations -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -38,7 +40,7 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(plus); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS plus<void> { @@ -52,7 +54,7 @@ }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -67,7 +69,7 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(minus); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS minus<void> { @@ -81,7 +83,7 @@ }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -96,7 +98,7 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(multiplies); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS multiplies<void> { @@ -110,7 +112,7 @@ }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -125,7 +127,7 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(divides); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS divides<void> { @@ -139,7 +141,7 @@ }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -154,7 +156,7 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(modulus); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS modulus<void> { @@ -168,7 +170,7 @@ }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -183,7 +185,7 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(negate); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS negate<void> { @@ -199,7 +201,7 @@ // Bitwise operations -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -214,7 +216,7 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_and); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS bit_and<void> { @@ -228,7 +230,7 @@ }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> struct _LIBCPP_TEMPLATE_VIS bit_not : __unary_function<_Tp, _Tp> @@ -252,7 +254,7 @@ }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -267,7 +269,7 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_or); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS bit_or<void> { @@ -281,7 +283,7 @@ }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -296,7 +298,7 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_xor); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS bit_xor<void> { @@ -312,7 +314,7 @@ // Comparison operations -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -327,7 +329,7 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(equal_to); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS equal_to<void> { @@ -341,7 +343,15 @@ }; #endif -#if _LIBCPP_STD_VER > 11 +template <class _Tp> +struct __is_trivial_equality_predicate<equal_to<_Tp>, _Tp, _Tp> : true_type {}; + +#if _LIBCPP_STD_VER >= 14 +template <class _Tp> +struct __is_trivial_equality_predicate<equal_to<>, _Tp, _Tp> : true_type {}; +#endif + +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -356,7 +366,7 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(not_equal_to); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS not_equal_to<void> { @@ -370,7 +380,7 @@ }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -385,7 +395,7 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS less<void> { @@ -399,7 +409,7 @@ }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -414,7 +424,7 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less_equal); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS less_equal<void> { @@ -428,7 +438,7 @@ }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -443,7 +453,7 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater_equal); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS greater_equal<void> { @@ -457,7 +467,7 @@ }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -472,7 +482,7 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS greater<void> { @@ -488,7 +498,7 @@ // Logical operations -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -503,7 +513,7 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_and); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS logical_and<void> { @@ -517,7 +527,7 @@ }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -532,7 +542,7 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_not); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS logical_not<void> { @@ -546,7 +556,7 @@ }; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp = void> #else template <class _Tp> @@ -561,7 +571,7 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_or); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <> struct _LIBCPP_TEMPLATE_VIS logical_or<void> {
diff --git a/third_party/llvm-project/libcxx/include/__functional/perfect_forward.h b/third_party/llvm-project/libcxx/include/__functional/perfect_forward.h index 9ffea1a..af89797 100644 --- a/third_party/llvm-project/libcxx/include/__functional/perfect_forward.h +++ b/third_party/llvm-project/libcxx/include/__functional/perfect_forward.h
@@ -15,7 +15,6 @@ #include <__utility/forward.h> #include <__utility/move.h> #include <tuple> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -23,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Op, class _Indices, class... _BoundArgs> struct __perfect_forward_impl; @@ -87,7 +86,7 @@ template <class _Op, class ..._Args> using __perfect_forward = __perfect_forward_impl<_Op, index_sequence_for<_Args...>, _Args...>; -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__functional/ranges_operations.h b/third_party/llvm-project/libcxx/include/__functional/ranges_operations.h index 87081dd..77b6a6d 100644 --- a/third_party/llvm-project/libcxx/include/__functional/ranges_operations.h +++ b/third_party/llvm-project/libcxx/include/__functional/ranges_operations.h
@@ -13,6 +13,8 @@ #include <__concepts/equality_comparable.h> #include <__concepts/totally_ordered.h> #include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/predicate_traits.h> #include <__utility/forward.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -21,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { @@ -93,7 +95,10 @@ } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +template <class _Lhs, class _Rhs> +struct __is_trivial_equality_predicate<ranges::equal_to, _Lhs, _Rhs> : true_type {}; + +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__functional/reference_wrapper.h b/third_party/llvm-project/libcxx/include/__functional/reference_wrapper.h index c377b64..2d382a3 100644 --- a/third_party/llvm-project/libcxx/include/__functional/reference_wrapper.h +++ b/third_party/llvm-project/libcxx/include/__functional/reference_wrapper.h
@@ -55,12 +55,18 @@ template <class... _ArgTypes> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 typename __invoke_of<type&, _ArgTypes...>::type - operator() (_ArgTypes&&... __args) const { + operator() (_ArgTypes&&... __args) const +#if _LIBCPP_STD_VER >= 17 + // Since is_nothrow_invocable requires C++17 LWG3764 is not backported + // to earlier versions. + noexcept(is_nothrow_invocable_v<_Tp&, _ArgTypes...>) +#endif + { return std::__invoke(get(), std::forward<_ArgTypes>(__args)...); } }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> reference_wrapper(_Tp&) -> reference_wrapper<_Tp>; #endif
diff --git a/third_party/llvm-project/libcxx/include/__functional/unwrap_ref.h b/third_party/llvm-project/libcxx/include/__functional/unwrap_ref.h index da000d8..3abad73 100644 --- a/third_party/llvm-project/libcxx/include/__functional/unwrap_ref.h +++ b/third_party/llvm-project/libcxx/include/__functional/unwrap_ref.h
@@ -30,7 +30,7 @@ template <class _Tp> struct decay; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Tp> struct unwrap_reference : __unwrap_reference<_Tp> { }; @@ -38,7 +38,7 @@ using unwrap_reference_t = typename unwrap_reference<_Tp>::type; template <class _Tp> -struct unwrap_ref_decay : unwrap_reference<typename decay<_Tp>::type> { }; +struct unwrap_ref_decay : unwrap_reference<__decay_t<_Tp> > { }; template <class _Tp> using unwrap_ref_decay_t = typename unwrap_ref_decay<_Tp>::type; @@ -46,10 +46,10 @@ template <class _Tp> struct __unwrap_ref_decay -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 : unwrap_ref_decay<_Tp> #else - : __unwrap_reference<typename decay<_Tp>::type> + : __unwrap_reference<__decay_t<_Tp> > #endif { };
diff --git a/third_party/llvm-project/libcxx/include/__fwd/get.h b/third_party/llvm-project/libcxx/include/__fwd/get.h index ec1fab4..d043414 100644 --- a/third_party/llvm-project/libcxx/include/__fwd/get.h +++ b/third_party/llvm-project/libcxx/include/__fwd/get.h
@@ -15,7 +15,7 @@ #include <__fwd/pair.h> #include <__fwd/subrange.h> #include <__fwd/tuple.h> -#include <__tuple_dir/tuple_element.h> +#include <__tuple/tuple_element.h> #include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/third_party/llvm-project/libcxx/include/__fwd/span.h b/third_party/llvm-project/libcxx/include/__fwd/span.h index 943cb13..e9fa703 100644 --- a/third_party/llvm-project/libcxx/include/__fwd/span.h +++ b/third_party/llvm-project/libcxx/include/__fwd/span.h
@@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max(); template <typename _Tp, size_t _Extent = dynamic_extent> class span;
diff --git a/third_party/llvm-project/libcxx/include/__hash_table b/third_party/llvm-project/libcxx/include/__hash_table index f8896c8..e38a442 100644 --- a/third_party/llvm-project/libcxx/include/__hash_table +++ b/third_party/llvm-project/libcxx/include/__hash_table
@@ -17,6 +17,7 @@ #include <__config> #include <__debug> #include <__functional/hash.h> +#include <__functional/invoke.h> #include <__iterator/iterator_traits.h> #include <__memory/addressof.h> #include <__memory/allocator_traits.h> @@ -25,6 +26,16 @@ #include <__memory/swap_allocator.h> #include <__memory/unique_ptr.h> #include <__type_traits/can_extract_key.h> +#include <__type_traits/conditional.h> +#include <__type_traits/is_const.h> +#include <__type_traits/is_copy_constructible.h> +#include <__type_traits/is_nothrow_constructible.h> +#include <__type_traits/is_nothrow_default_constructible.h> +#include <__type_traits/is_nothrow_move_constructible.h> +#include <__type_traits/is_pointer.h> +#include <__type_traits/is_reference.h> +#include <__type_traits/remove_const.h> +#include <__type_traits/remove_cvref.h> #include <__utility/forward.h> #include <__utility/move.h> #include <__utility/pair.h> @@ -32,7 +43,6 @@ #include <cmath> #include <cstring> #include <initializer_list> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -826,7 +836,7 @@ template <class> friend class __hash_map_node_destructor; }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _NodeType, class _Alloc> struct __generic_container_node_destructor; @@ -1121,7 +1131,7 @@ return __emplace_unique_key_args(_NodeTypes::__get_key(__x), __x); } -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _NodeHandle, class _InsertReturnType> _LIBCPP_INLINE_VISIBILITY _InsertReturnType __node_handle_insert_unique(_NodeHandle&& __nh); @@ -1597,10 +1607,10 @@ if (bucket_count() != 0) { __next_pointer __cache = __detach(); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS const_iterator __i = __u.begin(); while (__cache != nullptr && __u.size() != 0) { @@ -1610,14 +1620,14 @@ __node_insert_multi(__cache->__upcast()); __cache = __next; } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __deallocate_node(__cache); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __deallocate_node(__cache); } const_iterator __i = __u.begin(); @@ -1659,10 +1669,10 @@ if (bucket_count() != 0) { __next_pointer __cache = __detach(); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS for (; __cache != nullptr && __first != __last; ++__first) { __cache->__upcast()->__value_ = *__first; @@ -1670,14 +1680,14 @@ __node_insert_unique(__cache->__upcast()); __cache = __next; } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __deallocate_node(__cache); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __deallocate_node(__cache); } for (; __first != __last; ++__first) @@ -1699,10 +1709,10 @@ if (bucket_count() != 0) { __next_pointer __cache = __detach(); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS for (; __cache != nullptr && __first != __last; ++__first) { __cache->__upcast()->__value_ = *__first; @@ -1710,14 +1720,14 @@ __node_insert_multi(__cache->__upcast()); __cache = __next; } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __deallocate_node(__cache); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __deallocate_node(__cache); } for (; __first != __last; ++__first) @@ -2088,7 +2098,7 @@ return __r; } -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class _NodeHandle, class _InsertReturnType> _LIBCPP_INLINE_VISIBILITY @@ -2218,7 +2228,7 @@ __node_insert_multi_perform(__src_ptr, __pn); } } -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 template <class _Tp, class _Hash, class _Equal, class _Alloc> template <bool _UniqueKeys>
diff --git a/third_party/llvm-project/libcxx/include/__iterator/access.h b/third_party/llvm-project/libcxx/include/__iterator/access.h index 0b8d523..d7bcb33 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/access.h +++ b/third_party/llvm-project/libcxx/include/__iterator/access.h
@@ -69,7 +69,7 @@ return __c.end(); } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Cp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14
diff --git a/third_party/llvm-project/libcxx/include/__iterator/advance.h b/third_party/llvm-project/libcxx/include/__iterator/advance.h index 154c273..4e852bb 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/advance.h +++ b/third_party/llvm-project/libcxx/include/__iterator/advance.h
@@ -23,7 +23,6 @@ #include <__utility/declval.h> #include <__utility/move.h> #include <__utility/unreachable.h> -#include <cstdlib> #include <limits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -69,7 +68,7 @@ _VSTD::__advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category()); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [range.iter.op.advance] @@ -159,9 +158,9 @@ __a > 0 ? __a >= __b : __a <= __b; }; - if (const auto __M = __bound_sentinel - __i; __magnitude_geq(__n, __M)) { + if (const auto __m = __bound_sentinel - __i; __magnitude_geq(__n, __m)) { (*this)(__i, __bound_sentinel); - return __n - __M; + return __n - __m; } // Otherwise, equivalent to `ranges::advance(i, n)`. @@ -196,7 +195,7 @@ } // namespace __cpo } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/back_insert_iterator.h b/third_party/llvm-project/libcxx/include/__iterator/back_insert_iterator.h index 4c00a7e..dc656e3 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/back_insert_iterator.h +++ b/third_party/llvm-project/libcxx/include/__iterator/back_insert_iterator.h
@@ -36,7 +36,7 @@ public: typedef output_iterator_tag iterator_category; typedef void value_type; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 typedef ptrdiff_t difference_type; #else typedef void difference_type;
diff --git a/third_party/llvm-project/libcxx/include/__iterator/bounded_iter.h b/third_party/llvm-project/libcxx/include/__iterator/bounded_iter.h index 2682f2a..00231e0 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/bounded_iter.h +++ b/third_party/llvm-project/libcxx/include/__iterator/bounded_iter.h
@@ -42,7 +42,7 @@ using pointer = typename iterator_traits<_Iterator>::pointer; using reference = typename iterator_traits<_Iterator>::reference; using iterator_category = typename iterator_traits<_Iterator>::iterator_category; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 using iterator_concept = contiguous_iterator_tag; #endif
diff --git a/third_party/llvm-project/libcxx/include/__iterator/common_iterator.h b/third_party/llvm-project/libcxx/include/__iterator/common_iterator.h index f7883e2..aab04ce 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/common_iterator.h +++ b/third_party/llvm-project/libcxx/include/__iterator/common_iterator.h
@@ -25,6 +25,7 @@ #include <__iterator/iter_swap.h> #include <__iterator/iterator_traits.h> #include <__iterator/readable_traits.h> +#include <__memory/addressof.h> #include <__type_traits/is_pointer.h> #include <__utility/declval.h> #include <variant> @@ -35,7 +36,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template<class _Iter> concept __can_use_postfix_proxy = @@ -274,7 +275,7 @@ using reference = iter_reference_t<_Iter>; }; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/concepts.h b/third_party/llvm-project/libcxx/include/__iterator/concepts.h index d9d40a4..dd9e8d6 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/concepts.h +++ b/third_party/llvm-project/libcxx/include/__iterator/concepts.h
@@ -46,7 +46,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [iterator.concept.readable] template<class _In> @@ -293,7 +293,7 @@ // Note: indirectly_swappable is located in iter_swap.h to prevent a dependency cycle // (both iter_swap and indirectly_swappable require indirectly_readable). -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/counted_iterator.h b/third_party/llvm-project/libcxx/include/__iterator/counted_iterator.h index 5fdbff4..ad69a5c 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/counted_iterator.h +++ b/third_party/llvm-project/libcxx/include/__iterator/counted_iterator.h
@@ -36,7 +36,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template<class> struct __counted_iterator_concept {}; @@ -143,12 +143,12 @@ decltype(auto) operator++(int) { _LIBCPP_ASSERT(__count_ > 0, "Iterator already at or past end."); --__count_; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { return __current_++; } catch(...) { ++__count_; throw; } #else return __current_++; -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } _LIBCPP_HIDE_FROM_ABI @@ -303,7 +303,7 @@ add_pointer_t<iter_reference_t<_Iter>>, void>; }; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/data.h b/third_party/llvm-project/libcxx/include/__iterator/data.h index 88eb752..f106807 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/data.h +++ b/third_party/llvm-project/libcxx/include/__iterator/data.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Cont> constexpr _LIBCPP_INLINE_VISIBILITY
diff --git a/third_party/llvm-project/libcxx/include/__iterator/default_sentinel.h b/third_party/llvm-project/libcxx/include/__iterator/default_sentinel.h index 669032a..d5fb2b6 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/default_sentinel.h +++ b/third_party/llvm-project/libcxx/include/__iterator/default_sentinel.h
@@ -18,12 +18,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 struct default_sentinel_t { }; inline constexpr default_sentinel_t default_sentinel{}; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/distance.h b/third_party/llvm-project/libcxx/include/__iterator/distance.h index 681e20d..ebe5473 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/distance.h +++ b/third_party/llvm-project/libcxx/include/__iterator/distance.h
@@ -53,7 +53,7 @@ return _VSTD::__distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category()); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [range.iter.op.distance] @@ -101,7 +101,7 @@ } // namespace __cpo } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/empty.h b/third_party/llvm-project/libcxx/include/__iterator/empty.h index 748ca9e..2cd4c7a 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/empty.h +++ b/third_party/llvm-project/libcxx/include/__iterator/empty.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Cont> _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY @@ -37,7 +37,7 @@ _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY constexpr bool empty(initializer_list<_Ep> __il) noexcept { return __il.size() == 0; } -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/front_insert_iterator.h b/third_party/llvm-project/libcxx/include/__iterator/front_insert_iterator.h index e278359..1ad5348 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/front_insert_iterator.h +++ b/third_party/llvm-project/libcxx/include/__iterator/front_insert_iterator.h
@@ -36,7 +36,7 @@ public: typedef output_iterator_tag iterator_category; typedef void value_type; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 typedef ptrdiff_t difference_type; #else typedef void difference_type;
diff --git a/third_party/llvm-project/libcxx/include/__iterator/incrementable_traits.h b/third_party/llvm-project/libcxx/include/__iterator/incrementable_traits.h index 3d06dc0..604e958 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/incrementable_traits.h +++ b/third_party/llvm-project/libcxx/include/__iterator/incrementable_traits.h
@@ -26,7 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [incrementable.traits] template<class> struct incrementable_traits {}; @@ -71,7 +71,7 @@ incrementable_traits<remove_cvref_t<_Ip> >, iterator_traits<remove_cvref_t<_Ip> > >::difference_type; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/indirectly_comparable.h b/third_party/llvm-project/libcxx/include/__iterator/indirectly_comparable.h index 868190f..e60ba25 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/indirectly_comparable.h +++ b/third_party/llvm-project/libcxx/include/__iterator/indirectly_comparable.h
@@ -21,13 +21,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _I1, class _I2, class _Rp, class _P1 = identity, class _P2 = identity> concept indirectly_comparable = indirect_binary_predicate<_Rp, projected<_I1, _P1>, projected<_I2, _P2>>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/insert_iterator.h b/third_party/llvm-project/libcxx/include/__iterator/insert_iterator.h index ecaea61..5534854 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/insert_iterator.h +++ b/third_party/llvm-project/libcxx/include/__iterator/insert_iterator.h
@@ -24,7 +24,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Container> using __insert_iterator_iter_t = ranges::iterator_t<_Container>; #else @@ -46,7 +46,7 @@ public: typedef output_iterator_tag iterator_category; typedef void value_type; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 typedef ptrdiff_t difference_type; #else typedef void difference_type;
diff --git a/third_party/llvm-project/libcxx/include/__iterator/istream_iterator.h b/third_party/llvm-project/libcxx/include/__iterator/istream_iterator.h index a056961..989902f 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/istream_iterator.h +++ b/third_party/llvm-project/libcxx/include/__iterator/istream_iterator.h
@@ -47,9 +47,9 @@ _Tp __value_; public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istream_iterator() : __in_stream_(nullptr), __value_() {} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI constexpr istream_iterator(default_sentinel_t) : istream_iterator() {} -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY istream_iterator(istream_type& __s) : __in_stream_(_VSTD::addressof(__s)) { if (!(*__in_stream_ >> __value_)) @@ -73,11 +73,11 @@ operator==(const istream_iterator<_Up, _CharU, _TraitsU, _DistanceU>& __x, const istream_iterator<_Up, _CharU, _TraitsU, _DistanceU>& __y); -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const istream_iterator& __i, default_sentinel_t) { return __i.__in_stream_ == nullptr; } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 }; template <class _Tp, class _CharT, class _Traits, class _Distance>
diff --git a/third_party/llvm-project/libcxx/include/__iterator/istreambuf_iterator.h b/third_party/llvm-project/libcxx/include/__iterator/istreambuf_iterator.h index bc53a6a..e39fec6 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/istreambuf_iterator.h +++ b/third_party/llvm-project/libcxx/include/__iterator/istreambuf_iterator.h
@@ -67,10 +67,10 @@ } public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(nullptr) {} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY constexpr istreambuf_iterator(default_sentinel_t) noexcept : istreambuf_iterator() {} -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) _NOEXCEPT : __sbuf_(__s.rdbuf()) {} _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) _NOEXCEPT @@ -93,11 +93,11 @@ _LIBCPP_INLINE_VISIBILITY bool equal(const istreambuf_iterator& __b) const {return __test_for_eof() == __b.__test_for_eof();} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 friend _LIBCPP_HIDE_FROM_ABI bool operator==(const istreambuf_iterator& __i, default_sentinel_t) { return __i.__test_for_eof(); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 }; template <class _CharT, class _Traits>
diff --git a/third_party/llvm-project/libcxx/include/__iterator/iter_move.h b/third_party/llvm-project/libcxx/include/__iterator/iter_move.h index a7d9413..78b1448 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/iter_move.h +++ b/third_party/llvm-project/libcxx/include/__iterator/iter_move.h
@@ -25,7 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [iterator.cust.move] @@ -97,7 +97,7 @@ requires requires(_Tp& __t) { { ranges::iter_move(__t) } -> __can_reference; } using iter_rvalue_reference_t = decltype(ranges::iter_move(std::declval<_Tp&>())); -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/iter_swap.h b/third_party/llvm-project/libcxx/include/__iterator/iter_swap.h index d4c0dca..c78efaf 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/iter_swap.h +++ b/third_party/llvm-project/libcxx/include/__iterator/iter_swap.h
@@ -28,7 +28,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [iter.cust.swap] @@ -106,7 +106,7 @@ ranges::iter_swap(__i2, __i1); }; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/iterator_traits.h b/third_party/llvm-project/libcxx/include/__iterator/iterator_traits.h index c9d8944..0318e4b 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/iterator_traits.h +++ b/third_party/llvm-project/libcxx/include/__iterator/iterator_traits.h
@@ -43,7 +43,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Tp> using __with_reference = _Tp&; @@ -62,7 +62,7 @@ template<__dereferenceable _Tp> using iter_reference_t = decltype(*std::declval<_Tp&>()); -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 template <class _Iter> struct _LIBCPP_TEMPLATE_VIS iterator_traits; @@ -72,7 +72,7 @@ struct _LIBCPP_TEMPLATE_VIS forward_iterator_tag : public input_iterator_tag {}; struct _LIBCPP_TEMPLATE_VIS bidirectional_iterator_tag : public forward_iterator_tag {}; struct _LIBCPP_TEMPLATE_VIS random_access_iterator_tag : public bidirectional_iterator_tag {}; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 struct _LIBCPP_TEMPLATE_VIS contiguous_iterator_tag : public random_access_iterator_tag {}; #endif @@ -157,7 +157,7 @@ static const bool value = decltype(__test<_Tp>(nullptr))::value; }; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // The `cpp17-*-iterator` exposition-only concepts have very similar names to the `Cpp17*Iterator` named requirements // from `[iterator.cpp17]`. To avoid confusion between the two, the exposition-only concepts have been banished to @@ -190,7 +190,7 @@ concept __cpp17_forward_iterator = __cpp17_input_iterator<_Ip> && constructible_from<_Ip> && - is_lvalue_reference_v<iter_reference_t<_Ip>> && + is_reference_v<iter_reference_t<_Ip>> && same_as<remove_cvref_t<iter_reference_t<_Ip>>, typename indirectly_readable_traits<_Ip>::value_type> && requires(_Ip __i) { @@ -381,7 +381,7 @@ using __primary_template = iterator_traits; }; -#else // _LIBCPP_STD_VER > 17 +#else // _LIBCPP_STD_VER >= 20 template <class _Iter, bool> struct __iterator_traits {}; @@ -418,10 +418,10 @@ using __primary_template = iterator_traits; }; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 template<class _Tp> -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 requires is_object_v<_Tp> #endif struct _LIBCPP_TEMPLATE_VIS iterator_traits<_Tp*> @@ -431,7 +431,7 @@ typedef _Tp* pointer; typedef _Tp& reference; typedef random_access_iterator_tag iterator_category; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 typedef contiguous_iterator_tag iterator_concept; #endif }; @@ -471,7 +471,7 @@ // Such iterators receive special "contiguous" optimizations in // std::copy and std::sort. // -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Tp> struct __is_cpp17_contiguous_iterator : _Or< __has_iterator_category_convertible_to<_Tp, contiguous_iterator_tag>,
diff --git a/third_party/llvm-project/libcxx/include/__iterator/mergeable.h b/third_party/llvm-project/libcxx/include/__iterator/mergeable.h index b9f2d08..494fda9 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/mergeable.h +++ b/third_party/llvm-project/libcxx/include/__iterator/mergeable.h
@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Input1, class _Input2, class _Output, class _Comp = ranges::less, class _Proj1 = identity, class _Proj2 = identity> @@ -34,7 +34,7 @@ indirectly_copyable<_Input2, _Output> && indirect_strict_weak_order<_Comp, projected<_Input1, _Proj1>, projected<_Input2, _Proj2>>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/move_iterator.h b/third_party/llvm-project/libcxx/include/__iterator/move_iterator.h index fa806db..e3939cc 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/move_iterator.h +++ b/third_party/llvm-project/libcxx/include/__iterator/move_iterator.h
@@ -41,7 +41,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template<class _Iter, class = void> struct __move_iter_category_base {}; @@ -59,18 +59,33 @@ concept __move_iter_comparable = requires { { std::declval<const _Iter&>() == std::declval<_Sent>() } -> convertible_to<bool>; }; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 template <class _Iter> class _LIBCPP_TEMPLATE_VIS move_iterator -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 : public __move_iter_category_base<_Iter> #endif { + #if _LIBCPP_STD_VER >= 20 +private: + _LIBCPP_HIDE_FROM_ABI + static constexpr auto __get_iter_concept() { + if constexpr (random_access_iterator<_Iter>) { + return random_access_iterator_tag{}; + } else if constexpr (bidirectional_iterator<_Iter>) { + return bidirectional_iterator_tag{}; + } else if constexpr (forward_iterator<_Iter>) { + return forward_iterator_tag{}; + } else { + return input_iterator_tag{}; + } + } +#endif // _LIBCPP_STD_VER >= 20 public: -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 using iterator_type = _Iter; - using iterator_concept = input_iterator_tag; + using iterator_concept = decltype(__get_iter_concept()); // iterator_category is inherited and not always present using value_type = iter_value_t<_Iter>; using difference_type = iter_difference_t<_Iter>; @@ -93,7 +108,7 @@ __libcpp_remove_reference_t<__reference>&&, __reference >::type reference; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 explicit move_iterator(_Iter __i) : __current_(std::move(__i)) {} @@ -104,7 +119,7 @@ _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 pointer operator->() const { return __current_; } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI constexpr move_iterator() requires is_constructible_v<_Iter> : __current_() {} @@ -171,7 +186,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator operator++(int) { move_iterator __tmp(*this); ++__current_; return __tmp; } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator& operator--() { --__current_; return *this; } @@ -186,7 +201,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17 move_iterator& operator-=(difference_type __n) { __current_ -= __n; return *this; } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template<sentinel_for<_Iter> _Sent> friend _LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const move_iterator& __x, const move_sentinel<_Sent>& __y) @@ -223,7 +238,7 @@ { return ranges::iter_swap(__x.__current_, __y.__current_); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 private: template<class _It2> friend class move_iterator; @@ -276,7 +291,7 @@ return __x.base() >= __y.base(); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Iter1, three_way_comparable_with<_Iter1> _Iter2> inline _LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>(const move_iterator<_Iter1>& __x, const move_iterator<_Iter2>& __y) @@ -284,7 +299,7 @@ { return __x.base() <=> __y.base(); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #ifndef _LIBCPP_CXX03_LANG template <class _Iter1, class _Iter2> @@ -304,7 +319,7 @@ } #endif // !_LIBCPP_CXX03_LANG -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Iter> inline _LIBCPP_HIDE_FROM_ABI constexpr move_iterator<_Iter> operator+(iter_difference_t<_Iter> __n, const move_iterator<_Iter>& __x) @@ -320,7 +335,7 @@ { return move_iterator<_Iter>(__x.base() + __n); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 template <class _Iter> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX17
diff --git a/third_party/llvm-project/libcxx/include/__iterator/move_sentinel.h b/third_party/llvm-project/libcxx/include/__iterator/move_sentinel.h index 0d7336a..5f16474 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/move_sentinel.h +++ b/third_party/llvm-project/libcxx/include/__iterator/move_sentinel.h
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <semiregular _Sent> class _LIBCPP_TEMPLATE_VIS move_sentinel @@ -52,7 +52,7 @@ _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(move_sentinel); -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/next.h b/third_party/llvm-project/libcxx/include/__iterator/next.h index 49970ae..2eb2c1f 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/next.h +++ b/third_party/llvm-project/libcxx/include/__iterator/next.h
@@ -35,7 +35,7 @@ return __x; } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [range.iter.op.next] @@ -77,7 +77,7 @@ } // namespace __cpo } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/ostream_iterator.h b/third_party/llvm-project/libcxx/include/__iterator/ostream_iterator.h index d16f5a2..025712b 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/ostream_iterator.h +++ b/third_party/llvm-project/libcxx/include/__iterator/ostream_iterator.h
@@ -34,7 +34,7 @@ public: typedef output_iterator_tag iterator_category; typedef void value_type; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 typedef ptrdiff_t difference_type; #else typedef void difference_type;
diff --git a/third_party/llvm-project/libcxx/include/__iterator/ostreambuf_iterator.h b/third_party/llvm-project/libcxx/include/__iterator/ostreambuf_iterator.h index b75f7b6..898ef90 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/ostreambuf_iterator.h +++ b/third_party/llvm-project/libcxx/include/__iterator/ostreambuf_iterator.h
@@ -33,7 +33,7 @@ public: typedef output_iterator_tag iterator_category; typedef void value_type; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 typedef ptrdiff_t difference_type; #else typedef void difference_type;
diff --git a/third_party/llvm-project/libcxx/include/__iterator/permutable.h b/third_party/llvm-project/libcxx/include/__iterator/permutable.h index 28d193e..adf88f5 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/permutable.h +++ b/third_party/llvm-project/libcxx/include/__iterator/permutable.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Iterator> concept permutable = @@ -28,7 +28,7 @@ indirectly_movable_storable<_Iterator, _Iterator> && indirectly_swappable<_Iterator, _Iterator>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/prev.h b/third_party/llvm-project/libcxx/include/__iterator/prev.h index af1e1ba..8e9c4f2 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/prev.h +++ b/third_party/llvm-project/libcxx/include/__iterator/prev.h
@@ -34,7 +34,7 @@ return __x; } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [range.iter.op.prev] @@ -70,7 +70,7 @@ } // namespace __cpo } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/projected.h b/third_party/llvm-project/libcxx/include/__iterator/projected.h index 19c076b..e74e56d 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/projected.h +++ b/third_party/llvm-project/libcxx/include/__iterator/projected.h
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template<indirectly_readable _It, indirectly_regular_unary_invocable<_It> _Proj> struct projected { @@ -34,7 +34,7 @@ using difference_type = iter_difference_t<_It>; }; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/readable_traits.h b/third_party/llvm-project/libcxx/include/__iterator/readable_traits.h index 8f17757..fe4f0cd 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/readable_traits.h +++ b/third_party/llvm-project/libcxx/include/__iterator/readable_traits.h
@@ -26,7 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [readable.traits] template<class> struct __cond_value_type {}; @@ -85,7 +85,7 @@ indirectly_readable_traits<remove_cvref_t<_Ip> >, iterator_traits<remove_cvref_t<_Ip> > >::value_type; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/reverse_access.h b/third_party/llvm-project/libcxx/include/__iterator/reverse_access.h index 79b599c..b8c5a07 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/reverse_access.h +++ b/third_party/llvm-project/libcxx/include/__iterator/reverse_access.h
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp, size_t _Np> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 @@ -93,7 +93,7 @@ return _VSTD::rend(__c); } -#endif // _LIBCPP_STD_VER > 11 +#endif // _LIBCPP_STD_VER >= 14 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/reverse_iterator.h b/third_party/llvm-project/libcxx/include/__iterator/reverse_iterator.h index f272e03..8437064 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/reverse_iterator.h +++ b/third_party/llvm-project/libcxx/include/__iterator/reverse_iterator.h
@@ -63,10 +63,10 @@ _Iter __t_; // no longer used as of LWG #2360, not removed due to ABI break #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 static_assert(__is_cpp17_bidirectional_iterator<_Iter>::value || bidirectional_iterator<_Iter>, "reverse_iterator<It> requires It to be a bidirectional iterator."); -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 protected: _Iter current; @@ -77,7 +77,7 @@ random_access_iterator_tag, typename iterator_traits<_Iter>::iterator_category>; using pointer = typename iterator_traits<_Iter>::pointer; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 using iterator_concept = _If<random_access_iterator<_Iter>, random_access_iterator_tag, bidirectional_iterator_tag>; using value_type = iter_value_t<_Iter>; using difference_type = iter_difference_t<_Iter>; @@ -144,7 +144,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator*() const {_Iter __tmp = current; return *--__tmp;} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY constexpr pointer operator->() const requires is_pointer_v<_Iter> || requires(const _Iter __i) { __i.operator->(); } @@ -160,7 +160,7 @@ pointer operator->() const { return std::addressof(operator*()); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator& operator++() {--current; return *this;} @@ -181,7 +181,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 reference operator[](difference_type __n) const {return *(*this + __n);} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI friend constexpr iter_rvalue_reference_t<_Iter> iter_move(const reverse_iterator& __i) noexcept(is_nothrow_copy_constructible_v<_Iter> && @@ -200,18 +200,18 @@ auto __ytmp = __y.base(); ranges::iter_swap(--__xtmp, --__ytmp); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 }; template <class _Iter1, class _Iter2> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 bool operator==(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 requires requires { { __x.base() == __y.base() } -> convertible_to<bool>; } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 { return __x.base() == __y.base(); } @@ -220,11 +220,11 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 bool operator<(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 requires requires { { __x.base() > __y.base() } -> convertible_to<bool>; } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 { return __x.base() > __y.base(); } @@ -233,11 +233,11 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 bool operator!=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 requires requires { { __x.base() != __y.base() } -> convertible_to<bool>; } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 { return __x.base() != __y.base(); } @@ -246,11 +246,11 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 bool operator>(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 requires requires { { __x.base() < __y.base() } -> convertible_to<bool>; } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 { return __x.base() < __y.base(); } @@ -259,11 +259,11 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 bool operator>=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 requires requires { { __x.base() <= __y.base() } -> convertible_to<bool>; } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 { return __x.base() <= __y.base(); } @@ -272,16 +272,16 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 bool operator<=(const reverse_iterator<_Iter1>& __x, const reverse_iterator<_Iter2>& __y) -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 requires requires { { __x.base() >= __y.base() } -> convertible_to<bool>; } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 { return __x.base() >= __y.base(); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Iter1, three_way_comparable_with<_Iter1> _Iter2> _LIBCPP_HIDE_FROM_ABI constexpr compare_three_way_result_t<_Iter1, _Iter2> @@ -289,7 +289,7 @@ { return __y.base() <=> __x.base(); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #ifndef _LIBCPP_CXX03_LANG template <class _Iter1, class _Iter2> @@ -318,13 +318,13 @@ return reverse_iterator<_Iter>(__x.base() - __n); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Iter1, class _Iter2> requires (!sized_sentinel_for<_Iter1, _Iter2>) inline constexpr bool disable_sized_sentinel_for<reverse_iterator<_Iter1>, reverse_iterator<_Iter2>> = true; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Iter> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX17 reverse_iterator<_Iter> make_reverse_iterator(_Iter __i) @@ -498,7 +498,7 @@ } }; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <ranges::bidirectional_range _Range> _LIBCPP_HIDE_FROM_ABI constexpr ranges:: subrange<reverse_iterator<ranges::iterator_t<_Range>>, reverse_iterator<ranges::iterator_t<_Range>>> @@ -512,7 +512,7 @@ struct __unwrap_iter_impl<reverse_iterator<reverse_iterator<_Iter> >, __b> : __unwrap_reverse_iter_impl<reverse_iterator, reverse_iterator, _Iter> {}; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Iter, bool __b> struct __unwrap_iter_impl<reverse_iterator<__unconstrained_reverse_iterator<_Iter>>, __b> @@ -526,7 +526,7 @@ struct __unwrap_iter_impl<__unconstrained_reverse_iterator<__unconstrained_reverse_iterator<_Iter>>, __b> : __unwrap_reverse_iter_impl<__unconstrained_reverse_iterator, __unconstrained_reverse_iterator, _Iter> {}; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/size.h b/third_party/llvm-project/libcxx/include/__iterator/size.h index 1452bd1..625eeb1 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/size.h +++ b/third_party/llvm-project/libcxx/include/__iterator/size.h
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Cont> _LIBCPP_INLINE_VISIBILITY @@ -34,7 +34,7 @@ _LIBCPP_INLINE_VISIBILITY constexpr size_t size(const _Tp (&)[_Sz]) noexcept { return _Sz; } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Cont> _LIBCPP_INLINE_VISIBILITY constexpr auto ssize(const _Cont& __c) @@ -52,7 +52,7 @@ _LIBCPP_DIAGNOSTIC_POP #endif -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/sortable.h b/third_party/llvm-project/libcxx/include/__iterator/sortable.h index bcf934f..d4d77d6 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/sortable.h +++ b/third_party/llvm-project/libcxx/include/__iterator/sortable.h
@@ -23,14 +23,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Iter, class _Comp = ranges::less, class _Proj = identity> concept sortable = permutable<_Iter> && indirect_strict_weak_order<_Comp, projected<_Iter, _Proj>>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/unreachable_sentinel.h b/third_party/llvm-project/libcxx/include/__iterator/unreachable_sentinel.h index d77cc99..91fd0a5 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/unreachable_sentinel.h +++ b/third_party/llvm-project/libcxx/include/__iterator/unreachable_sentinel.h
@@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 struct unreachable_sentinel_t { template<weakly_incrementable _Iter> @@ -31,7 +31,7 @@ inline constexpr unreachable_sentinel_t unreachable_sentinel{}; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__iterator/wrap_iter.h b/third_party/llvm-project/libcxx/include/__iterator/wrap_iter.h index 16defc1..d0246ad 100644 --- a/third_party/llvm-project/libcxx/include/__iterator/wrap_iter.h +++ b/third_party/llvm-project/libcxx/include/__iterator/wrap_iter.h
@@ -34,7 +34,7 @@ typedef typename iterator_traits<iterator_type>::pointer pointer; typedef typename iterator_traits<iterator_type>::reference reference; typedef typename iterator_traits<iterator_type>::iterator_category iterator_category; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 typedef contiguous_iterator_tag iterator_concept; #endif
diff --git a/third_party/llvm-project/libcxx/include/__locale b/third_party/llvm-project/libcxx/include/__locale index e0ffa0c..b461831 100644 --- a/third_party/llvm-project/libcxx/include/__locale +++ b/third_party/llvm-project/libcxx/include/__locale
@@ -14,6 +14,7 @@ #include <__config> #include <cctype> #include <cstdint> +#include <cstdlib> #include <locale.h> #include <mutex> #include <string> @@ -927,6 +928,11 @@ } template <class _CharT> +_LIBCPP_HIDE_FROM_ABI bool isblank(_CharT __c, const locale& __loc) { + return std::use_facet<ctype<_CharT> >(__loc).is(ctype_base::blank, __c); +} + +template <class _CharT> inline _LIBCPP_INLINE_VISIBILITY _CharT toupper(_CharT __c, const locale& __loc)
diff --git a/third_party/llvm-project/libcxx/include/__memory/aligned_alloc.h b/third_party/llvm-project/libcxx/include/__memory/aligned_alloc.h new file mode 100644 index 0000000..786963c --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__memory/aligned_alloc.h
@@ -0,0 +1,66 @@ +//===----------------------------------------------------------------------===// +// +// 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___MEMORY_ALIGNED_ALLOC_H +#define _LIBCPP___MEMORY_ALIGNED_ALLOC_H + +#include <__config> +#include <cstddef> +#include <cstdlib> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +#ifndef _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION + +// Low-level helpers to call the aligned allocation and deallocation functions +// on the target platform. This is used to implement libc++'s own memory +// allocation routines -- if you need to allocate memory inside the library, +// chances are that you want to use `__libcpp_allocate` instead. +// +// Returns the allocated memory, or `nullptr` on failure. +inline _LIBCPP_HIDE_FROM_ABI +void* __libcpp_aligned_alloc(std::size_t __alignment, std::size_t __size) { +# if defined(_LIBCPP_MSVCRT_LIKE) + return ::_aligned_malloc(__size, __alignment); +# elif _LIBCPP_STD_VER >= 17 && !defined(_LIBCPP_HAS_NO_C11_ALIGNED_ALLOC) + // aligned_alloc() requires that __size is a multiple of __alignment, + // but for C++ [new.delete.general], only states "if the value of an + // alignment argument passed to any of these functions is not a valid + // alignment value, the behavior is undefined". + // To handle calls such as ::operator new(1, std::align_val_t(128)), we + // round __size up to the next multiple of __alignment. + size_t __rounded_size = (__size + __alignment - 1) & ~(__alignment - 1); + // Rounding up could have wrapped around to zero, so we have to add another + // max() ternary to the actual call site to avoid succeeded in that case. + return ::aligned_alloc(__alignment, __size > __rounded_size ? __size : __rounded_size); +# else + void* __result = nullptr; + (void)::posix_memalign(&__result, __alignment, __size); + // If posix_memalign fails, __result is unmodified so we still return `nullptr`. + return __result; +# endif +} + +inline _LIBCPP_HIDE_FROM_ABI +void __libcpp_aligned_free(void* __ptr) { +#if defined(_LIBCPP_MSVCRT_LIKE) + ::_aligned_free(__ptr); +#else + ::free(__ptr); +#endif +} + +#endif // !_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___MEMORY_ALIGNED_ALLOC_H
diff --git a/third_party/llvm-project/libcxx/include/__memory/allocate_at_least.h b/third_party/llvm-project/libcxx/include/__memory/allocate_at_least.h index ef205f8..8d8ad07 100644 --- a/third_party/llvm-project/libcxx/include/__memory/allocate_at_least.h +++ b/third_party/llvm-project/libcxx/include/__memory/allocate_at_least.h
@@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <class _Pointer> struct allocation_result { _Pointer ptr; @@ -55,7 +55,7 @@ return {__alloc.allocate(__n), __n}; } -#endif // _LIBCPP_STD_VER > 20 +#endif // _LIBCPP_STD_VER >= 23 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__memory/allocator.h b/third_party/llvm-project/libcxx/include/__memory/allocator.h index 54c9b78..244013c 100644 --- a/third_party/llvm-project/libcxx/include/__memory/allocator.h +++ b/third_party/llvm-project/libcxx/include/__memory/allocator.h
@@ -11,6 +11,7 @@ #define _LIBCPP___MEMORY_ALLOCATOR_H #include <__config> +#include <__memory/addressof.h> #include <__memory/allocate_at_least.h> #include <__memory/allocator_traits.h> #include <__type_traits/is_constant_evaluated.h> @@ -116,7 +117,7 @@ } } -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr allocation_result<_Tp*> allocate_at_least(size_t __n) { return {allocate(__n), __n}; @@ -205,7 +206,7 @@ } } -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr allocation_result<const _Tp*> allocate_at_least(size_t __n) { return {allocate(__n), __n};
diff --git a/third_party/llvm-project/libcxx/include/__memory/allocator_arg_t.h b/third_party/llvm-project/libcxx/include/__memory/allocator_arg_t.h index 15f8c98..9e2d8c6 100644 --- a/third_party/llvm-project/libcxx/include/__memory/allocator_arg_t.h +++ b/third_party/llvm-project/libcxx/include/__memory/allocator_arg_t.h
@@ -25,9 +25,9 @@ struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { explicit allocator_arg_t() = default; }; -#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY) +#if defined(_LIBCPP_BUILDING_LIBRARY) extern _LIBCPP_EXPORTED_FROM_ABI const allocator_arg_t allocator_arg; -#else +#elif !defined(_LIBCPP_CXX03_LANG) /* inline */ constexpr allocator_arg_t allocator_arg = allocator_arg_t(); #endif
diff --git a/third_party/llvm-project/libcxx/include/__memory/allocator_traits.h b/third_party/llvm-project/libcxx/include/__memory/allocator_traits.h index 3a23b47..57f88a3 100644 --- a/third_party/llvm-project/libcxx/include/__memory/allocator_traits.h +++ b/third_party/llvm-project/libcxx/include/__memory/allocator_traits.h
@@ -300,7 +300,7 @@ __enable_if_t<!__has_construct<allocator_type, _Tp*, _Args...>::value> > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 static void construct(allocator_type&, _Tp* __p, _Args&&... __args) { -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _VSTD::construct_at(__p, _VSTD::forward<_Args>(__args)...); #else ::new ((void*)__p) _Tp(_VSTD::forward<_Args>(__args)...); @@ -319,7 +319,7 @@ __enable_if_t<!__has_destroy<allocator_type, _Tp*>::value> > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 static void destroy(allocator_type&, _Tp* __p) { -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _VSTD::destroy_at(__p); #else __p->~_Tp();
diff --git a/third_party/llvm-project/libcxx/include/__memory/assume_aligned.h b/third_party/llvm-project/libcxx/include/__memory/assume_aligned.h index a1fd244..1f505f5 100644 --- a/third_party/llvm-project/libcxx/include/__memory/assume_aligned.h +++ b/third_party/llvm-project/libcxx/include/__memory/assume_aligned.h
@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <size_t _Np, class _Tp> [[nodiscard]] @@ -39,7 +39,7 @@ } } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__memory/compressed_pair.h b/third_party/llvm-project/libcxx/include/__memory/compressed_pair.h index 8093d7c..d5986da 100644 --- a/third_party/llvm-project/libcxx/include/__memory/compressed_pair.h +++ b/third_party/llvm-project/libcxx/include/__memory/compressed_pair.h
@@ -13,7 +13,7 @@ #include <__config> #include <__fwd/get.h> #include <__fwd/tuple.h> -#include <__tuple_dir/tuple_indices.h> +#include <__tuple/tuple_indices.h> #include <__type_traits/decay.h> #include <__type_traits/dependent_type.h> #include <__type_traits/enable_if.h> @@ -46,7 +46,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__default_init_tag) {} _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__value_init_tag) : __value_() {} - template <class _Up, class = __enable_if_t<!is_same<__compressed_pair_elem, typename decay<_Up>::type>::value> > + template <class _Up, class = __enable_if_t<!is_same<__compressed_pair_elem, __decay_t<_Up> >::value> > _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(_Up&& __u) : __value_(std::forward<_Up>(__u)) {} @@ -75,7 +75,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__default_init_tag) {} _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(__value_init_tag) : __value_type() {} - template <class _Up, class = __enable_if_t<!is_same<__compressed_pair_elem, typename decay<_Up>::type>::value> > + template <class _Up, class = __enable_if_t<!is_same<__compressed_pair_elem, __decay_t<_Up> >::value> > _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR explicit __compressed_pair_elem(_Up&& __u) : __value_type(std::forward<_Up>(__u)) {}
diff --git a/third_party/llvm-project/libcxx/include/__memory/concepts.h b/third_party/llvm-project/libcxx/include/__memory/concepts.h index 12d7bf8..9517a8f 100644 --- a/third_party/llvm-project/libcxx/include/__memory/concepts.h +++ b/third_party/llvm-project/libcxx/include/__memory/concepts.h
@@ -26,7 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { @@ -62,7 +62,7 @@ } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__memory/construct_at.h b/third_party/llvm-project/libcxx/include/__memory/construct_at.h index ffee002..fb146b7 100644 --- a/third_party/llvm-project/libcxx/include/__memory/construct_at.h +++ b/third_party/llvm-project/libcxx/include/__memory/construct_at.h
@@ -30,19 +30,19 @@ // construct_at -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Tp, class... _Args, class = decltype(::new(std::declval<void*>()) _Tp(std::declval<_Args>()...))> _LIBCPP_HIDE_FROM_ABI constexpr _Tp* construct_at(_Tp* __location, _Args&&... __args) { _LIBCPP_ASSERT(__location != nullptr, "null pointer given to construct_at"); - return ::new (_VSTD::__voidify(*__location)) _Tp(_VSTD::forward<_Args>(__args)...); + return ::new (std::__voidify(*__location)) _Tp(std::forward<_Args>(__args)...); } #endif template <class _Tp, class... _Args, class = decltype(::new(std::declval<void*>()) _Tp(std::declval<_Args>()...))> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __construct_at(_Tp* __location, _Args&&... __args) { -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 return std::construct_at(__location, std::forward<_Args>(__args)...); #else return _LIBCPP_ASSERT(__location != nullptr, "null pointer given to construct_at"), @@ -66,12 +66,12 @@ __loc->~_Tp(); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Tp, typename enable_if<is_array<_Tp>::value, int>::type = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __destroy_at(_Tp* __loc) { _LIBCPP_ASSERT(__loc != nullptr, "null pointer given to destroy_at"); - _VSTD::__destroy(_VSTD::begin(*__loc), _VSTD::end(*__loc)); + std::__destroy(std::begin(*__loc), std::end(*__loc)); } #endif @@ -79,41 +79,51 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator __destroy(_ForwardIterator __first, _ForwardIterator __last) { for (; __first != __last; ++__first) - _VSTD::__destroy_at(_VSTD::addressof(*__first)); + std::__destroy_at(std::addressof(*__first)); return __first; } -#if _LIBCPP_STD_VER > 14 +template <class _BidirectionalIterator> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 +_BidirectionalIterator __reverse_destroy(_BidirectionalIterator __first, _BidirectionalIterator __last) { + while (__last != __first) { + --__last; + std::__destroy_at(std::addressof(*__last)); + } + return __last; +} + +#if _LIBCPP_STD_VER >= 17 template <class _Tp, enable_if_t<!is_array_v<_Tp>, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void destroy_at(_Tp* __loc) { - _VSTD::__destroy_at(__loc); + std::__destroy_at(__loc); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Tp, enable_if_t<is_array_v<_Tp>, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void destroy_at(_Tp* __loc) { - _VSTD::__destroy_at(__loc); + std::__destroy_at(__loc); } #endif template <class _ForwardIterator> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void destroy(_ForwardIterator __first, _ForwardIterator __last) { - (void)_VSTD::__destroy(_VSTD::move(__first), _VSTD::move(__last)); + (void)std::__destroy(std::move(__first), std::move(__last)); } template <class _ForwardIterator, class _Size> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator destroy_n(_ForwardIterator __first, _Size __n) { for (; __n > 0; (void)++__first, --__n) - _VSTD::__destroy_at(_VSTD::addressof(*__first)); + std::__destroy_at(std::addressof(*__first)); return __first; } -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__memory/pointer_traits.h b/third_party/llvm-project/libcxx/include/__memory/pointer_traits.h index c4f20de..c33e7bd 100644 --- a/third_party/llvm-project/libcxx/include/__memory/pointer_traits.h +++ b/third_party/llvm-project/libcxx/include/__memory/pointer_traits.h
@@ -200,7 +200,7 @@ _And<is_class<_Pointer>, _IsFancyPointer<_Pointer> >::value > > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR -typename decay<decltype(__to_address_helper<_Pointer>::__call(std::declval<const _Pointer&>()))>::type +__decay_t<decltype(__to_address_helper<_Pointer>::__call(std::declval<const _Pointer&>()))> __to_address(const _Pointer& __p) _NOEXCEPT { return __to_address_helper<_Pointer>::__call(__p); } @@ -223,7 +223,7 @@ } }; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Tp> inline _LIBCPP_INLINE_VISIBILITY constexpr auto to_address(_Tp *__p) noexcept {
diff --git a/third_party/llvm-project/libcxx/include/__memory/ranges_construct_at.h b/third_party/llvm-project/libcxx/include/__memory/ranges_construct_at.h index e63585d..9ded2fc 100644 --- a/third_party/llvm-project/libcxx/include/__memory/ranges_construct_at.h +++ b/third_party/llvm-project/libcxx/include/__memory/ranges_construct_at.h
@@ -30,7 +30,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { // construct_at @@ -118,7 +118,7 @@ } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__memory/ranges_uninitialized_algorithms.h b/third_party/llvm-project/libcxx/include/__memory/ranges_uninitialized_algorithms.h index 15c78e2..bea5385 100644 --- a/third_party/llvm-project/libcxx/include/__memory/ranges_uninitialized_algorithms.h +++ b/third_party/llvm-project/libcxx/include/__memory/ranges_uninitialized_algorithms.h
@@ -33,7 +33,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { @@ -312,7 +312,7 @@ } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__memory/raw_storage_iterator.h b/third_party/llvm-project/libcxx/include/__memory/raw_storage_iterator.h index 11971de..df7ef5a 100644 --- a/third_party/llvm-project/libcxx/include/__memory/raw_storage_iterator.h +++ b/third_party/llvm-project/libcxx/include/__memory/raw_storage_iterator.h
@@ -39,7 +39,7 @@ public: typedef output_iterator_tag iterator_category; typedef void value_type; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 typedef ptrdiff_t difference_type; #else typedef void difference_type;
diff --git a/third_party/llvm-project/libcxx/include/__memory/shared_ptr.h b/third_party/llvm-project/libcxx/include/__memory/shared_ptr.h index b77ce92..1d72eb6 100644 --- a/third_party/llvm-project/libcxx/include/__memory/shared_ptr.h +++ b/third_party/llvm-project/libcxx/include/__memory/shared_ptr.h
@@ -29,17 +29,32 @@ #include <__memory/pointer_traits.h> #include <__memory/uninitialized_algorithms.h> #include <__memory/unique_ptr.h> +#include <__type_traits/add_lvalue_reference.h> +#include <__type_traits/conditional.h> +#include <__type_traits/conjunction.h> +#include <__type_traits/disjunction.h> +#include <__type_traits/is_array.h> +#include <__type_traits/is_bounded_array.h> +#include <__type_traits/is_convertible.h> +#include <__type_traits/is_move_constructible.h> +#include <__type_traits/is_reference.h> +#include <__type_traits/is_unbounded_array.h> +#include <__type_traits/nat.h> +#include <__type_traits/negation.h> +#include <__type_traits/remove_extent.h> +#include <__type_traits/remove_reference.h> +#include <__utility/declval.h> #include <__utility/forward.h> #include <__utility/move.h> #include <__utility/swap.h> +#include <__verbose_abort> #include <cstddef> -#include <cstdlib> // abort #include <iosfwd> #include <new> #include <stdexcept> #include <typeinfo> #if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) -# include <atomic> +# include <__atomic/memory_order.h> #endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -118,10 +133,10 @@ _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY void __throw_bad_weak_ptr() { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw bad_weak_ptr(); #else - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("bad_weak_ptr was thrown in -fno-exceptions mode"); #endif } @@ -219,7 +234,7 @@ __shared_ptr_pointer(_Tp __p, _Dp __d, _Alloc __a) : __data_(__compressed_pair<_Tp, _Dp>(__p, _VSTD::move(__d)), _VSTD::move(__a)) {} -#ifndef _LIBCPP_NO_RTTI +#ifndef _LIBCPP_HAS_NO_RTTI const void* __get_deleter(const type_info&) const _NOEXCEPT override; #endif @@ -228,7 +243,7 @@ void __on_zero_shared_weak() _NOEXCEPT override; }; -#ifndef _LIBCPP_NO_RTTI +#ifndef _LIBCPP_HAS_NO_RTTI template <class _Tp, class _Dp, class _Alloc> const void* @@ -237,7 +252,7 @@ return __t == typeid(_Dp) ? _VSTD::addressof(__data_.first().second()) : nullptr; } -#endif // _LIBCPP_NO_RTTI +#endif // _LIBCPP_HAS_NO_RTTI template <class _Tp, class _Dp, class _Alloc> void @@ -260,7 +275,10 @@ __a.deallocate(_PTraits::pointer_to(*this), 1); } -struct __default_initialize_tag {}; +// This tag is used to instantiate an allocator type. The various shared_ptr control blocks +// detect that the allocator has been instantiated for this type and perform alternative +// initialization/destruction based on that. +struct __for_overwrite_tag {}; template <class _Tp, class _Alloc> struct __shared_ptr_emplace @@ -271,25 +289,20 @@ explicit __shared_ptr_emplace(_Alloc __a, _Args&& ...__args) : __storage_(_VSTD::move(__a)) { -#if _LIBCPP_STD_VER > 17 - using _TpAlloc = typename __allocator_traits_rebind<_Alloc, _Tp>::type; - _TpAlloc __tmp(*__get_alloc()); - allocator_traits<_TpAlloc>::construct(__tmp, __get_elem(), _VSTD::forward<_Args>(__args)...); +#if _LIBCPP_STD_VER >= 20 + if constexpr (is_same_v<typename _Alloc::value_type, __for_overwrite_tag>) { + static_assert(sizeof...(_Args) == 0, "No argument should be provided to the control block when using _for_overwrite"); + ::new ((void*)__get_elem()) _Tp; + } else { + using _TpAlloc = typename __allocator_traits_rebind<_Alloc, _Tp>::type; + _TpAlloc __tmp(*__get_alloc()); + allocator_traits<_TpAlloc>::construct(__tmp, __get_elem(), _VSTD::forward<_Args>(__args)...); + } #else ::new ((void*)__get_elem()) _Tp(_VSTD::forward<_Args>(__args)...); #endif } - -#if _LIBCPP_STD_VER >= 20 - _LIBCPP_HIDE_FROM_ABI - explicit __shared_ptr_emplace(__default_initialize_tag, _Alloc __a) - : __storage_(std::move(__a)) - { - ::new ((void*)__get_elem()) _Tp; - } -#endif - _LIBCPP_HIDE_FROM_ABI _Alloc* __get_alloc() _NOEXCEPT { return __storage_.__get_alloc(); } @@ -298,10 +311,14 @@ private: void __on_zero_shared() _NOEXCEPT override { -#if _LIBCPP_STD_VER > 17 - using _TpAlloc = typename __allocator_traits_rebind<_Alloc, _Tp>::type; - _TpAlloc __tmp(*__get_alloc()); - allocator_traits<_TpAlloc>::destroy(__tmp, __get_elem()); +#if _LIBCPP_STD_VER >= 20 + if constexpr (is_same_v<typename _Alloc::value_type, __for_overwrite_tag>) { + __get_elem()->~_Tp(); + } else { + using _TpAlloc = typename __allocator_traits_rebind<_Alloc, _Tp>::type; + _TpAlloc __tmp(*__get_alloc()); + allocator_traits<_TpAlloc>::destroy(__tmp, __get_elem()); + } #else __get_elem()->~_Tp(); #endif @@ -367,13 +384,57 @@ template<class _Tp> class _LIBCPP_TEMPLATE_VIS enable_shared_from_this; -template<class _Tp, class _Up> +// http://eel.is/c++draft/util.sharedptr#util.smartptr.shared.general-6 +// A pointer type Y* is said to be compatible with a pointer type T* +// when either Y* is convertible to T* or Y is U[N] and T is cv U[]. +#if _LIBCPP_STD_VER >= 17 +template <class _Yp, class _Tp> +struct __bounded_convertible_to_unbounded : false_type {}; + +template <class _Up, std::size_t _Np, class _Tp> +struct __bounded_convertible_to_unbounded<_Up[_Np], _Tp> + : is_same<__remove_cv_t<_Tp>, _Up[]> {}; + +template <class _Yp, class _Tp> struct __compatible_with -#if _LIBCPP_STD_VER > 14 - : is_convertible<remove_extent_t<_Tp>*, remove_extent_t<_Up>*> {}; + : _Or< + is_convertible<_Yp*, _Tp*>, + __bounded_convertible_to_unbounded<_Yp, _Tp> + > {}; #else - : is_convertible<_Tp*, _Up*> {}; -#endif // _LIBCPP_STD_VER > 14 +template <class _Yp, class _Tp> +struct __compatible_with + : is_convertible<_Yp*, _Tp*> {}; +#endif // _LIBCPP_STD_VER >= 17 + +// Constructors that take raw pointers have a different set of "compatible" constraints +// http://eel.is/c++draft/util.sharedptr#util.smartptr.shared.const-9.1 +// - If T is an array type, then either T is U[N] and Y(*)[N] is convertible to T*, +// or T is U[] and Y(*)[] is convertible to T*. +// - If T is not an array type, then Y* is convertible to T*. +#if _LIBCPP_STD_VER >= 17 +template <class _Yp, class _Tp, class = void> +struct __raw_pointer_compatible_with : _And< + _Not<is_array<_Tp>>, + is_convertible<_Yp*, _Tp*> + > {}; + +template <class _Yp, class _Up, std::size_t _Np> +struct __raw_pointer_compatible_with<_Yp, _Up[_Np], __enable_if_t< + is_convertible<_Yp(*)[_Np], _Up(*)[_Np]>::value> > + : true_type {}; + +template <class _Yp, class _Up> +struct __raw_pointer_compatible_with<_Yp, _Up[], __enable_if_t< + is_convertible<_Yp(*)[], _Up(*)[]>::value> > + : true_type {}; + +#else +template <class _Yp, class _Tp> +struct __raw_pointer_compatible_with + : is_convertible<_Yp*, _Tp*> {}; +#endif // _LIBCPP_STD_VER >= 17 + template <class _Ptr, class = void> struct __is_deletable : false_type { }; @@ -387,24 +448,24 @@ template <class _Dp, class _Pt, class = decltype(std::declval<_Dp>()(std::declval<_Pt>()))> -static true_type __well_formed_deleter_test(int); +true_type __well_formed_deleter_test(int); template <class, class> -static false_type __well_formed_deleter_test(...); +false_type __well_formed_deleter_test(...); template <class _Dp, class _Pt> struct __well_formed_deleter : decltype(std::__well_formed_deleter_test<_Dp, _Pt>(0)) {}; -template<class _Dp, class _Tp, class _Yp> +template<class _Dp, class _Yp, class _Tp> struct __shared_ptr_deleter_ctor_reqs { - static const bool value = __compatible_with<_Tp, _Yp>::value && + static const bool value = __raw_pointer_compatible_with<_Yp, _Tp>::value && is_move_constructible<_Dp>::value && - __well_formed_deleter<_Dp, _Tp*>::value; + __well_formed_deleter<_Dp, _Yp*>::value; }; #if defined(_LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI) -# define _LIBCPP_SHARED_PTR_TRIVIAL_ABI __attribute__((trivial_abi)) +# define _LIBCPP_SHARED_PTR_TRIVIAL_ABI __attribute__((__trivial_abi__)) #else # define _LIBCPP_SHARED_PTR_TRIVIAL_ABI #endif @@ -413,7 +474,7 @@ class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS shared_ptr { public: -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 typedef weak_ptr<_Tp> weak_type; typedef remove_extent_t<_Tp> element_type; #else @@ -439,7 +500,7 @@ template<class _Yp, class = __enable_if_t< _And< - __compatible_with<_Yp, _Tp> + __raw_pointer_compatible_with<_Yp, _Tp> // In C++03 we get errors when trying to do SFINAE with the // delete operator, so we always pretend that it's deletable. // The same happens on GCC. @@ -457,15 +518,15 @@ __enable_weak_this(__p, __p); } - template<class _Yp, class _Dp, class = __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, element_type>::value> > + template<class _Yp, class _Dp, class = __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> > _LIBCPP_HIDE_FROM_ABI shared_ptr(_Yp* __p, _Dp __d) : __ptr_(__p) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT> _CntrlBlk; #ifndef _LIBCPP_CXX03_LANG @@ -474,25 +535,25 @@ __cntrl_ = new _CntrlBlk(__p, __d, _AllocT()); #endif // not _LIBCPP_CXX03_LANG __enable_weak_this(__p, __p); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __d(__p); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } - template<class _Yp, class _Dp, class _Alloc, class = __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, element_type>::value> > + template<class _Yp, class _Dp, class _Alloc, class = __enable_if_t<__shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> > _LIBCPP_HIDE_FROM_ABI shared_ptr(_Yp* __p, _Dp __d, _Alloc __a) : __ptr_(__p) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS typedef __shared_ptr_pointer<_Yp*, _Dp, _Alloc> _CntrlBlk; typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2; typedef __allocator_destructor<_A2> _D2; @@ -506,14 +567,14 @@ #endif // not _LIBCPP_CXX03_LANG __cntrl_ = _VSTD::addressof(*__hold2.release()); __enable_weak_this(__p, __p); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __d(__p); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } template<class _Dp> @@ -521,10 +582,10 @@ shared_ptr(nullptr_t __p, _Dp __d) : __ptr_(nullptr) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT; typedef __shared_ptr_pointer<nullptr_t, _Dp, _AllocT> _CntrlBlk; #ifndef _LIBCPP_CXX03_LANG @@ -532,14 +593,14 @@ #else __cntrl_ = new _CntrlBlk(__p, __d, _AllocT()); #endif // not _LIBCPP_CXX03_LANG -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __d(__p); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } template<class _Dp, class _Alloc> @@ -547,10 +608,10 @@ shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a) : __ptr_(nullptr) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS typedef __shared_ptr_pointer<nullptr_t, _Dp, _Alloc> _CntrlBlk; typedef typename __allocator_traits_rebind<_Alloc, _CntrlBlk>::type _A2; typedef __allocator_destructor<_A2> _D2; @@ -563,14 +624,14 @@ _CntrlBlk(__p, __d, __a); #endif // not _LIBCPP_CXX03_LANG __cntrl_ = _VSTD::addressof(*__hold2.release()); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __d(__p); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } template<class _Yp> @@ -646,13 +707,14 @@ template <class _Yp, class _Dp, class = __enable_if_t< !is_lvalue_reference<_Dp>::value && + __compatible_with<_Yp, _Tp>::value && is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value > > _LIBCPP_HIDE_FROM_ABI shared_ptr(unique_ptr<_Yp, _Dp>&& __r) : __ptr_(__r.get()) { -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 if (__ptr_ == nullptr) __cntrl_ = nullptr; else @@ -668,13 +730,14 @@ template <class _Yp, class _Dp, class = void, class = __enable_if_t< is_lvalue_reference<_Dp>::value && + __compatible_with<_Yp, _Tp>::value && is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value > > _LIBCPP_HIDE_FROM_ABI shared_ptr(unique_ptr<_Yp, _Dp>&& __r) : __ptr_(__r.get()) { -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 if (__ptr_ == nullptr) __cntrl_ = nullptr; else @@ -740,9 +803,10 @@ } #endif - template <class _Yp, class _Dp, class = __enable_if_t< - is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value - > > + template <class _Yp, class _Dp, class = __enable_if_t<_And< + __compatible_with<_Yp, _Tp>, + is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*> + >::value> > _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(unique_ptr<_Yp, _Dp>&& __r) { @@ -764,7 +828,7 @@ } template<class _Yp, class = __enable_if_t< - __compatible_with<_Yp, _Tp>::value + __raw_pointer_compatible_with<_Yp, _Tp>::value > > _LIBCPP_HIDE_FROM_ABI void reset(_Yp* __p) @@ -773,8 +837,7 @@ } template<class _Yp, class _Dp, class = __enable_if_t< - __compatible_with<_Yp, _Tp>::value - > > + __shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> > _LIBCPP_HIDE_FROM_ABI void reset(_Yp* __p, _Dp __d) { @@ -782,8 +845,7 @@ } template<class _Yp, class _Dp, class _Alloc, class = __enable_if_t< - __compatible_with<_Yp, _Tp>::value - > > + __shared_ptr_deleter_ctor_reqs<_Dp, _Yp, _Tp>::value> > _LIBCPP_HIDE_FROM_ABI void reset(_Yp* __p, _Dp __d, _Alloc __a) { @@ -848,7 +910,7 @@ return __cntrl_ == __p.__cntrl_; } -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_HIDE_FROM_ABI __add_lvalue_reference_t<element_type> operator[](ptrdiff_t __i) const { @@ -858,7 +920,7 @@ } #endif -#ifndef _LIBCPP_NO_RTTI +#ifndef _LIBCPP_HAS_NO_RTTI template <class _Dp> _LIBCPP_HIDE_FROM_ABI _Dp* __get_deleter() const _NOEXCEPT @@ -867,7 +929,7 @@ ? const_cast<void *>(__cntrl_->__get_deleter(typeid(_Dp))) : nullptr); } -#endif // _LIBCPP_NO_RTTI +#endif // _LIBCPP_HAS_NO_RTTI template<class _Yp, class _CntrlBlk> _LIBCPP_HIDE_FROM_ABI @@ -928,7 +990,7 @@ template <class _Up> friend class _LIBCPP_TEMPLATE_VIS weak_ptr; }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template<class _Tp> shared_ptr(weak_ptr<_Tp>) -> shared_ptr<_Tp>; template<class _Tp, class _Dp> @@ -963,12 +1025,9 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a) { - using _ControlBlock = __shared_ptr_emplace<_Tp, _Alloc>; - using _ControlBlockAllocator = typename __allocator_traits_rebind<_Alloc, _ControlBlock>::type; - __allocation_guard<_ControlBlockAllocator> __guard(__a, 1); - ::new ((void*)_VSTD::addressof(*__guard.__get())) _ControlBlock(__default_initialize_tag{}, __a); - auto __control_block = __guard.__release_ptr(); - return shared_ptr<_Tp>::__create_with_control_block((*__control_block).__get_elem(), _VSTD::addressof(*__control_block)); + using _ForOverwriteAllocator = __allocator_traits_rebind_t<_Alloc, __for_overwrite_tag>; + _ForOverwriteAllocator __alloc(__a); + return std::allocate_shared<_Tp>(__alloc); } template<class _Tp, __enable_if_t<!is_array<_Tp>::value, int> = 0> @@ -980,7 +1039,7 @@ #endif // _LIBCPP_STD_VER >= 20 -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <size_t _Alignment> struct __sp_aligned_storage { @@ -1000,26 +1059,25 @@ explicit __unbounded_array_control_block(_Alloc const& __alloc, size_t __count, _Tp const& __arg) : __alloc_(__alloc), __count_(__count) { - std::__uninitialized_allocator_fill_n(__alloc_, std::begin(__data_), __count_, __arg); + std::__uninitialized_allocator_fill_n_multidimensional(__alloc_, std::begin(__data_), __count_, __arg); } _LIBCPP_HIDE_FROM_ABI explicit __unbounded_array_control_block(_Alloc const& __alloc, size_t __count) : __alloc_(__alloc), __count_(__count) { - std::__uninitialized_allocator_value_construct_n(__alloc_, std::begin(__data_), __count_); - } - #if _LIBCPP_STD_VER >= 20 - _LIBCPP_HIDE_FROM_ABI - explicit __unbounded_array_control_block(_Alloc const& __alloc, size_t __count, __default_initialize_tag) - : __alloc_(__alloc), __count_(__count) - { - // We are purposefully not using an allocator-aware default construction because the spec says so. - // There's currently no way of expressing default initialization in an allocator-aware manner anyway. - std::uninitialized_default_construct_n(std::begin(__data_), __count_); - } + if constexpr (is_same_v<typename _Alloc::value_type, __for_overwrite_tag>) { + // We are purposefully not using an allocator-aware default construction because the spec says so. + // There's currently no way of expressing default initialization in an allocator-aware manner anyway. + std::uninitialized_default_construct_n(std::begin(__data_), __count_); + } else { + std::__uninitialized_allocator_value_construct_n_multidimensional(__alloc_, std::begin(__data_), __count_); + } +#else + std::__uninitialized_allocator_value_construct_n_multidimensional(__alloc_, std::begin(__data_), __count_); #endif + } // Returns the number of bytes required to store a control block followed by the given number // of elements of _Tp, with the whole storage being aligned to a multiple of _Tp's alignment. @@ -1042,8 +1100,17 @@ private: void __on_zero_shared() _NOEXCEPT override { +#if _LIBCPP_STD_VER >= 20 + if constexpr (is_same_v<typename _Alloc::value_type, __for_overwrite_tag>) { + std::__reverse_destroy(__data_, __data_ + __count_); + } else { + __allocator_traits_rebind_t<_Alloc, _Tp> __value_alloc(__alloc_); + std::__allocator_destroy_multidimensional(__value_alloc, __data_, __data_ + __count_); + } +#else __allocator_traits_rebind_t<_Alloc, _Tp> __value_alloc(__alloc_); std::__allocator_destroy_multidimensional(__value_alloc, __data_, __data_ + __count_); +#endif } void __on_zero_shared_weak() _NOEXCEPT override { @@ -1096,30 +1163,40 @@ _LIBCPP_HIDE_FROM_ABI explicit __bounded_array_control_block(_Alloc const& __alloc, _Tp const& __arg) : __alloc_(__alloc) { - std::__uninitialized_allocator_fill_n(__alloc_, std::addressof(__data_[0]), _Count, __arg); + std::__uninitialized_allocator_fill_n_multidimensional(__alloc_, std::addressof(__data_[0]), _Count, __arg); } _LIBCPP_HIDE_FROM_ABI explicit __bounded_array_control_block(_Alloc const& __alloc) : __alloc_(__alloc) { - std::__uninitialized_allocator_value_construct_n(__alloc_, std::addressof(__data_[0]), _Count); - } - #if _LIBCPP_STD_VER >= 20 - _LIBCPP_HIDE_FROM_ABI - explicit __bounded_array_control_block(_Alloc const& __alloc, __default_initialize_tag) : __alloc_(__alloc) { - // We are purposefully not using an allocator-aware default construction because the spec says so. - // There's currently no way of expressing default initialization in an allocator-aware manner anyway. - std::uninitialized_default_construct_n(std::addressof(__data_[0]), _Count); - } + if constexpr (is_same_v<typename _Alloc::value_type, __for_overwrite_tag>) { + // We are purposefully not using an allocator-aware default construction because the spec says so. + // There's currently no way of expressing default initialization in an allocator-aware manner anyway. + std::uninitialized_default_construct_n(std::addressof(__data_[0]), _Count); + } else { + std::__uninitialized_allocator_value_construct_n_multidimensional(__alloc_, std::addressof(__data_[0]), _Count); + } +#else + std::__uninitialized_allocator_value_construct_n_multidimensional(__alloc_, std::addressof(__data_[0]), _Count); #endif + } _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~__bounded_array_control_block() override { } // can't be `= default` because of the sometimes-non-trivial union member __data_ private: void __on_zero_shared() _NOEXCEPT override { +#if _LIBCPP_STD_VER >= 20 + if constexpr (is_same_v<typename _Alloc::value_type, __for_overwrite_tag>) { + std::__reverse_destroy(__data_, __data_ + _Count); + } else { + __allocator_traits_rebind_t<_Alloc, _Tp> __value_alloc(__alloc_); + std::__allocator_destroy_multidimensional(__value_alloc, __data_, __data_ + _Count); + } +#else __allocator_traits_rebind_t<_Alloc, _Tp> __value_alloc(__alloc_); std::__allocator_destroy_multidimensional(__value_alloc, __data_, __data_ + _Count); +#endif } void __on_zero_shared_weak() _NOEXCEPT override { @@ -1152,9 +1229,9 @@ return shared_ptr<_Array>::__create_with_control_block(__control_block->__get_data(), __control_block); } -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // bounded array variants template<class _Tp, class _Alloc, class = __enable_if_t<is_bounded_array<_Tp>::value>> @@ -1175,7 +1252,9 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a) { - return std::__allocate_shared_bounded_array<_Tp>(__a, __default_initialize_tag{}); + using _ForOverwriteAllocator = __allocator_traits_rebind_t<_Alloc, __for_overwrite_tag>; + _ForOverwriteAllocator __alloc(__a); + return std::__allocate_shared_bounded_array<_Tp>(__alloc); } template<class _Tp, class = __enable_if_t<is_bounded_array<_Tp>::value>> @@ -1196,7 +1275,7 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared_for_overwrite() { - return std::__allocate_shared_bounded_array<_Tp>(allocator<_Tp>(), __default_initialize_tag{}); + return std::__allocate_shared_bounded_array<_Tp>(allocator<__for_overwrite_tag>()); } // unbounded array variants @@ -1218,7 +1297,9 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a, size_t __n) { - return std::__allocate_shared_unbounded_array<_Tp>(__a, __n, __default_initialize_tag{}); + using _ForOverwriteAllocator = __allocator_traits_rebind_t<_Alloc, __for_overwrite_tag>; + _ForOverwriteAllocator __alloc(__a); + return std::__allocate_shared_unbounded_array<_Tp>(__alloc, __n); } template<class _Tp, class = __enable_if_t<is_unbounded_array<_Tp>::value>> @@ -1239,10 +1320,10 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared_for_overwrite(size_t __n) { - return std::__allocate_shared_unbounded_array<_Tp>(allocator<_Tp>(), __n, __default_initialize_tag{}); + return std::__allocate_shared_unbounded_array<_Tp>(allocator<__for_overwrite_tag>(), __n); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 template<class _Tp, class _Up> inline _LIBCPP_INLINE_VISIBILITY @@ -1302,7 +1383,7 @@ #endif // _LIBCPP_STD_VER <= 17 -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template<class _Tp, class _Up> _LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) noexcept @@ -1411,7 +1492,7 @@ #endif // _LIBCPP_STD_VER <= 17 -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template<class _Tp> _LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(shared_ptr<_Tp> const& __x, nullptr_t) noexcept @@ -1465,7 +1546,7 @@ typename shared_ptr<_Tp>::element_type*>(__r.get())); } -#ifndef _LIBCPP_NO_RTTI +#ifndef _LIBCPP_HAS_NO_RTTI template<class _Dp, class _Tp> inline _LIBCPP_INLINE_VISIBILITY @@ -1475,13 +1556,13 @@ return __p.template __get_deleter<_Dp>(); } -#endif // _LIBCPP_NO_RTTI +#endif // _LIBCPP_HAS_NO_RTTI template<class _Tp> class _LIBCPP_SHARED_PTR_TRIVIAL_ABI _LIBCPP_TEMPLATE_VIS weak_ptr { public: -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 typedef remove_extent_t<_Tp> element_type; #else typedef _Tp element_type; @@ -1566,7 +1647,7 @@ template <class _Up> friend class _LIBCPP_TEMPLATE_VIS shared_ptr; }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template<class _Tp> weak_ptr(shared_ptr<_Tp>) -> weak_ptr<_Tp>; #endif @@ -1742,7 +1823,7 @@ return __r; } -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp = void> struct owner_less; #else template <class _Tp> struct owner_less; @@ -1779,7 +1860,7 @@ {return __x.owner_before(__y);} }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <> struct _LIBCPP_TEMPLATE_VIS owner_less<void> { @@ -1825,7 +1906,7 @@ shared_ptr<_Tp const> shared_from_this() const {return shared_ptr<const _Tp>(__weak_this_);} -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_INLINE_VISIBILITY weak_ptr<_Tp> weak_from_this() _NOEXCEPT { return __weak_this_; } @@ -1833,7 +1914,7 @@ _LIBCPP_INLINE_VISIBILITY weak_ptr<const _Tp> weak_from_this() const _NOEXCEPT { return __weak_this_; } -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 template <class _Up> friend class shared_ptr; };
diff --git a/third_party/llvm-project/libcxx/include/__memory/swap_allocator.h b/third_party/llvm-project/libcxx/include/__memory/swap_allocator.h index c6e1751..90851cb 100644 --- a/third_party/llvm-project/libcxx/include/__memory/swap_allocator.h +++ b/third_party/llvm-project/libcxx/include/__memory/swap_allocator.h
@@ -23,7 +23,7 @@ template <typename _Alloc> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __swap_allocator(_Alloc& __a1, _Alloc& __a2, true_type) -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 _NOEXCEPT #else _NOEXCEPT_(__is_nothrow_swappable<_Alloc>::value) @@ -39,7 +39,7 @@ template <typename _Alloc> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __swap_allocator(_Alloc& __a1, _Alloc& __a2) -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 _NOEXCEPT #else _NOEXCEPT_(__is_nothrow_swappable<_Alloc>::value)
diff --git a/third_party/llvm-project/libcxx/include/__memory/uninitialized_algorithms.h b/third_party/llvm-project/libcxx/include/__memory/uninitialized_algorithms.h index 63a45b2..d860cee 100644 --- a/third_party/llvm-project/libcxx/include/__memory/uninitialized_algorithms.h +++ b/third_party/llvm-project/libcxx/include/__memory/uninitialized_algorithms.h
@@ -58,12 +58,12 @@ __uninitialized_copy(_InputIterator __ifirst, _Sentinel1 __ilast, _ForwardIterator __ofirst, _Sentinel2 __olast) { _ForwardIterator __idx = __ofirst; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif for (; __ifirst != __ilast && __idx != __olast; ++__ifirst, (void)++__idx) ::new (_VSTD::__voidify(*__idx)) _ValueType(*__ifirst); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { _VSTD::__destroy(__ofirst, __idx); throw; @@ -90,12 +90,12 @@ __uninitialized_copy_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst, _Sentinel __olast) { _ForwardIterator __idx = __ofirst; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif for (; __n > 0 && __idx != __olast; ++__ifirst, (void)++__idx, (void)--__n) ::new (_VSTD::__voidify(*__idx)) _ValueType(*__ifirst); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { _VSTD::__destroy(__ofirst, __idx); throw; @@ -121,13 +121,13 @@ _ForwardIterator __uninitialized_fill(_ForwardIterator __first, _Sentinel __last, const _Tp& __x) { _ForwardIterator __idx = __first; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif for (; __idx != __last; ++__idx) ::new (_VSTD::__voidify(*__idx)) _ValueType(__x); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -154,13 +154,13 @@ _ForwardIterator __uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) { _ForwardIterator __idx = __first; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif for (; __n > 0; ++__idx, (void) --__n) ::new (_VSTD::__voidify(*__idx)) _ValueType(__x); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -180,7 +180,7 @@ return _VSTD::__uninitialized_fill_n<_ValueType>(__first, __n, __x); } -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 // uninitialized_default_construct @@ -188,12 +188,12 @@ inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator __uninitialized_default_construct(_ForwardIterator __first, _Sentinel __last) { auto __idx = __first; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif for (; __idx != __last; ++__idx) ::new (_VSTD::__voidify(*__idx)) _ValueType; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { _VSTD::__destroy(__first, __idx); throw; @@ -217,12 +217,12 @@ inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator __uninitialized_default_construct_n(_ForwardIterator __first, _Size __n) { auto __idx = __first; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif for (; __n > 0; ++__idx, (void) --__n) ::new (_VSTD::__voidify(*__idx)) _ValueType; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { _VSTD::__destroy(__first, __idx); throw; @@ -245,12 +245,12 @@ inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator __uninitialized_value_construct(_ForwardIterator __first, _Sentinel __last) { auto __idx = __first; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif for (; __idx != __last; ++__idx) ::new (_VSTD::__voidify(*__idx)) _ValueType(); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { _VSTD::__destroy(__first, __idx); throw; @@ -274,12 +274,12 @@ inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator __uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) { auto __idx = __first; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif for (; __n > 0; ++__idx, (void) --__n) ::new (_VSTD::__voidify(*__idx)) _ValueType(); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { _VSTD::__destroy(__first, __idx); throw; @@ -304,13 +304,13 @@ __uninitialized_move(_InputIterator __ifirst, _Sentinel1 __ilast, _ForwardIterator __ofirst, _Sentinel2 __olast, _IterMove __iter_move) { auto __idx = __ofirst; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif for (; __ifirst != __ilast && __idx != __olast; ++__idx, (void)++__ifirst) { ::new (_VSTD::__voidify(*__idx)) _ValueType(__iter_move(__ifirst)); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { _VSTD::__destroy(__ofirst, __idx); throw; @@ -338,12 +338,12 @@ __uninitialized_move_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst, _Sentinel __olast, _IterMove __iter_move) { auto __idx = __ofirst; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif for (; __n > 0 && __idx != __olast; ++__idx, (void)++__ifirst, --__n) ::new (_VSTD::__voidify(*__idx)) _ValueType(__iter_move(__ifirst)); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { _VSTD::__destroy(__ofirst, __idx); throw; @@ -410,7 +410,7 @@ // This function assumes that the allocator is bound to the correct type. template<class _Alloc, class _Tp> _LIBCPP_HIDE_FROM_ABI -constexpr void __allocator_construct_at(_Alloc& __alloc, _Tp* __loc) { +constexpr void __allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* __loc) { static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _Tp>, "The allocator should already be rebound to the correct type"); @@ -421,12 +421,12 @@ _Tp& __array = *__loc; // If an exception is thrown, destroy what we have constructed so far in reverse order. - __exception_guard __guard([&]() { + auto __guard = std::__make_exception_guard([&]() { std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i); }); for (; __i != extent_v<_Tp>; ++__i) { - std::__allocator_construct_at(__elem_alloc, std::addressof(__array[__i])); + std::__allocator_construct_at_multidimensional(__elem_alloc, std::addressof(__array[__i])); } __guard.__complete(); } else { @@ -446,13 +446,13 @@ // This function assumes that the allocator is bound to the correct type. template<class _Alloc, class _Tp, class _Arg> _LIBCPP_HIDE_FROM_ABI -constexpr void __allocator_construct_at(_Alloc& __alloc, _Tp* __loc, _Arg const& __arg) { +constexpr void __allocator_construct_at_multidimensional(_Alloc& __alloc, _Tp* __loc, _Arg const& __arg) { static_assert(is_same_v<typename allocator_traits<_Alloc>::value_type, _Tp>, "The allocator should already be rebound to the correct type"); if constexpr (is_array_v<_Tp>) { static_assert(is_array_v<_Arg>, - "Provided non-array initialization argument to __allocator_construct_at when " + "Provided non-array initialization argument to __allocator_construct_at_multidimensional when " "trying to construct an array."); using _Element = remove_extent_t<_Tp>; @@ -461,11 +461,11 @@ _Tp& __array = *__loc; // If an exception is thrown, destroy what we have constructed so far in reverse order. - __exception_guard __guard([&]() { + auto __guard = std::__make_exception_guard([&]() { std::__allocator_destroy_multidimensional(__elem_alloc, __array, __array + __i); }); for (; __i != extent_v<_Tp>; ++__i) { - std::__allocator_construct_at(__elem_alloc, std::addressof(__array[__i]), __arg[__i]); + std::__allocator_construct_at_multidimensional(__elem_alloc, std::addressof(__array[__i]), __arg[__i]); } __guard.__complete(); } else { @@ -481,38 +481,38 @@ // initialization using allocator_traits destruction. If the elements in the range are C-style // arrays, they are initialized element-wise using allocator construction, and recursively so. template<class _Alloc, class _BidirIter, class _Tp, class _Size = typename iterator_traits<_BidirIter>::difference_type> -_LIBCPP_HIDE_FROM_ABI -constexpr void __uninitialized_allocator_fill_n(_Alloc& __alloc, _BidirIter __it, _Size __n, _Tp const& __value) { +_LIBCPP_HIDE_FROM_ABI constexpr void +__uninitialized_allocator_fill_n_multidimensional(_Alloc& __alloc, _BidirIter __it, _Size __n, _Tp const& __value) { using _ValueType = typename iterator_traits<_BidirIter>::value_type; __allocator_traits_rebind_t<_Alloc, _ValueType> __value_alloc(__alloc); _BidirIter __begin = __it; // If an exception is thrown, destroy what we have constructed so far in reverse order. - __exception_guard __guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); }); + auto __guard = std::__make_exception_guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); }); for (; __n != 0; --__n, ++__it) { - std::__allocator_construct_at(__value_alloc, std::addressof(*__it), __value); + std::__allocator_construct_at_multidimensional(__value_alloc, std::addressof(*__it), __value); } __guard.__complete(); } -// Same as __uninitialized_allocator_fill_n, but doesn't pass any initialization argument +// Same as __uninitialized_allocator_fill_n_multidimensional, but doesn't pass any initialization argument // to the allocator's construct method, which results in value initialization. -template<class _Alloc, class _BidirIter, class _Size = typename iterator_traits<_BidirIter>::difference_type> -_LIBCPP_HIDE_FROM_ABI -constexpr void __uninitialized_allocator_value_construct_n(_Alloc& __alloc, _BidirIter __it, _Size __n) { +template <class _Alloc, class _BidirIter, class _Size = typename iterator_traits<_BidirIter>::difference_type> +_LIBCPP_HIDE_FROM_ABI constexpr void +__uninitialized_allocator_value_construct_n_multidimensional(_Alloc& __alloc, _BidirIter __it, _Size __n) { using _ValueType = typename iterator_traits<_BidirIter>::value_type; __allocator_traits_rebind_t<_Alloc, _ValueType> __value_alloc(__alloc); _BidirIter __begin = __it; // If an exception is thrown, destroy what we have constructed so far in reverse order. - __exception_guard __guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); }); + auto __guard = std::__make_exception_guard([&]() { std::__allocator_destroy_multidimensional(__value_alloc, __begin, __it); }); for (; __n != 0; --__n, ++__it) { - std::__allocator_construct_at(__value_alloc, std::addressof(*__it)); + std::__allocator_construct_at_multidimensional(__value_alloc, std::addressof(*__it)); } __guard.__complete(); } -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 // Destroy all elements in [__first, __last) from left to right using allocator destruction. template <class _Alloc, class _Iter, class _Sent> @@ -600,7 +600,7 @@ auto __guard = std::__make_exception_guard(_AllocatorDestroyRangeReverse<_Alloc, _Iter2>(__alloc, __destruct_first, __first2)); while (__first1 != __last1) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS allocator_traits<_Alloc>::construct(__alloc, std::__to_address(__first2), std::move_if_noexcept(*__first1)); #else allocator_traits<_Alloc>::construct(__alloc, std::__to_address(__first2), std::move(*__first1));
diff --git a/third_party/llvm-project/libcxx/include/__memory/unique_ptr.h b/third_party/llvm-project/libcxx/include/__memory/unique_ptr.h index 9cdbda8..b30f8b2 100644 --- a/third_party/llvm-project/libcxx/include/__memory/unique_ptr.h +++ b/third_party/llvm-project/libcxx/include/__memory/unique_ptr.h
@@ -115,7 +115,7 @@ }; #if defined(_LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI) -# define _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI __attribute__((trivial_abi)) +# define _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI __attribute__((__trivial_abi__)) #else # define _LIBCPP_UNIQUE_PTR_TRIVIAL_ABI #endif @@ -556,7 +556,7 @@ operator>=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__x < __y);} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _T1, class _D1, class _T2, class _D2> requires three_way_comparable_with<typename unique_ptr<_T1, _D1>::pointer, typename unique_ptr<_T2, _D2>::pointer> @@ -650,7 +650,7 @@ return !(nullptr < __x); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _T1, class _D1> requires three_way_comparable< typename unique_ptr<_T1, _D1>::pointer> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 @@ -660,7 +660,7 @@ } #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template<class _Tp> struct __unique_if @@ -697,7 +697,7 @@ typename __unique_if<_Tp>::__unique_array_known_bound make_unique(_Args&&...) = delete; -#endif // _LIBCPP_STD_VER > 11 +#endif // _LIBCPP_STD_VER >= 14 #if _LIBCPP_STD_VER >= 20
diff --git a/third_party/llvm-project/libcxx/include/__memory/uses_allocator.h b/third_party/llvm-project/libcxx/include/__memory/uses_allocator.h index fe89704..f82ac179 100644 --- a/third_party/llvm-project/libcxx/include/__memory/uses_allocator.h +++ b/third_party/llvm-project/libcxx/include/__memory/uses_allocator.h
@@ -49,9 +49,9 @@ { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp, class _Alloc> -inline constexpr size_t uses_allocator_v = uses_allocator<_Tp, _Alloc>::value; +inline constexpr bool uses_allocator_v = uses_allocator<_Tp, _Alloc>::value; #endif _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__memory/uses_allocator_construction.h b/third_party/llvm-project/libcxx/include/__memory/uses_allocator_construction.h index 0f63b08..c6eccd2 100644 --- a/third_party/llvm-project/libcxx/include/__memory/uses_allocator_construction.h +++ b/third_party/llvm-project/libcxx/include/__memory/uses_allocator_construction.h
@@ -83,7 +83,7 @@ std::forward_as_tuple(std::forward<_Vp>(__v))); } -# if _LIBCPP_STD_VER > 20 +# if _LIBCPP_STD_VER >= 23 template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_std_pair<_Pair>, int> = 0> _LIBCPP_HIDE_FROM_ABI constexpr auto __uses_allocator_construction_args(const _Alloc& __alloc, pair<_Up, _Vp>& __pair) noexcept { @@ -109,7 +109,7 @@ std::forward_as_tuple(std::get<1>(std::move(__pair)))); } -# if _LIBCPP_STD_VER > 20 +# if _LIBCPP_STD_VER >= 23 template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_std_pair<_Pair>, int> = 0> _LIBCPP_HIDE_FROM_ABI constexpr auto __uses_allocator_construction_args(const _Alloc& __alloc, const pair<_Up, _Vp>&& __pair) noexcept {
diff --git a/third_party/llvm-project/libcxx/include/__memory_resource/memory_resource.h b/third_party/llvm-project/libcxx/include/__memory_resource/memory_resource.h index 02fdd08..4f0e4e4 100644 --- a/third_party/llvm-project/libcxx/include/__memory_resource/memory_resource.h +++ b/third_party/llvm-project/libcxx/include/__memory_resource/memory_resource.h
@@ -16,7 +16,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -70,6 +70,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 #endif // _LIBCPP___MEMORY_RESOURCE_MEMORY_RESOURCE_H
diff --git a/third_party/llvm-project/libcxx/include/__memory_resource/monotonic_buffer_resource.h b/third_party/llvm-project/libcxx/include/__memory_resource/monotonic_buffer_resource.h index 5b0d246..9878471 100644 --- a/third_party/llvm-project/libcxx/include/__memory_resource/monotonic_buffer_resource.h +++ b/third_party/llvm-project/libcxx/include/__memory_resource/monotonic_buffer_resource.h
@@ -18,7 +18,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -115,6 +115,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 #endif // _LIBCPP___MEMORY_RESOURCE_MONOTONIC_BUFFER_RESOURCE_H
diff --git a/third_party/llvm-project/libcxx/include/__memory_resource/polymorphic_allocator.h b/third_party/llvm-project/libcxx/include/__memory_resource/polymorphic_allocator.h index 2489502..c52adc4 100644 --- a/third_party/llvm-project/libcxx/include/__memory_resource/polymorphic_allocator.h +++ b/third_party/llvm-project/libcxx/include/__memory_resource/polymorphic_allocator.h
@@ -26,7 +26,7 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -98,7 +98,7 @@ template <class _Type, class... _CtorArgs> [[nodiscard]] _Type* new_object(_CtorArgs&&... __ctor_args) { _Type* __ptr = allocate_object<_Type>(); - __exception_guard __guard([&] { deallocate_object(__ptr); }); + auto __guard = std::__make_exception_guard([&] { deallocate_object(__ptr); }); construct(__ptr, std::forward<_CtorArgs>(__ctor_args)...); __guard.__complete(); return __ptr; @@ -217,7 +217,7 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_POP_MACROS
diff --git a/third_party/llvm-project/libcxx/include/__memory_resource/pool_options.h b/third_party/llvm-project/libcxx/include/__memory_resource/pool_options.h index 11585a0..6ddd899 100644 --- a/third_party/llvm-project/libcxx/include/__memory_resource/pool_options.h +++ b/third_party/llvm-project/libcxx/include/__memory_resource/pool_options.h
@@ -16,7 +16,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -33,6 +33,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 #endif // _LIBCPP___MEMORY_RESOURCE_POOL_OPTIONS_H
diff --git a/third_party/llvm-project/libcxx/include/__memory_resource/synchronized_pool_resource.h b/third_party/llvm-project/libcxx/include/__memory_resource/synchronized_pool_resource.h index 1877147..b86ba06 100644 --- a/third_party/llvm-project/libcxx/include/__memory_resource/synchronized_pool_resource.h +++ b/third_party/llvm-project/libcxx/include/__memory_resource/synchronized_pool_resource.h
@@ -22,7 +22,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -89,6 +89,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 #endif // _LIBCPP___MEMORY_RESOURCE_SYNCHRONIZED_POOL_RESOURCE_H
diff --git a/third_party/llvm-project/libcxx/include/__memory_resource/unsynchronized_pool_resource.h b/third_party/llvm-project/libcxx/include/__memory_resource/unsynchronized_pool_resource.h index 91d38aa..26e4bdf 100644 --- a/third_party/llvm-project/libcxx/include/__memory_resource/unsynchronized_pool_resource.h +++ b/third_party/llvm-project/libcxx/include/__memory_resource/unsynchronized_pool_resource.h
@@ -19,7 +19,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -101,6 +101,6 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 #endif // _LIBCPP___MEMORY_RESOURCE_UNSYNCHRONIZED_POOL_RESOURCE_H
diff --git a/third_party/llvm-project/libcxx/include/__mutex/lock_guard.h b/third_party/llvm-project/libcxx/include/__mutex/lock_guard.h new file mode 100644 index 0000000..c075512 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__mutex/lock_guard.h
@@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// 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___MUTEX_LOCK_GUARD_H +#define _LIBCPP___MUTEX_LOCK_GUARD_H + +#include <__config> +#include <__mutex/tag_types.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#ifndef _LIBCPP_HAS_NO_THREADS + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Mutex> +class _LIBCPP_TEMPLATE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(scoped_lockable) lock_guard { +public: + typedef _Mutex mutex_type; + +private: + mutex_type& __m_; + +public: + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI explicit lock_guard(mutex_type& __m) + _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m)) + : __m_(__m) { + __m_.lock(); + } + + _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI lock_guard(mutex_type& __m, adopt_lock_t) + _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m)) + : __m_(__m) {} + _LIBCPP_HIDE_FROM_ABI ~lock_guard() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()) { __m_.unlock(); } + +private: + lock_guard(lock_guard const&) = delete; + lock_guard& operator=(lock_guard const&) = delete; +}; +_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(lock_guard); + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_HAS_NO_THREADS + +#endif // _LIBCPP___MUTEX_LOCK_GUARD_H
diff --git a/third_party/llvm-project/libcxx/include/__mutex/mutex.h b/third_party/llvm-project/libcxx/include/__mutex/mutex.h new file mode 100644 index 0000000..13def1e --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__mutex/mutex.h
@@ -0,0 +1,53 @@ +//===----------------------------------------------------------------------===// +// +// 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___MUTEX_MUTEX_H +#define _LIBCPP___MUTEX_MUTEX_H + +#include <__config> +#include <__threading_support> +#include <__type_traits/is_nothrow_default_constructible.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#ifndef _LIBCPP_HAS_NO_THREADS + +_LIBCPP_BEGIN_NAMESPACE_STD + +class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex { + __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER; + +public: + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR mutex() = default; + + mutex(const mutex&) = delete; + mutex& operator=(const mutex&) = delete; + +# if defined(_LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION) + ~mutex() = default; +# else + ~mutex() _NOEXCEPT; +# endif + + void lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability()); + bool try_lock() _NOEXCEPT _LIBCPP_THREAD_SAFETY_ANNOTATION(try_acquire_capability(true)); + void unlock() _NOEXCEPT _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()); + + typedef __libcpp_mutex_t* native_handle_type; + _LIBCPP_HIDE_FROM_ABI native_handle_type native_handle() { return &__m_; } +}; + +static_assert(is_nothrow_default_constructible<mutex>::value, "the default constructor for std::mutex must be nothrow"); + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_HAS_NO_THREADS + +#endif // _LIBCPP___MUTEX_MUTEX_H
diff --git a/third_party/llvm-project/libcxx/include/__mutex/tag_types.h b/third_party/llvm-project/libcxx/include/__mutex/tag_types.h new file mode 100644 index 0000000..02cf007 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__mutex/tag_types.h
@@ -0,0 +1,48 @@ +//===----------------------------------------------------------------------===// +// +// 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___MUTEX_TAG_TYPES_H +#define _LIBCPP___MUTEX_TAG_TYPES_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#ifndef _LIBCPP_HAS_NO_THREADS + +_LIBCPP_BEGIN_NAMESPACE_STD + +struct _LIBCPP_TYPE_VIS defer_lock_t { + explicit defer_lock_t() = default; +}; + +struct _LIBCPP_TYPE_VIS try_to_lock_t { + explicit try_to_lock_t() = default; +}; + +struct _LIBCPP_TYPE_VIS adopt_lock_t { + explicit adopt_lock_t() = default; +}; + +# if defined(_LIBCPP_BUILDING_LIBRARY) +extern _LIBCPP_EXPORTED_FROM_ABI const defer_lock_t defer_lock; +extern _LIBCPP_EXPORTED_FROM_ABI const try_to_lock_t try_to_lock; +extern _LIBCPP_EXPORTED_FROM_ABI const adopt_lock_t adopt_lock; +# elif !defined(_LIBCPP_CXX03_LANG) +/* inline */ constexpr defer_lock_t defer_lock = defer_lock_t(); +/* inline */ constexpr try_to_lock_t try_to_lock = try_to_lock_t(); +/* inline */ constexpr adopt_lock_t adopt_lock = adopt_lock_t(); +# endif + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_HAS_NO_THREADS + +#endif // _LIBCPP___MUTEX_TAG_TYPES_H
diff --git a/third_party/llvm-project/libcxx/include/__mutex/unique_lock.h b/third_party/llvm-project/libcxx/include/__mutex/unique_lock.h new file mode 100644 index 0000000..c27ce4b --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__mutex/unique_lock.h
@@ -0,0 +1,173 @@ +//===----------------------------------------------------------------------===// +// +// 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___MUTEX_UNIQUE_LOCK_H +#define _LIBCPP___MUTEX_UNIQUE_LOCK_H + +#include <__chrono/duration.h> +#include <__chrono/time_point.h> +#include <__config> +#include <__memory/addressof.h> +#include <__mutex/tag_types.h> +#include <__system_error/system_error.h> +#include <__utility/swap.h> +#include <cerrno> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +#ifndef _LIBCPP_HAS_NO_THREADS + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Mutex> +class _LIBCPP_TEMPLATE_VIS unique_lock { +public: + typedef _Mutex mutex_type; + +private: + mutex_type* __m_; + bool __owns_; + +public: + _LIBCPP_HIDE_FROM_ABI unique_lock() _NOEXCEPT : __m_(nullptr), __owns_(false) {} + _LIBCPP_HIDE_FROM_ABI explicit unique_lock(mutex_type& __m) : __m_(std::addressof(__m)), __owns_(true) { + __m_->lock(); + } + + _LIBCPP_HIDE_FROM_ABI unique_lock(mutex_type& __m, defer_lock_t) _NOEXCEPT + : __m_(std::addressof(__m)), + __owns_(false) {} + + _LIBCPP_HIDE_FROM_ABI unique_lock(mutex_type& __m, try_to_lock_t) + : __m_(std::addressof(__m)), __owns_(__m.try_lock()) {} + + _LIBCPP_HIDE_FROM_ABI unique_lock(mutex_type& __m, adopt_lock_t) : __m_(std::addressof(__m)), __owns_(true) {} + + template <class _Clock, class _Duration> + _LIBCPP_HIDE_FROM_ABI unique_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __t) + : __m_(std::addressof(__m)), __owns_(__m.try_lock_until(__t)) {} + + template <class _Rep, class _Period> + _LIBCPP_HIDE_FROM_ABI unique_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __d) + : __m_(std::addressof(__m)), __owns_(__m.try_lock_for(__d)) {} + + _LIBCPP_HIDE_FROM_ABI ~unique_lock() { + if (__owns_) + __m_->unlock(); + } + + unique_lock(unique_lock const&) = delete; + unique_lock& operator=(unique_lock const&) = delete; + + _LIBCPP_HIDE_FROM_ABI unique_lock(unique_lock&& __u) _NOEXCEPT : __m_(__u.__m_), __owns_(__u.__owns_) { + __u.__m_ = nullptr; + __u.__owns_ = false; + } + + _LIBCPP_HIDE_FROM_ABI unique_lock& operator=(unique_lock&& __u) _NOEXCEPT { + if (__owns_) + __m_->unlock(); + + __m_ = __u.__m_; + __owns_ = __u.__owns_; + __u.__m_ = nullptr; + __u.__owns_ = false; + return *this; + } + + void lock(); + bool try_lock(); + + template <class _Rep, class _Period> + bool try_lock_for(const chrono::duration<_Rep, _Period>& __d); + + template <class _Clock, class _Duration> + bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); + + void unlock(); + + _LIBCPP_HIDE_FROM_ABI void swap(unique_lock& __u) _NOEXCEPT { + std::swap(__m_, __u.__m_); + std::swap(__owns_, __u.__owns_); + } + + _LIBCPP_HIDE_FROM_ABI mutex_type* release() _NOEXCEPT { + mutex_type* __m = __m_; + __m_ = nullptr; + __owns_ = false; + return __m; + } + + _LIBCPP_HIDE_FROM_ABI bool owns_lock() const _NOEXCEPT { return __owns_; } + _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return __owns_; } + _LIBCPP_HIDE_FROM_ABI mutex_type* mutex() const _NOEXCEPT { return __m_; } +}; +_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(unique_lock); + +template <class _Mutex> +void unique_lock<_Mutex>::lock() { + if (__m_ == nullptr) + __throw_system_error(EPERM, "unique_lock::lock: references null mutex"); + if (__owns_) + __throw_system_error(EDEADLK, "unique_lock::lock: already locked"); + __m_->lock(); + __owns_ = true; +} + +template <class _Mutex> +bool unique_lock<_Mutex>::try_lock() { + if (__m_ == nullptr) + __throw_system_error(EPERM, "unique_lock::try_lock: references null mutex"); + if (__owns_) + __throw_system_error(EDEADLK, "unique_lock::try_lock: already locked"); + __owns_ = __m_->try_lock(); + return __owns_; +} + +template <class _Mutex> +template <class _Rep, class _Period> +bool unique_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __d) { + if (__m_ == nullptr) + __throw_system_error(EPERM, "unique_lock::try_lock_for: references null mutex"); + if (__owns_) + __throw_system_error(EDEADLK, "unique_lock::try_lock_for: already locked"); + __owns_ = __m_->try_lock_for(__d); + return __owns_; +} + +template <class _Mutex> +template <class _Clock, class _Duration> +bool unique_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) { + if (__m_ == nullptr) + __throw_system_error(EPERM, "unique_lock::try_lock_until: references null mutex"); + if (__owns_) + __throw_system_error(EDEADLK, "unique_lock::try_lock_until: already locked"); + __owns_ = __m_->try_lock_until(__t); + return __owns_; +} + +template <class _Mutex> +void unique_lock<_Mutex>::unlock() { + if (!__owns_) + __throw_system_error(EPERM, "unique_lock::unlock: not locked"); + __m_->unlock(); + __owns_ = false; +} + +template <class _Mutex> +inline _LIBCPP_HIDE_FROM_ABI void swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) _NOEXCEPT { + __x.swap(__y); +} + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP_HAS_NO_THREADS + +#endif // _LIBCPP___MUTEX_UNIQUE_LOCK_H
diff --git a/third_party/llvm-project/libcxx/include/__mutex_base b/third_party/llvm-project/libcxx/include/__mutex_base deleted file mode 100644 index 82d9fa6..0000000 --- a/third_party/llvm-project/libcxx/include/__mutex_base +++ /dev/null
@@ -1,523 +0,0 @@ -// -*- 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___MUTEX_BASE -#define _LIBCPP___MUTEX_BASE - -#include <__chrono/duration.h> -#include <__chrono/steady_clock.h> -#include <__chrono/system_clock.h> -#include <__chrono/time_point.h> -#include <__config> -#include <__threading_support> -#include <ratio> -#include <system_error> -#include <time.h> - -#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_HAS_NO_THREADS - -class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex -{ - __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER; - -public: - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR mutex() = default; - - mutex(const mutex&) = delete; - mutex& operator=(const mutex&) = delete; - -#if defined(_LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION) - ~mutex() = default; -#else - ~mutex() _NOEXCEPT; -#endif - - void lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability()); - bool try_lock() _NOEXCEPT _LIBCPP_THREAD_SAFETY_ANNOTATION(try_acquire_capability(true)); - void unlock() _NOEXCEPT _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()); - - typedef __libcpp_mutex_t* native_handle_type; - _LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;} -}; - -static_assert(is_nothrow_default_constructible<mutex>::value, - "the default constructor for std::mutex must be nothrow"); - -struct _LIBCPP_TYPE_VIS defer_lock_t { explicit defer_lock_t() = default; }; -struct _LIBCPP_TYPE_VIS try_to_lock_t { explicit try_to_lock_t() = default; }; -struct _LIBCPP_TYPE_VIS adopt_lock_t { explicit adopt_lock_t() = default; }; - -#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY) - -extern _LIBCPP_EXPORTED_FROM_ABI const defer_lock_t defer_lock; -extern _LIBCPP_EXPORTED_FROM_ABI const try_to_lock_t try_to_lock; -extern _LIBCPP_EXPORTED_FROM_ABI const adopt_lock_t adopt_lock; - -#else - -/* inline */ constexpr defer_lock_t defer_lock = defer_lock_t(); -/* inline */ constexpr try_to_lock_t try_to_lock = try_to_lock_t(); -/* inline */ constexpr adopt_lock_t adopt_lock = adopt_lock_t(); - -#endif - -template <class _Mutex> -class _LIBCPP_TEMPLATE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(scoped_lockable) -lock_guard -{ -public: - typedef _Mutex mutex_type; - -private: - mutex_type& __m_; -public: - - _LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY - explicit lock_guard(mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m)) - : __m_(__m) {__m_.lock();} - - _LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY - lock_guard(mutex_type& __m, adopt_lock_t) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m)) - : __m_(__m) {} - _LIBCPP_INLINE_VISIBILITY - ~lock_guard() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()) {__m_.unlock();} - -private: - lock_guard(lock_guard const&) = delete; - lock_guard& operator=(lock_guard const&) = delete; -}; -_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(lock_guard); - -template <class _Mutex> -class _LIBCPP_TEMPLATE_VIS unique_lock -{ -public: - typedef _Mutex mutex_type; - -private: - mutex_type* __m_; - bool __owns_; - -public: - _LIBCPP_INLINE_VISIBILITY - unique_lock() _NOEXCEPT : __m_(nullptr), __owns_(false) {} - _LIBCPP_INLINE_VISIBILITY - explicit unique_lock(mutex_type& __m) - : __m_(_VSTD::addressof(__m)), __owns_(true) {__m_->lock();} - _LIBCPP_INLINE_VISIBILITY - unique_lock(mutex_type& __m, defer_lock_t) _NOEXCEPT - : __m_(_VSTD::addressof(__m)), __owns_(false) {} - _LIBCPP_INLINE_VISIBILITY - unique_lock(mutex_type& __m, try_to_lock_t) - : __m_(_VSTD::addressof(__m)), __owns_(__m.try_lock()) {} - _LIBCPP_INLINE_VISIBILITY - unique_lock(mutex_type& __m, adopt_lock_t) - : __m_(_VSTD::addressof(__m)), __owns_(true) {} - template <class _Clock, class _Duration> - _LIBCPP_INLINE_VISIBILITY - unique_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __t) - : __m_(_VSTD::addressof(__m)), __owns_(__m.try_lock_until(__t)) {} - template <class _Rep, class _Period> - _LIBCPP_INLINE_VISIBILITY - unique_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __d) - : __m_(_VSTD::addressof(__m)), __owns_(__m.try_lock_for(__d)) {} - _LIBCPP_INLINE_VISIBILITY - ~unique_lock() - { - if (__owns_) - __m_->unlock(); - } - - unique_lock(unique_lock const&) = delete; - unique_lock& operator=(unique_lock const&) = delete; - - _LIBCPP_INLINE_VISIBILITY - unique_lock(unique_lock&& __u) _NOEXCEPT - : __m_(__u.__m_), __owns_(__u.__owns_) - {__u.__m_ = nullptr; __u.__owns_ = false;} - _LIBCPP_INLINE_VISIBILITY - unique_lock& operator=(unique_lock&& __u) _NOEXCEPT - { - if (__owns_) - __m_->unlock(); - __m_ = __u.__m_; - __owns_ = __u.__owns_; - __u.__m_ = nullptr; - __u.__owns_ = false; - return *this; - } - - void lock(); - bool try_lock(); - - template <class _Rep, class _Period> - bool try_lock_for(const chrono::duration<_Rep, _Period>& __d); - template <class _Clock, class _Duration> - bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); - - void unlock(); - - _LIBCPP_INLINE_VISIBILITY - void swap(unique_lock& __u) _NOEXCEPT - { - _VSTD::swap(__m_, __u.__m_); - _VSTD::swap(__owns_, __u.__owns_); - } - _LIBCPP_INLINE_VISIBILITY - mutex_type* release() _NOEXCEPT - { - mutex_type* __m = __m_; - __m_ = nullptr; - __owns_ = false; - return __m; - } - - _LIBCPP_INLINE_VISIBILITY - bool owns_lock() const _NOEXCEPT {return __owns_;} - _LIBCPP_INLINE_VISIBILITY - explicit operator bool() const _NOEXCEPT {return __owns_;} - _LIBCPP_INLINE_VISIBILITY - mutex_type* mutex() const _NOEXCEPT {return __m_;} -}; -_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(unique_lock); - -template <class _Mutex> -void -unique_lock<_Mutex>::lock() -{ - if (__m_ == nullptr) - __throw_system_error(EPERM, "unique_lock::lock: references null mutex"); - if (__owns_) - __throw_system_error(EDEADLK, "unique_lock::lock: already locked"); - __m_->lock(); - __owns_ = true; -} - -template <class _Mutex> -bool -unique_lock<_Mutex>::try_lock() -{ - if (__m_ == nullptr) - __throw_system_error(EPERM, "unique_lock::try_lock: references null mutex"); - if (__owns_) - __throw_system_error(EDEADLK, "unique_lock::try_lock: already locked"); - __owns_ = __m_->try_lock(); - return __owns_; -} - -template <class _Mutex> -template <class _Rep, class _Period> -bool -unique_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __d) -{ - if (__m_ == nullptr) - __throw_system_error(EPERM, "unique_lock::try_lock_for: references null mutex"); - if (__owns_) - __throw_system_error(EDEADLK, "unique_lock::try_lock_for: already locked"); - __owns_ = __m_->try_lock_for(__d); - return __owns_; -} - -template <class _Mutex> -template <class _Clock, class _Duration> -bool -unique_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) -{ - if (__m_ == nullptr) - __throw_system_error(EPERM, "unique_lock::try_lock_until: references null mutex"); - if (__owns_) - __throw_system_error(EDEADLK, "unique_lock::try_lock_until: already locked"); - __owns_ = __m_->try_lock_until(__t); - return __owns_; -} - -template <class _Mutex> -void -unique_lock<_Mutex>::unlock() -{ - if (!__owns_) - __throw_system_error(EPERM, "unique_lock::unlock: not locked"); - __m_->unlock(); - __owns_ = false; -} - -template <class _Mutex> -inline _LIBCPP_INLINE_VISIBILITY -void -swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) _NOEXCEPT - {__x.swap(__y);} - -//enum class cv_status -_LIBCPP_DECLARE_STRONG_ENUM(cv_status) -{ - no_timeout, - timeout -}; -_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(cv_status) - -class _LIBCPP_TYPE_VIS condition_variable -{ - __libcpp_condvar_t __cv_ = _LIBCPP_CONDVAR_INITIALIZER; -public: - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR condition_variable() _NOEXCEPT = default; - -#ifdef _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION - ~condition_variable() = default; -#else - ~condition_variable(); -#endif - - condition_variable(const condition_variable&) = delete; - condition_variable& operator=(const condition_variable&) = delete; - - void notify_one() _NOEXCEPT; - void notify_all() _NOEXCEPT; - - void wait(unique_lock<mutex>& __lk) _NOEXCEPT; - template <class _Predicate> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS - void wait(unique_lock<mutex>& __lk, _Predicate __pred); - - template <class _Clock, class _Duration> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS - cv_status - wait_until(unique_lock<mutex>& __lk, - const chrono::time_point<_Clock, _Duration>& __t); - - template <class _Clock, class _Duration, class _Predicate> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS - bool - wait_until(unique_lock<mutex>& __lk, - const chrono::time_point<_Clock, _Duration>& __t, - _Predicate __pred); - - template <class _Rep, class _Period> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS - cv_status - wait_for(unique_lock<mutex>& __lk, - const chrono::duration<_Rep, _Period>& __d); - - template <class _Rep, class _Period, class _Predicate> - bool - _LIBCPP_INLINE_VISIBILITY - wait_for(unique_lock<mutex>& __lk, - const chrono::duration<_Rep, _Period>& __d, - _Predicate __pred); - - typedef __libcpp_condvar_t* native_handle_type; - _LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__cv_;} - -private: - void __do_timed_wait(unique_lock<mutex>& __lk, - chrono::time_point<chrono::system_clock, chrono::nanoseconds>) _NOEXCEPT; -#if defined(_LIBCPP_HAS_COND_CLOCKWAIT) - void __do_timed_wait(unique_lock<mutex>& __lk, - chrono::time_point<chrono::steady_clock, chrono::nanoseconds>) _NOEXCEPT; -#endif - template <class _Clock> - void __do_timed_wait(unique_lock<mutex>& __lk, - chrono::time_point<_Clock, chrono::nanoseconds>) _NOEXCEPT; -}; -#endif // !_LIBCPP_HAS_NO_THREADS - -template <class _Rep, class _Period> -inline _LIBCPP_INLINE_VISIBILITY -__enable_if_t<is_floating_point<_Rep>::value, chrono::nanoseconds> -__safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d) -{ - using namespace chrono; - using __ratio = ratio_divide<_Period, nano>; - using __ns_rep = nanoseconds::rep; - _Rep __result_float = __d.count() * __ratio::num / __ratio::den; - - _Rep __result_max = numeric_limits<__ns_rep>::max(); - if (__result_float >= __result_max) { - return nanoseconds::max(); - } - - _Rep __result_min = numeric_limits<__ns_rep>::min(); - if (__result_float <= __result_min) { - return nanoseconds::min(); - } - - return nanoseconds(static_cast<__ns_rep>(__result_float)); -} - -template <class _Rep, class _Period> -inline _LIBCPP_INLINE_VISIBILITY -__enable_if_t<!is_floating_point<_Rep>::value, chrono::nanoseconds> -__safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d) -{ - using namespace chrono; - if (__d.count() == 0) { - return nanoseconds(0); - } - - using __ratio = ratio_divide<_Period, nano>; - using __ns_rep = nanoseconds::rep; - __ns_rep __result_max = numeric_limits<__ns_rep>::max(); - if (__d.count() > 0 && __d.count() > __result_max / __ratio::num) { - return nanoseconds::max(); - } - - __ns_rep __result_min = numeric_limits<__ns_rep>::min(); - if (__d.count() < 0 && __d.count() < __result_min / __ratio::num) { - return nanoseconds::min(); - } - - __ns_rep __result = __d.count() * __ratio::num / __ratio::den; - if (__result == 0) { - return nanoseconds(1); - } - - return nanoseconds(__result); -} - -#ifndef _LIBCPP_HAS_NO_THREADS -template <class _Predicate> -void -condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred) -{ - while (!__pred()) - wait(__lk); -} - -template <class _Clock, class _Duration> -cv_status -condition_variable::wait_until(unique_lock<mutex>& __lk, - const chrono::time_point<_Clock, _Duration>& __t) -{ - using namespace chrono; - using __clock_tp_ns = time_point<_Clock, nanoseconds>; - - typename _Clock::time_point __now = _Clock::now(); - if (__t <= __now) - return cv_status::timeout; - - __clock_tp_ns __t_ns = __clock_tp_ns(_VSTD::__safe_nanosecond_cast(__t.time_since_epoch())); - - __do_timed_wait(__lk, __t_ns); - return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout; -} - -template <class _Clock, class _Duration, class _Predicate> -bool -condition_variable::wait_until(unique_lock<mutex>& __lk, - const chrono::time_point<_Clock, _Duration>& __t, - _Predicate __pred) -{ - while (!__pred()) - { - if (wait_until(__lk, __t) == cv_status::timeout) - return __pred(); - } - return true; -} - -template <class _Rep, class _Period> -cv_status -condition_variable::wait_for(unique_lock<mutex>& __lk, - const chrono::duration<_Rep, _Period>& __d) -{ - using namespace chrono; - if (__d <= __d.zero()) - return cv_status::timeout; - using __ns_rep = nanoseconds::rep; - steady_clock::time_point __c_now = steady_clock::now(); - -#if defined(_LIBCPP_HAS_COND_CLOCKWAIT) - using __clock_tp_ns = time_point<steady_clock, nanoseconds>; - __ns_rep __now_count_ns = _VSTD::__safe_nanosecond_cast(__c_now.time_since_epoch()).count(); -#else - using __clock_tp_ns = time_point<system_clock, nanoseconds>; - __ns_rep __now_count_ns = _VSTD::__safe_nanosecond_cast(system_clock::now().time_since_epoch()).count(); -#endif - - __ns_rep __d_ns_count = _VSTD::__safe_nanosecond_cast(__d).count(); - - if (__now_count_ns > numeric_limits<__ns_rep>::max() - __d_ns_count) { - __do_timed_wait(__lk, __clock_tp_ns::max()); - } else { - __do_timed_wait(__lk, __clock_tp_ns(nanoseconds(__now_count_ns + __d_ns_count))); - } - - return steady_clock::now() - __c_now < __d ? cv_status::no_timeout : - cv_status::timeout; -} - -template <class _Rep, class _Period, class _Predicate> -inline -bool -condition_variable::wait_for(unique_lock<mutex>& __lk, - const chrono::duration<_Rep, _Period>& __d, - _Predicate __pred) -{ - return wait_until(__lk, chrono::steady_clock::now() + __d, - _VSTD::move(__pred)); -} - -#if defined(_LIBCPP_HAS_COND_CLOCKWAIT) -inline -void -condition_variable::__do_timed_wait(unique_lock<mutex>& __lk, - chrono::time_point<chrono::steady_clock, chrono::nanoseconds> __tp) _NOEXCEPT -{ - using namespace chrono; - if (!__lk.owns_lock()) - __throw_system_error(EPERM, - "condition_variable::timed wait: mutex not locked"); - nanoseconds __d = __tp.time_since_epoch(); - timespec __ts; - seconds __s = duration_cast<seconds>(__d); - using __ts_sec = decltype(__ts.tv_sec); - const __ts_sec __ts_sec_max = numeric_limits<__ts_sec>::max(); - if (__s.count() < __ts_sec_max) - { - __ts.tv_sec = static_cast<__ts_sec>(__s.count()); - __ts.tv_nsec = (__d - __s).count(); - } - else - { - __ts.tv_sec = __ts_sec_max; - __ts.tv_nsec = giga::num - 1; - } - int __ec = pthread_cond_clockwait(&__cv_, __lk.mutex()->native_handle(), CLOCK_MONOTONIC, &__ts); - if (__ec != 0 && __ec != ETIMEDOUT) - __throw_system_error(__ec, "condition_variable timed_wait failed"); -} -#endif // _LIBCPP_HAS_COND_CLOCKWAIT - -template <class _Clock> -inline -void -condition_variable::__do_timed_wait(unique_lock<mutex>& __lk, - chrono::time_point<_Clock, chrono::nanoseconds> __tp) _NOEXCEPT -{ - wait_for(__lk, __tp - _Clock::now()); -} - -#endif // !_LIBCPP_HAS_NO_THREADS - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___MUTEX_BASE
diff --git a/third_party/llvm-project/libcxx/include/__node_handle b/third_party/llvm-project/libcxx/include/__node_handle index bc49272..d9c2374 100644 --- a/third_party/llvm-project/libcxx/include/__node_handle +++ b/third_party/llvm-project/libcxx/include/__node_handle
@@ -70,7 +70,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 // Specialized in __tree & __hash_table for their _NodeType. template <class _NodeType, class _Alloc> @@ -247,7 +247,7 @@ _NodeType node; }; -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__numeric/accumulate.h b/third_party/llvm-project/libcxx/include/__numeric/accumulate.h index 81fc0c2..823d501 100644 --- a/third_party/llvm-project/libcxx/include/__numeric/accumulate.h +++ b/third_party/llvm-project/libcxx/include/__numeric/accumulate.h
@@ -25,7 +25,7 @@ accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) { for (; __first != __last; ++__first) -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 __init = _VSTD::move(__init) + *__first; #else __init = __init + *__first; @@ -39,7 +39,7 @@ accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op) { for (; __first != __last; ++__first) -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 __init = __binary_op(_VSTD::move(__init), *__first); #else __init = __binary_op(__init, *__first);
diff --git a/third_party/llvm-project/libcxx/include/__numeric/adjacent_difference.h b/third_party/llvm-project/libcxx/include/__numeric/adjacent_difference.h index 57e2f5b..b3519fd 100644 --- a/third_party/llvm-project/libcxx/include/__numeric/adjacent_difference.h +++ b/third_party/llvm-project/libcxx/include/__numeric/adjacent_difference.h
@@ -32,7 +32,7 @@ for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) { typename iterator_traits<_InputIterator>::value_type __val(*__first); -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 *__result = __val - _VSTD::move(__acc); #else *__result = __val - __acc; @@ -56,7 +56,7 @@ for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) { typename iterator_traits<_InputIterator>::value_type __val(*__first); -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 *__result = __binary_op(__val, _VSTD::move(__acc)); #else *__result = __binary_op(__val, __acc);
diff --git a/third_party/llvm-project/libcxx/include/__numeric/exclusive_scan.h b/third_party/llvm-project/libcxx/include/__numeric/exclusive_scan.h index d02e126..676ff70 100644 --- a/third_party/llvm-project/libcxx/include/__numeric/exclusive_scan.h +++ b/third_party/llvm-project/libcxx/include/__numeric/exclusive_scan.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator @@ -46,7 +46,7 @@ return _VSTD::exclusive_scan(__first, __last, __result, __init, _VSTD::plus<>()); } -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__numeric/gcd_lcm.h b/third_party/llvm-project/libcxx/include/__numeric/gcd_lcm.h index 5a3f81b..7139a7e 100644 --- a/third_party/llvm-project/libcxx/include/__numeric/gcd_lcm.h +++ b/third_party/llvm-project/libcxx/include/__numeric/gcd_lcm.h
@@ -28,7 +28,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value> struct __ct_abs;
diff --git a/third_party/llvm-project/libcxx/include/__numeric/inclusive_scan.h b/third_party/llvm-project/libcxx/include/__numeric/inclusive_scan.h index e5bf5ac..bd96344 100644 --- a/third_party/llvm-project/libcxx/include/__numeric/inclusive_scan.h +++ b/third_party/llvm-project/libcxx/include/__numeric/inclusive_scan.h
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _OutputIterator @@ -53,7 +53,7 @@ return _VSTD::inclusive_scan(__first, __last, __result, _VSTD::plus<>()); } -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__numeric/inner_product.h b/third_party/llvm-project/libcxx/include/__numeric/inner_product.h index e3d68c0..b360200 100644 --- a/third_party/llvm-project/libcxx/include/__numeric/inner_product.h +++ b/third_party/llvm-project/libcxx/include/__numeric/inner_product.h
@@ -25,7 +25,7 @@ inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) { for (; __first1 != __last1; ++__first1, (void) ++__first2) -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 __init = _VSTD::move(__init) + *__first1 * *__first2; #else __init = __init + *__first1 * *__first2; @@ -40,7 +40,7 @@ _Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2) { for (; __first1 != __last1; ++__first1, (void) ++__first2) -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 __init = __binary_op1(_VSTD::move(__init), __binary_op2(*__first1, *__first2)); #else __init = __binary_op1(__init, __binary_op2(*__first1, *__first2));
diff --git a/third_party/llvm-project/libcxx/include/__numeric/midpoint.h b/third_party/llvm-project/libcxx/include/__numeric/midpoint.h index bac3642..5325f5e 100644 --- a/third_party/llvm-project/libcxx/include/__numeric/midpoint.h +++ b/third_party/llvm-project/libcxx/include/__numeric/midpoint.h
@@ -33,7 +33,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Tp> _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t<is_integral_v<_Tp> && !is_same_v<bool, _Tp> && !is_null_pointer_v<_Tp>, _Tp> @@ -86,7 +86,7 @@ __a/2 + __b/2; // otherwise correctly rounded } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__numeric/partial_sum.h b/third_party/llvm-project/libcxx/include/__numeric/partial_sum.h index 97cca58..94f65d7 100644 --- a/third_party/llvm-project/libcxx/include/__numeric/partial_sum.h +++ b/third_party/llvm-project/libcxx/include/__numeric/partial_sum.h
@@ -31,7 +31,7 @@ *__result = __t; for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) { -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 __t = _VSTD::move(__t) + *__first; #else __t = __t + *__first; @@ -54,7 +54,7 @@ *__result = __t; for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) { -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 __t = __binary_op(_VSTD::move(__t), *__first); #else __t = __binary_op(__t, *__first);
diff --git a/third_party/llvm-project/libcxx/include/__numeric/reduce.h b/third_party/llvm-project/libcxx/include/__numeric/reduce.h index b64df05..9e710fc 100644 --- a/third_party/llvm-project/libcxx/include/__numeric/reduce.h +++ b/third_party/llvm-project/libcxx/include/__numeric/reduce.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _InputIterator, class _Tp, class _BinaryOp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b) {
diff --git a/third_party/llvm-project/libcxx/include/__numeric/transform_exclusive_scan.h b/third_party/llvm-project/libcxx/include/__numeric/transform_exclusive_scan.h index afbcdb8..3d5574c 100644 --- a/third_party/llvm-project/libcxx/include/__numeric/transform_exclusive_scan.h +++ b/third_party/llvm-project/libcxx/include/__numeric/transform_exclusive_scan.h
@@ -18,7 +18,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp, class _UnaryOp> @@ -42,7 +42,7 @@ return __result; } -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__numeric/transform_inclusive_scan.h b/third_party/llvm-project/libcxx/include/__numeric/transform_inclusive_scan.h index c050041..ee91689 100644 --- a/third_party/llvm-project/libcxx/include/__numeric/transform_inclusive_scan.h +++ b/third_party/llvm-project/libcxx/include/__numeric/transform_inclusive_scan.h
@@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp, class _UnaryOp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 @@ -51,7 +51,7 @@ return __result; } -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__numeric/transform_reduce.h b/third_party/llvm-project/libcxx/include/__numeric/transform_reduce.h index d997521..39ec266 100644 --- a/third_party/llvm-project/libcxx/include/__numeric/transform_reduce.h +++ b/third_party/llvm-project/libcxx/include/__numeric/transform_reduce.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _InputIterator, class _Tp, class _BinaryOp, class _UnaryOp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp transform_reduce(_InputIterator __first, _InputIterator __last, _Tp __init,
diff --git a/third_party/llvm-project/libcxx/include/__random/clamp_to_integral.h b/third_party/llvm-project/libcxx/include/__random/clamp_to_integral.h index 7d44ff9..c67d76d 100644 --- a/third_party/llvm-project/libcxx/include/__random/clamp_to_integral.h +++ b/third_party/llvm-project/libcxx/include/__random/clamp_to_integral.h
@@ -12,7 +12,6 @@ #include <__config> #include <cmath> #include <limits> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -44,8 +43,8 @@ _LIBCPP_INLINE_VISIBILITY _IntT __clamp_to_integral(_RealT __r) _NOEXCEPT { using _Lim = numeric_limits<_IntT>; - const _IntT _MaxVal = __max_representable_int_for_float<_IntT, _RealT>(); - if (__r >= ::nextafter(static_cast<_RealT>(_MaxVal), INFINITY)) { + const _IntT __max_val = __max_representable_int_for_float<_IntT, _RealT>(); + if (__r >= ::nextafter(static_cast<_RealT>(__max_val), INFINITY)) { return _Lim::max(); } else if (__r <= _Lim::lowest()) { return _Lim::min();
diff --git a/third_party/llvm-project/libcxx/include/__random/discard_block_engine.h b/third_party/llvm-project/libcxx/include/__random/discard_block_engine.h index db33623..077f158 100644 --- a/third_party/llvm-project/libcxx/include/__random/discard_block_engine.h +++ b/third_party/llvm-project/libcxx/include/__random/discard_block_engine.h
@@ -11,10 +11,12 @@ #include <__config> #include <__random/is_seed_sequence.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/is_convertible.h> #include <__utility/move.h> +#include <cstddef> #include <iosfwd> #include <limits> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__random/generate_canonical.h b/third_party/llvm-project/libcxx/include/__random/generate_canonical.h index 5fada6d..5f0aa6f 100644 --- a/third_party/llvm-project/libcxx/include/__random/generate_canonical.h +++ b/third_party/llvm-project/libcxx/include/__random/generate_canonical.h
@@ -30,20 +30,20 @@ _LIBCPP_HIDE_FROM_ABI _RealType generate_canonical(_URNG& __g) { - const size_t _Dt = numeric_limits<_RealType>::digits; - const size_t __b = _Dt < __bits ? _Dt : __bits; + const size_t __dt = numeric_limits<_RealType>::digits; + const size_t __b = __dt < __bits ? __dt : __bits; #ifdef _LIBCPP_CXX03_LANG - const size_t __logR = __log2<uint64_t, _URNG::_Max - _URNG::_Min + uint64_t(1)>::value; + const size_t __log_r = __log2<uint64_t, _URNG::_Max - _URNG::_Min + uint64_t(1)>::value; #else - const size_t __logR = __log2<uint64_t, _URNG::max() - _URNG::min() + uint64_t(1)>::value; + const size_t __log_r = __log2<uint64_t, _URNG::max() - _URNG::min() + uint64_t(1)>::value; #endif - const size_t __k = __b / __logR + (__b % __logR != 0) + (__b == 0); - const _RealType _Rp = static_cast<_RealType>(_URNG::max() - _URNG::min()) + _RealType(1); - _RealType __base = _Rp; - _RealType _Sp = __g() - _URNG::min(); - for (size_t __i = 1; __i < __k; ++__i, __base *= _Rp) - _Sp += (__g() - _URNG::min()) * __base; - return _Sp / __base; + const size_t __k = __b / __log_r + (__b % __log_r != 0) + (__b == 0); + const _RealType __rp = static_cast<_RealType>(_URNG::max() - _URNG::min()) + _RealType(1); + _RealType __base = __rp; + _RealType __sp = __g() - _URNG::min(); + for (size_t __i = 1; __i < __k; ++__i, __base *= __rp) + __sp += (__g() - _URNG::min()) * __base; + return __sp / __base; } _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__random/independent_bits_engine.h b/third_party/llvm-project/libcxx/include/__random/independent_bits_engine.h index 151492a..2cd4096 100644 --- a/third_party/llvm-project/libcxx/include/__random/independent_bits_engine.h +++ b/third_party/llvm-project/libcxx/include/__random/independent_bits_engine.h
@@ -12,10 +12,13 @@ #include <__config> #include <__random/is_seed_sequence.h> #include <__random/log2.h> +#include <__type_traits/conditional.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/is_convertible.h> #include <__utility/move.h> +#include <cstddef> #include <iosfwd> #include <limits> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -196,7 +199,7 @@ _UIntType independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type) { - result_type _Sp = 0; + result_type __sp = 0; for (size_t __k = 0; __k < __n0; ++__k) { _Engine_result_type __u; @@ -204,7 +207,7 @@ { __u = __e_() - _Engine::min(); } while (__u >= __y0); - _Sp = static_cast<result_type>(__lshift<__w0>(_Sp) + (__u & __mask0)); + __sp = static_cast<result_type>(__lshift<__w0>(__sp) + (__u & __mask0)); } for (size_t __k = __n0; __k < __n; ++__k) { @@ -213,9 +216,9 @@ { __u = __e_() - _Engine::min(); } while (__u >= __y1); - _Sp = static_cast<result_type>(__lshift<__w0+1>(_Sp) + (__u & __mask1)); + __sp = static_cast<result_type>(__lshift<__w0+1>(__sp) + (__u & __mask1)); } - return _Sp; + return __sp; } template<class _Eng, size_t _Wp, class _UInt>
diff --git a/third_party/llvm-project/libcxx/include/__random/is_seed_sequence.h b/third_party/llvm-project/libcxx/include/__random/is_seed_sequence.h index 3c82b27..06621c3 100644 --- a/third_party/llvm-project/libcxx/include/__random/is_seed_sequence.h +++ b/third_party/llvm-project/libcxx/include/__random/is_seed_sequence.h
@@ -10,7 +10,9 @@ #define _LIBCPP___RANDOM_IS_SEED_SEQUENCE_H #include <__config> -#include <type_traits> +#include <__type_traits/is_convertible.h> +#include <__type_traits/is_same.h> +#include <__type_traits/remove_cv.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__random/is_valid.h b/third_party/llvm-project/libcxx/include/__random/is_valid.h index 1d65de0..113452b 100644 --- a/third_party/llvm-project/libcxx/include/__random/is_valid.h +++ b/third_party/llvm-project/libcxx/include/__random/is_valid.h
@@ -10,8 +10,12 @@ #define _LIBCPP___RANDOM_IS_VALID_H #include <__config> +#include <__type_traits/enable_if.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_same.h> +#include <__type_traits/is_unsigned.h> +#include <__utility/declval.h> #include <cstdint> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__random/linear_congruential_engine.h b/third_party/llvm-project/libcxx/include/__random/linear_congruential_engine.h index 0d91f14..aa24a06 100644 --- a/third_party/llvm-project/libcxx/include/__random/linear_congruential_engine.h +++ b/third_party/llvm-project/libcxx/include/__random/linear_congruential_engine.h
@@ -11,9 +11,11 @@ #include <__config> #include <__random/is_seed_sequence.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_unsigned.h> #include <cstdint> #include <iosfwd> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__random/log2.h b/third_party/llvm-project/libcxx/include/__random/log2.h index 72bf075..4ccd1dd 100644 --- a/third_party/llvm-project/libcxx/include/__random/log2.h +++ b/third_party/llvm-project/libcxx/include/__random/log2.h
@@ -10,8 +10,8 @@ #define _LIBCPP___RANDOM_LOG2_H #include <__config> +#include <__type_traits/conditional.h> #include <cstddef> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__random/mersenne_twister_engine.h b/third_party/llvm-project/libcxx/include/__random/mersenne_twister_engine.h index 3a58e31..89df825 100644 --- a/third_party/llvm-project/libcxx/include/__random/mersenne_twister_engine.h +++ b/third_party/llvm-project/libcxx/include/__random/mersenne_twister_engine.h
@@ -17,7 +17,6 @@ #include <cstdint> #include <iosfwd> #include <limits> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -403,9 +402,9 @@ const size_t __j = (__i_ + 1) % __n; const result_type __mask = __r == _Dt ? result_type(~0) : (result_type(1) << __r) - result_type(1); - const result_type _Yp = (__x_[__i_] & ~__mask) | (__x_[__j] & __mask); + const result_type __yp = (__x_[__i_] & ~__mask) | (__x_[__j] & __mask); const size_t __k = (__i_ + __m) % __n; - __x_[__i_] = __x_[__k] ^ __rshift<1>(_Yp) ^ (__a * (_Yp & 1)); + __x_[__i_] = __x_[__k] ^ __rshift<1>(__yp) ^ (__a * (__yp & 1)); result_type __z = __x_[__i_] ^ (__rshift<__u>(__x_[__i_]) & __d); __i_ = __j; __z ^= __lshift<__s>(__z) & __b;
diff --git a/third_party/llvm-project/libcxx/include/__random/normal_distribution.h b/third_party/llvm-project/libcxx/include/__random/normal_distribution.h index b2ed47e..93f3d1f 100644 --- a/third_party/llvm-project/libcxx/include/__random/normal_distribution.h +++ b/third_party/llvm-project/libcxx/include/__random/normal_distribution.h
@@ -133,30 +133,30 @@ normal_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) { static_assert(__libcpp_random_is_valid_urng<_URNG>::value, ""); - result_type _Up; + result_type __up; if (__v_hot_) { __v_hot_ = false; - _Up = __v_; + __up = __v_; } else { - uniform_real_distribution<result_type> _Uni(-1, 1); + uniform_real_distribution<result_type> __uni(-1, 1); result_type __u; result_type __v; result_type __s; do { - __u = _Uni(__g); - __v = _Uni(__g); + __u = __uni(__g); + __v = __uni(__g); __s = __u * __u + __v * __v; } while (__s > 1 || __s == 0); - result_type _Fp = _VSTD::sqrt(-2 * _VSTD::log(__s) / __s); - __v_ = __v * _Fp; + result_type __fp = _VSTD::sqrt(-2 * _VSTD::log(__s) / __s); + __v_ = __v * __fp; __v_hot_ = true; - _Up = __u * _Fp; + __up = __u * __fp; } - return _Up * __p.stddev() + __p.mean(); + return __up * __p.stddev() + __p.mean(); } template <class _CharT, class _Traits, class _RT> @@ -189,16 +189,16 @@ __is.flags(_Istream::dec | _Istream::skipws); result_type __mean; result_type __stddev; - result_type _Vp = 0; - bool _V_hot = false; - __is >> __mean >> __stddev >> _V_hot; - if (_V_hot) - __is >> _Vp; + result_type __vp = 0; + bool __v_hot = false; + __is >> __mean >> __stddev >> __v_hot; + if (__v_hot) + __is >> __vp; if (!__is.fail()) { __x.param(param_type(__mean, __stddev)); - __x.__v_hot_ = _V_hot; - __x.__v_ = _Vp; + __x.__v_hot_ = __v_hot; + __x.__v_ = __vp; } return __is; }
diff --git a/third_party/llvm-project/libcxx/include/__random/piecewise_linear_distribution.h b/third_party/llvm-project/libcxx/include/__random/piecewise_linear_distribution.h index fc2eb47..0430b24 100644 --- a/third_party/llvm-project/libcxx/include/__random/piecewise_linear_distribution.h +++ b/third_party/llvm-project/libcxx/include/__random/piecewise_linear_distribution.h
@@ -188,23 +188,23 @@ piecewise_linear_distribution<_RealType>::param_type::__init() { __areas_.assign(__densities_.size() - 1, result_type()); - result_type _Sp = 0; + result_type __sp = 0; for (size_t __i = 0; __i < __areas_.size(); ++__i) { __areas_[__i] = (__densities_[__i+1] + __densities_[__i]) * (__b_[__i+1] - __b_[__i]) * .5; - _Sp += __areas_[__i]; + __sp += __areas_[__i]; } for (size_t __i = __areas_.size(); __i > 1;) { --__i; - __areas_[__i] = __areas_[__i-1] / _Sp; + __areas_[__i] = __areas_[__i-1] / __sp; } __areas_[0] = 0; for (size_t __i = 1; __i < __areas_.size(); ++__i) __areas_[__i] += __areas_[__i-1]; for (size_t __i = 0; __i < __densities_.size(); ++__i) - __densities_[__i] /= _Sp; + __densities_[__i] /= __sp; } template<class _RealType>
diff --git a/third_party/llvm-project/libcxx/include/__random/poisson_distribution.h b/third_party/llvm-project/libcxx/include/__random/poisson_distribution.h index 334c610..2b39937 100644 --- a/third_party/llvm-project/libcxx/include/__random/poisson_distribution.h +++ b/third_party/llvm-project/libcxx/include/__random/poisson_distribution.h
@@ -144,12 +144,12 @@ __d_ = 6 * __mean_ * __mean_; __l_ = _VSTD::trunc(__mean_ - 1.1484); __omega_ = .3989423 / __s_; - double __b1_ = .4166667E-1 / __mean_; - double __b2_ = .3 * __b1_ * __b1_; - __c3_ = .1428571 * __b1_ * __b2_; - __c2_ = __b2_ - 15. * __c3_; - __c1_ = __b1_ - 6. * __b2_ + 45. * __c3_; - __c0_ = 1. - __b1_ + 3. * __b2_ - 15. * __c3_; + double __b1 = .4166667E-1 / __mean_; + double __b2 = .3 * __b1 * __b1; + __c3_ = .1428571 * __b1 * __b2; + __c2_ = __b2 - 15. * __c3_; + __c1_ = __b1 - 6. * __b2 + 45. * __c3_; + __c0_ = 1. - __b1 + 3. * __b2 - 15. * __c3_; __c_ = .1069 / __mean_; } }
diff --git a/third_party/llvm-project/libcxx/include/__random/seed_seq.h b/third_party/llvm-project/libcxx/include/__random/seed_seq.h index 330537f..5c40d15 100644 --- a/third_party/llvm-project/libcxx/include/__random/seed_seq.h +++ b/third_party/llvm-project/libcxx/include/__random/seed_seq.h
@@ -13,6 +13,7 @@ #include <__algorithm/fill.h> #include <__algorithm/max.h> #include <__config> +#include <cstdint> #include <initializer_list> #include <vector>
diff --git a/third_party/llvm-project/libcxx/include/__random/shuffle_order_engine.h b/third_party/llvm-project/libcxx/include/__random/shuffle_order_engine.h index 4a27289..e07f230 100644 --- a/third_party/llvm-project/libcxx/include/__random/shuffle_order_engine.h +++ b/third_party/llvm-project/libcxx/include/__random/shuffle_order_engine.h
@@ -12,10 +12,13 @@ #include <__algorithm/equal.h> #include <__config> #include <__random/is_seed_sequence.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_convertible.h> #include <__utility/move.h> +#include <cstddef> #include <cstdint> #include <iosfwd> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -201,10 +204,10 @@ _LIBCPP_INLINE_VISIBILITY result_type __evalf() { - const double _Fp = __d == 0 ? + const double __fp = __d == 0 ? __n / (2. * 0x8000000000000000ull) : __n / (double)__d; - const size_t __j = static_cast<size_t>(_Fp * (__y_ - _Min)); + const size_t __j = static_cast<size_t>(__fp * (__y_ - _Min)); __y_ = __v_[__j]; __v_[__j] = __e_(); return __y_; @@ -262,16 +265,16 @@ typedef basic_istream<_CharT, _Traits> _Istream; __is.flags(_Istream::dec | _Istream::skipws); _Eng __e; - result_type _Vp[_Kp+1]; + result_type __vp[_Kp+1]; __is >> __e; for (size_t __i = 0; __i < _Kp+1; ++__i) - __is >> _Vp[__i]; + __is >> __vp[__i]; if (!__is.fail()) { __x.__e_ = __e; for (size_t __i = 0; __i < _Kp; ++__i) - __x.__v_[__i] = _Vp[__i]; - __x.__y_ = _Vp[_Kp]; + __x.__v_[__i] = __vp[__i]; + __x.__y_ = __vp[_Kp]; } return __is; }
diff --git a/third_party/llvm-project/libcxx/include/__random/subtract_with_carry_engine.h b/third_party/llvm-project/libcxx/include/__random/subtract_with_carry_engine.h index b25ca84..9294cc2 100644 --- a/third_party/llvm-project/libcxx/include/__random/subtract_with_carry_engine.h +++ b/third_party/llvm-project/libcxx/include/__random/subtract_with_carry_engine.h
@@ -18,7 +18,6 @@ #include <cstdint> #include <iosfwd> #include <limits> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__random/uniform_int_distribution.h b/third_party/llvm-project/libcxx/include/__random/uniform_int_distribution.h index b7db8a3..5415876 100644 --- a/third_party/llvm-project/libcxx/include/__random/uniform_int_distribution.h +++ b/third_party/llvm-project/libcxx/include/__random/uniform_int_distribution.h
@@ -9,15 +9,16 @@ #ifndef _LIBCPP___RANDOM_UNIFORM_INT_DISTRIBUTION_H #define _LIBCPP___RANDOM_UNIFORM_INT_DISTRIBUTION_H +#include <__bit/countl.h> #include <__config> #include <__random/is_valid.h> #include <__random/log2.h> -#include <bit> +#include <__type_traits/conditional.h> +#include <__type_traits/make_unsigned.h> #include <cstddef> #include <cstdint> #include <iosfwd> #include <limits> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -120,8 +121,8 @@ _UIntType __independent_bits_engine<_Engine, _UIntType>::__eval(true_type) { - const size_t _WRt = numeric_limits<result_type>::digits; - result_type _Sp = 0; + const size_t __w_rt = numeric_limits<result_type>::digits; + result_type __sp = 0; for (size_t __k = 0; __k < __n0_; ++__k) { _Engine_result_type __u; @@ -129,11 +130,11 @@ { __u = __e_() - _Engine::min(); } while (__u >= __y0_); - if (__w0_ < _WRt) - _Sp <<= __w0_; + if (__w0_ < __w_rt) + __sp <<= __w0_; else - _Sp = 0; - _Sp += __u & __mask0_; + __sp = 0; + __sp += __u & __mask0_; } for (size_t __k = __n0_; __k < __n_; ++__k) { @@ -142,13 +143,13 @@ { __u = __e_() - _Engine::min(); } while (__u >= __y1_); - if (__w0_ < _WRt - 1) - _Sp <<= __w0_ + 1; + if (__w0_ < __w_rt - 1) + __sp <<= __w0_ + 1; else - _Sp = 0; - _Sp += __u & __mask1_; + __sp = 0; + __sp += __u & __mask1_; } - return _Sp; + return __sp; } template<class _IntType = int> @@ -234,22 +235,22 @@ static_assert(__libcpp_random_is_valid_urng<_URNG>::value, ""); typedef __conditional_t<sizeof(result_type) <= sizeof(uint32_t), uint32_t, __make_unsigned_t<result_type> > _UIntType; - const _UIntType _Rp = _UIntType(__p.b()) - _UIntType(__p.a()) + _UIntType(1); - if (_Rp == 1) + const _UIntType __rp = _UIntType(__p.b()) - _UIntType(__p.a()) + _UIntType(1); + if (__rp == 1) return __p.a(); - const size_t _Dt = numeric_limits<_UIntType>::digits; + const size_t __dt = numeric_limits<_UIntType>::digits; typedef __independent_bits_engine<_URNG, _UIntType> _Eng; - if (_Rp == 0) - return static_cast<result_type>(_Eng(__g, _Dt)()); - size_t __w = _Dt - std::__countl_zero(_Rp) - 1; - if ((_Rp & (numeric_limits<_UIntType>::max() >> (_Dt - __w))) != 0) + if (__rp == 0) + return static_cast<result_type>(_Eng(__g, __dt)()); + size_t __w = __dt - std::__countl_zero(__rp) - 1; + if ((__rp & (numeric_limits<_UIntType>::max() >> (__dt - __w))) != 0) ++__w; _Eng __e(__g, __w); _UIntType __u; do { __u = __e(); - } while (__u >= _Rp); + } while (__u >= __rp); return static_cast<result_type>(__u + __p.a()); }
diff --git a/third_party/llvm-project/libcxx/include/__random/uniform_random_bit_generator.h b/third_party/llvm-project/libcxx/include/__random/uniform_random_bit_generator.h index 84a30b0..ddb3158 100644 --- a/third_party/llvm-project/libcxx/include/__random/uniform_random_bit_generator.h +++ b/third_party/llvm-project/libcxx/include/__random/uniform_random_bit_generator.h
@@ -13,7 +13,8 @@ #include <__concepts/invocable.h> #include <__concepts/same_as.h> #include <__config> -#include <type_traits> +#include <__functional/invoke.h> +#include <__type_traits/integral_constant.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -24,7 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [rand.req.urng] template<class _Gen> @@ -36,7 +37,7 @@ requires bool_constant<(_Gen::min() < _Gen::max())>::value; }; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__random/uniform_real_distribution.h b/third_party/llvm-project/libcxx/include/__random/uniform_real_distribution.h index b52b689..dd6d6b3 100644 --- a/third_party/llvm-project/libcxx/include/__random/uniform_real_distribution.h +++ b/third_party/llvm-project/libcxx/include/__random/uniform_real_distribution.h
@@ -14,7 +14,6 @@ #include <__random/is_valid.h> #include <iosfwd> #include <limits> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__ranges/access.h b/third_party/llvm-project/libcxx/include/__ranges/access.h index e48a71a..502bd5e 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/access.h +++ b/third_party/llvm-project/libcxx/include/__ranges/access.h
@@ -29,7 +29,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { template <class _Tp> @@ -223,7 +223,7 @@ } // namespace __cpo } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/all.h b/third_party/llvm-project/libcxx/include/__ranges/all.h index 511f7b3..ecf908d 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/all.h +++ b/third_party/llvm-project/libcxx/include/__ranges/all.h
@@ -18,10 +18,10 @@ #include <__ranges/owning_view.h> #include <__ranges/range_adaptor.h> #include <__ranges/ref_view.h> +#include <__type_traits/decay.h> #include <__utility/auto_cast.h> #include <__utility/declval.h> #include <__utility/forward.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -29,7 +29,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges::views { @@ -77,7 +77,7 @@ } // namespace ranges::views -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/common_view.h b/third_party/llvm-project/libcxx/include/__ranges/common_view.h index 8d7ae58..8fc68ba 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/common_view.h +++ b/third_party/llvm-project/libcxx/include/__ranges/common_view.h
@@ -24,7 +24,6 @@ #include <__ranges/view_interface.h> #include <__utility/forward.h> #include <__utility/move.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -32,7 +31,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { @@ -130,7 +129,7 @@ } // namespace views } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/concepts.h b/third_party/llvm-project/libcxx/include/__ranges/concepts.h index e34c545..b87a714 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/concepts.h +++ b/third_party/llvm-project/libcxx/include/__ranges/concepts.h
@@ -37,7 +37,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { @@ -73,6 +73,9 @@ template <range _Rp> using range_rvalue_reference_t = iter_rvalue_reference_t<iterator_t<_Rp>>; + template <range _Rp> + using range_common_reference_t = iter_common_reference_t<iterator_t<_Rp>>; + // [range.sized] template <class _Tp> concept sized_range = range<_Tp> && requires(_Tp& __t) { ranges::size(__t); }; @@ -140,7 +143,7 @@ } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/copyable_box.h b/third_party/llvm-project/libcxx/include/__ranges/copyable_box.h index fb3d6e4..1973bbf 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/copyable_box.h +++ b/third_party/llvm-project/libcxx/include/__ranges/copyable_box.h
@@ -18,7 +18,6 @@ #include <__memory/construct_at.h> #include <__utility/move.h> #include <optional> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -26,7 +25,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // __copyable_box allows turning a type that is copy-constructible (but maybe not copy-assignable) into // a type that is both copy-constructible and copy-assignable. It does that by introducing an empty state @@ -173,7 +172,7 @@ }; } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/counted.h b/third_party/llvm-project/libcxx/include/__ranges/counted.h index 138aa0e..882f90b 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/counted.h +++ b/third_party/llvm-project/libcxx/include/__ranges/counted.h
@@ -19,10 +19,11 @@ #include <__iterator/iterator_traits.h> #include <__memory/pointer_traits.h> #include <__ranges/subrange.h> +#include <__type_traits/decay.h> #include <__utility/forward.h> #include <__utility/move.h> +#include <cstddef> #include <span> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -30,7 +31,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges::views { @@ -75,7 +76,7 @@ } // namespace ranges::views -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/dangling.h b/third_party/llvm-project/libcxx/include/__ranges/dangling.h index c104534..613084d 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/dangling.h +++ b/third_party/llvm-project/libcxx/include/__ranges/dangling.h
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { struct dangling { @@ -35,7 +35,7 @@ // borrowed_subrange_t defined in <__ranges/subrange.h> } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/data.h b/third_party/llvm-project/libcxx/include/__ranges/data.h index 0ac25b5..6c09908 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/data.h +++ b/third_party/llvm-project/libcxx/include/__ranges/data.h
@@ -30,7 +30,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [range.prim.data] @@ -105,7 +105,7 @@ } // namespace __cpo } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/drop_view.h b/third_party/llvm-project/libcxx/include/__ranges/drop_view.h index 8f3564a..87668c3 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/drop_view.h +++ b/third_party/llvm-project/libcxx/include/__ranges/drop_view.h
@@ -33,10 +33,15 @@ #include <__ranges/size.h> #include <__ranges/subrange.h> #include <__ranges/view_interface.h> +#include <__type_traits/conditional.h> +#include <__type_traits/decay.h> +#include <__type_traits/is_nothrow_constructible.h> +#include <__type_traits/make_unsigned.h> +#include <__type_traits/remove_cvref.h> #include <__utility/auto_cast.h> #include <__utility/forward.h> #include <__utility/move.h> -#include <type_traits> +#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -47,7 +52,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { template<view _View> @@ -69,7 +74,7 @@ drop_view() requires default_initializable<_View> = default; _LIBCPP_HIDE_FROM_ABI - constexpr drop_view(_View __base, range_difference_t<_View> __count) + constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 drop_view(_View __base, range_difference_t<_View> __count) : __count_(__count) , __base_(std::move(__base)) { @@ -255,12 +260,12 @@ { // Introducing local variables avoids calculating `min` and `distance` twice (at the cost of diverging from the // expression used in the `noexcept` clause and the return statement). - auto dist = ranges::distance(__rng); - auto clamped = std::min<_Dist>(dist, std::forward<_Np>(__n)); + auto __dist = ranges::distance(__rng); + auto __clamped = std::min<_Dist>(__dist, std::forward<_Np>(__n)); return _RawRange( - ranges::begin(__rng) + clamped, + ranges::begin(__rng) + __clamped, ranges::end(__rng), - std::__to_unsigned_like(dist - clamped) + std::__to_unsigned_like(__dist - __clamped) );} // [range.drop.overview]: the "otherwise" case. @@ -299,7 +304,7 @@ } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/drop_while_view.h b/third_party/llvm-project/libcxx/include/__ranges/drop_while_view.h index 7c28992..518feae 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/drop_while_view.h +++ b/third_party/llvm-project/libcxx/include/__ranges/drop_while_view.h
@@ -51,7 +51,7 @@ requires default_initializable<_View> && default_initializable<_Pred> = default; - _LIBCPP_HIDE_FROM_ABI constexpr drop_while_view(_View __base, _Pred __pred) + _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 drop_while_view(_View __base, _Pred __pred) : __base_(std::move(__base)), __pred_(std::in_place, std::move(__pred)) {} _LIBCPP_HIDE_FROM_ABI constexpr _View base() const&
diff --git a/third_party/llvm-project/libcxx/include/__ranges/elements_view.h b/third_party/llvm-project/libcxx/include/__ranges/elements_view.h index 3afd6dd..325e4c9 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/elements_view.h +++ b/third_party/llvm-project/libcxx/include/__ranges/elements_view.h
@@ -26,9 +26,9 @@ #include <__ranges/range_adaptor.h> #include <__ranges/size.h> #include <__ranges/view_interface.h> -#include <__tuple_dir/tuple_element.h> -#include <__tuple_dir/tuple_like.h> -#include <__tuple_dir/tuple_size.h> +#include <__tuple/tuple_element.h> +#include <__tuple/tuple_like.h> +#include <__tuple/tuple_size.h> #include <__type_traits/is_reference.h> #include <__type_traits/maybe_const.h> #include <__type_traits/remove_cv.h> @@ -49,12 +49,6 @@ namespace ranges { -template <class _View, size_t _Np, bool _Const> -class __elements_view_iterator; - -template <class _View, size_t _Np, bool _Const> -class __elements_view_sentinel; - template <class _Tp, size_t _Np> concept __has_tuple_element = __tuple_like<_Tp> && _Np < tuple_size<_Tp>::value; @@ -66,6 +60,13 @@ __has_tuple_element<remove_reference_t<range_reference_t<_View>>, _Np> && __returnable_element<range_reference_t<_View>, _Np> class elements_view : public view_interface<elements_view<_View, _Np>> { +private: + template <bool> + class __iterator; + + template <bool> + class __sentinel; + public: _LIBCPP_HIDE_FROM_ABI elements_view() requires default_initializable<_View> @@ -130,12 +131,6 @@ } private: - template <bool _Const> - using __iterator = __elements_view_iterator<_View, _Np, _Const>; - - template <bool _Const> - using __sentinel = __elements_view_sentinel<_View, _Np, _Const>; - _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); }; @@ -160,13 +155,18 @@ using iterator_category = decltype(__get_iterator_category()); }; -template <class _View, size_t _Np, bool _Const> -class __elements_view_iterator : public __elements_view_iterator_category_base<__maybe_const<_Const, _View>, _Np> { - template <class, size_t, bool > - friend class __elements_view_iterator; +template <input_range _View, size_t _Np> + requires view<_View> && __has_tuple_element<range_value_t<_View>, _Np> && + __has_tuple_element<remove_reference_t<range_reference_t<_View>>, _Np> && + __returnable_element<range_reference_t<_View>, _Np> +template <bool _Const> +class elements_view<_View, _Np>::__iterator + : public __elements_view_iterator_category_base<__maybe_const<_Const, _View>, _Np> { + template <bool> + friend class __iterator; - template <class, size_t, bool > - friend class __elements_view_sentinel; + template <bool> + friend class __sentinel; using _Base = __maybe_const<_Const, _View>; @@ -198,14 +198,13 @@ using value_type = remove_cvref_t<tuple_element_t<_Np, range_value_t<_Base>>>; using difference_type = range_difference_t<_Base>; - _LIBCPP_HIDE_FROM_ABI __elements_view_iterator() + _LIBCPP_HIDE_FROM_ABI __iterator() requires default_initializable<iterator_t<_Base>> = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit __elements_view_iterator(iterator_t<_Base> __current) - : __current_(std::move(__current)) {} + _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator(iterator_t<_Base> __current) : __current_(std::move(__current)) {} - _LIBCPP_HIDE_FROM_ABI constexpr __elements_view_iterator(__elements_view_iterator<_View, _Np, !_Const> __i) + _LIBCPP_HIDE_FROM_ABI constexpr __iterator(__iterator<!_Const> __i) requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>> : __current_(std::move(__i.__current_)) {} @@ -215,44 +214,44 @@ _LIBCPP_HIDE_FROM_ABI constexpr decltype(auto) operator*() const { return __get_element(__current_); } - _LIBCPP_HIDE_FROM_ABI constexpr __elements_view_iterator& operator++() { + _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() { ++__current_; return *this; } _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++__current_; } - _LIBCPP_HIDE_FROM_ABI constexpr __elements_view_iterator operator++(int) + _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) requires forward_range<_Base> { - auto temp = *this; + auto __temp = *this; ++__current_; - return temp; + return __temp; } - _LIBCPP_HIDE_FROM_ABI constexpr __elements_view_iterator& operator--() + _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator--() requires bidirectional_range<_Base> { --__current_; return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr __elements_view_iterator operator--(int) + _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator--(int) requires bidirectional_range<_Base> { - auto temp = *this; + auto __temp = *this; --__current_; - return temp; + return __temp; } - _LIBCPP_HIDE_FROM_ABI constexpr __elements_view_iterator& operator+=(difference_type __n) + _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator+=(difference_type __n) requires random_access_range<_Base> { __current_ += __n; return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr __elements_view_iterator& operator-=(difference_type __n) + _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator-=(difference_type __n) requires random_access_range<_Base> { __current_ -= __n; @@ -265,99 +264,91 @@ return __get_element(__current_ + __n); } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool - operator==(const __elements_view_iterator& __x, const __elements_view_iterator& __y) + _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) requires equality_comparable<iterator_t<_Base>> { return __x.__current_ == __y.__current_; } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool - operator<(const __elements_view_iterator& __x, const __elements_view_iterator& __y) + _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(const __iterator& __x, const __iterator& __y) requires random_access_range<_Base> { return __x.__current_ < __y.__current_; } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool - operator>(const __elements_view_iterator& __x, const __elements_view_iterator& __y) + _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(const __iterator& __x, const __iterator& __y) requires random_access_range<_Base> { return __y < __x; } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool - operator<=(const __elements_view_iterator& __x, const __elements_view_iterator& __y) + _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y) requires random_access_range<_Base> { return !(__y < __x); } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool - operator>=(const __elements_view_iterator& __x, const __elements_view_iterator& __y) + _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y) requires random_access_range<_Base> { return !(__x < __y); } - _LIBCPP_HIDE_FROM_ABI friend constexpr auto - operator<=>(const __elements_view_iterator& __x, const __elements_view_iterator& __y) + _LIBCPP_HIDE_FROM_ABI friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y) requires random_access_range<_Base> && three_way_comparable<iterator_t<_Base>> { return __x.__current_ <=> __y.__current_; } - _LIBCPP_HIDE_FROM_ABI friend constexpr __elements_view_iterator - operator+(const __elements_view_iterator& __x, difference_type __y) + _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(const __iterator& __x, difference_type __y) requires random_access_range<_Base> { - return __elements_view_iterator{__x} += __y; + return __iterator{__x} += __y; } - _LIBCPP_HIDE_FROM_ABI friend constexpr __elements_view_iterator - operator+(difference_type __x, const __elements_view_iterator& __y) + _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator+(difference_type __x, const __iterator& __y) requires random_access_range<_Base> { return __y + __x; } - _LIBCPP_HIDE_FROM_ABI friend constexpr __elements_view_iterator - operator-(const __elements_view_iterator& __x, difference_type __y) + _LIBCPP_HIDE_FROM_ABI friend constexpr __iterator operator-(const __iterator& __x, difference_type __y) requires random_access_range<_Base> { - return __elements_view_iterator{__x} -= __y; + return __iterator{__x} -= __y; } - _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type - operator-(const __elements_view_iterator& __x, const __elements_view_iterator& __y) + _LIBCPP_HIDE_FROM_ABI friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y) requires sized_sentinel_for<iterator_t<_Base>, iterator_t<_Base>> { return __x.__current_ - __y.__current_; } }; -template <class _View, size_t _Np, bool _Const> -class __elements_view_sentinel { +template <input_range _View, size_t _Np> + requires view<_View> && __has_tuple_element<range_value_t<_View>, _Np> && + __has_tuple_element<remove_reference_t<range_reference_t<_View>>, _Np> && + __returnable_element<range_reference_t<_View>, _Np> +template <bool _Const> +class elements_view<_View, _Np>::__sentinel { private: using _Base = __maybe_const<_Const, _View>; _LIBCPP_NO_UNIQUE_ADDRESS sentinel_t<_Base> __end_ = sentinel_t<_Base>(); - template <class, size_t, bool > - friend class __elements_view_sentinel; + template <bool> + friend class __sentinel; template <bool _AnyConst> - _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) - __get_current(const __elements_view_iterator<_View, _Np, _AnyConst>& __iter) { + _LIBCPP_HIDE_FROM_ABI static constexpr decltype(auto) __get_current(const __iterator<_AnyConst>& __iter) { return (__iter.__current_); } public: - _LIBCPP_HIDE_FROM_ABI __elements_view_sentinel() = default; + _LIBCPP_HIDE_FROM_ABI __sentinel() = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit __elements_view_sentinel(sentinel_t<_Base> __end) - : __end_(std::move(__end)) {} + _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(std::move(__end)) {} - _LIBCPP_HIDE_FROM_ABI constexpr __elements_view_sentinel(__elements_view_sentinel<_View, _Np, !_Const> __other) + _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __other) requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>> : __end_(std::move(__other.__end_)) {} @@ -365,22 +356,21 @@ template <bool _OtherConst> requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> - _LIBCPP_HIDE_FROM_ABI friend constexpr bool - operator==(const __elements_view_iterator<_View, _Np, _OtherConst>& __x, const __elements_view_sentinel& __y) { + _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) { return __get_current(__x) == __y.__end_; } template <bool _OtherConst> requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> - operator-(const __elements_view_iterator<_View, _Np, _OtherConst>& __x, const __elements_view_sentinel& __y) { + operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) { return __get_current(__x) - __y.__end_; } template <bool _OtherConst> requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> - operator-(const __elements_view_sentinel& __x, const __elements_view_iterator<_View, _Np, _OtherConst>& __y) { + operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) { return __x.__end_ - __get_current(__y); } };
diff --git a/third_party/llvm-project/libcxx/include/__ranges/empty.h b/third_party/llvm-project/libcxx/include/__ranges/empty.h index 8a1c75c..64996f4 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/empty.h +++ b/third_party/llvm-project/libcxx/include/__ranges/empty.h
@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [range.prim.empty] @@ -75,7 +75,7 @@ } // namespace __cpo } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/empty_view.h b/third_party/llvm-project/libcxx/include/__ranges/empty_view.h index 58e69ac..bb445b4 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/empty_view.h +++ b/third_party/llvm-project/libcxx/include/__ranges/empty_view.h
@@ -13,7 +13,8 @@ #include <__config> #include <__ranges/enable_borrowed_range.h> #include <__ranges/view_interface.h> -#include <type_traits> +#include <__type_traits/is_object.h> +#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -21,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { template<class _Tp> @@ -46,7 +47,7 @@ } // namespace views } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/enable_borrowed_range.h b/third_party/llvm-project/libcxx/include/__ranges/enable_borrowed_range.h index 833d266..1d06833 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/enable_borrowed_range.h +++ b/third_party/llvm-project/libcxx/include/__ranges/enable_borrowed_range.h
@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { @@ -33,7 +33,7 @@ } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/enable_view.h b/third_party/llvm-project/libcxx/include/__ranges/enable_view.h index c85064b..0c1dff3 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/enable_view.h +++ b/third_party/llvm-project/libcxx/include/__ranges/enable_view.h
@@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { @@ -43,7 +43,7 @@ } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/filter_view.h b/third_party/llvm-project/libcxx/include/__ranges/filter_view.h index f8633a3..28d08c8 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/filter_view.h +++ b/third_party/llvm-project/libcxx/include/__ranges/filter_view.h
@@ -35,7 +35,6 @@ #include <__utility/forward.h> #include <__utility/in_place.h> #include <__utility/move.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -43,18 +42,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { - - template <input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred> - requires view<_View> && is_object_v<_Pred> - class __filter_view_iterator; - - template <input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred> - requires view<_View> && is_object_v<_Pred> - class __filter_view_sentinel; - template<input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred> requires view<_View> && is_object_v<_Pred> class filter_view : public view_interface<filter_view<_View, _Pred>> { @@ -67,20 +57,15 @@ using _Cache = _If<_UseCache, __non_propagating_cache<iterator_t<_View>>, __empty_cache>; _LIBCPP_NO_UNIQUE_ADDRESS _Cache __cached_begin_ = _Cache(); - using __iterator = __filter_view_iterator<_View, _Pred>; - using __sentinel = __filter_view_sentinel<_View, _Pred>; - - friend __iterator; - friend __sentinel; + class __iterator; + class __sentinel; public: _LIBCPP_HIDE_FROM_ABI filter_view() requires default_initializable<_View> && default_initializable<_Pred> = default; - _LIBCPP_HIDE_FROM_ABI - constexpr filter_view(_View __base, _Pred __pred) - : __base_(std::move(__base)), __pred_(in_place, std::move(__pred)) - { } + _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 filter_view(_View __base, _Pred __pred) + : __base_(std::move(__base)), __pred_(in_place, std::move(__pred)) {} template<class _Vp = _View> _LIBCPP_HIDE_FROM_ABI @@ -131,13 +116,11 @@ template<input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred> requires view<_View> && is_object_v<_Pred> - class __filter_view_iterator : public __filter_iterator_category<_View> { - - using __filter_view = filter_view<_View, _Pred>; + class filter_view<_View, _Pred>::__iterator : public __filter_iterator_category<_View> { public: _LIBCPP_NO_UNIQUE_ADDRESS iterator_t<_View> __current_ = iterator_t<_View>(); - _LIBCPP_NO_UNIQUE_ADDRESS __filter_view* __parent_ = nullptr; + _LIBCPP_NO_UNIQUE_ADDRESS filter_view* __parent_ = nullptr; using iterator_concept = _If<bidirectional_range<_View>, bidirectional_iterator_tag, @@ -149,10 +132,10 @@ using difference_type = range_difference_t<_View>; _LIBCPP_HIDE_FROM_ABI - __filter_view_iterator() requires default_initializable<iterator_t<_View>> = default; + __iterator() requires default_initializable<iterator_t<_View>> = default; _LIBCPP_HIDE_FROM_ABI - constexpr __filter_view_iterator(__filter_view& __parent, iterator_t<_View> __current) + constexpr __iterator(filter_view& __parent, iterator_t<_View> __current) : __current_(std::move(__current)), __parent_(std::addressof(__parent)) { } @@ -171,7 +154,7 @@ } _LIBCPP_HIDE_FROM_ABI - constexpr __filter_view_iterator& operator++() { + constexpr __iterator& operator++() { __current_ = ranges::find_if(std::move(++__current_), ranges::end(__parent_->__base_), std::ref(*__parent_->__pred_)); return *this; @@ -179,42 +162,42 @@ _LIBCPP_HIDE_FROM_ABI constexpr void operator++(int) { ++*this; } _LIBCPP_HIDE_FROM_ABI - constexpr __filter_view_iterator operator++(int) requires forward_range<_View> { + constexpr __iterator operator++(int) requires forward_range<_View> { auto __tmp = *this; ++*this; return __tmp; } _LIBCPP_HIDE_FROM_ABI - constexpr __filter_view_iterator& operator--() requires bidirectional_range<_View> { + constexpr __iterator& operator--() requires bidirectional_range<_View> { do { --__current_; } while (!std::invoke(*__parent_->__pred_, *__current_)); return *this; } _LIBCPP_HIDE_FROM_ABI - constexpr __filter_view_iterator operator--(int) requires bidirectional_range<_View> { - auto tmp = *this; + constexpr __iterator operator--(int) requires bidirectional_range<_View> { + auto __tmp = *this; --*this; - return tmp; + return __tmp; } _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator==(__filter_view_iterator const& __x, __filter_view_iterator const& __y) + friend constexpr bool operator==(__iterator const& __x, __iterator const& __y) requires equality_comparable<iterator_t<_View>> { return __x.__current_ == __y.__current_; } _LIBCPP_HIDE_FROM_ABI - friend constexpr range_rvalue_reference_t<_View> iter_move(__filter_view_iterator const& __it) + friend constexpr range_rvalue_reference_t<_View> iter_move(__iterator const& __it) noexcept(noexcept(ranges::iter_move(__it.__current_))) { return ranges::iter_move(__it.__current_); } _LIBCPP_HIDE_FROM_ABI - friend constexpr void iter_swap(__filter_view_iterator const& __x, __filter_view_iterator const& __y) + friend constexpr void iter_swap(__iterator const& __x, __iterator const& __y) noexcept(noexcept(ranges::iter_swap(__x.__current_, __y.__current_))) requires indirectly_swappable<iterator_t<_View>> { @@ -224,17 +207,15 @@ template<input_range _View, indirect_unary_predicate<iterator_t<_View>> _Pred> requires view<_View> && is_object_v<_Pred> - class __filter_view_sentinel { - using __filter_view = filter_view<_View, _Pred>; - + class filter_view<_View, _Pred>::__sentinel { public: sentinel_t<_View> __end_ = sentinel_t<_View>(); _LIBCPP_HIDE_FROM_ABI - __filter_view_sentinel() = default; + __sentinel() = default; _LIBCPP_HIDE_FROM_ABI - constexpr explicit __filter_view_sentinel(__filter_view& __parent) + constexpr explicit __sentinel(filter_view& __parent) : __end_(ranges::end(__parent.__base_)) { } @@ -242,7 +223,7 @@ constexpr sentinel_t<_View> base() const { return __end_; } _LIBCPP_HIDE_FROM_ABI friend constexpr bool - operator==(__filter_view_iterator<_View, _Pred> const& __x, __filter_view_sentinel const& __y) { + operator==(__iterator const& __x, __sentinel const& __y) { return __x.__current_ == __y.__end_; } }; @@ -273,7 +254,7 @@ } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/iota_view.h b/third_party/llvm-project/libcxx/include/__ranges/iota_view.h index 3654096..5713942 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/iota_view.h +++ b/third_party/llvm-project/libcxx/include/__ranges/iota_view.h
@@ -30,9 +30,12 @@ #include <__ranges/copyable_box.h> #include <__ranges/enable_borrowed_range.h> #include <__ranges/view_interface.h> +#include <__type_traits/conditional.h> +#include <__type_traits/is_nothrow_copy_constructible.h> +#include <__type_traits/make_unsigned.h> +#include <__type_traits/type_identity.h> #include <__utility/forward.h> #include <__utility/move.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -40,12 +43,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { template<class _Int> struct __get_wider_signed { - static auto __call() { + consteval static auto __call() { if constexpr (sizeof(_Int) < sizeof(short)) return type_identity<short>{}; else if constexpr (sizeof(_Int) < sizeof(int)) return type_identity<int>{}; else if constexpr (sizeof(_Int) < sizeof(long)) return type_identity<long>{}; @@ -83,14 +86,6 @@ { __j - __j } -> convertible_to<_IotaDiffT<_Iter>>; }; - template <weakly_incrementable _Start> - requires copyable<_Start> - struct __iota_view_iterator; - - template <weakly_incrementable _Start, semiregular _BoundSentinel> - requires __weakly_equality_comparable_with<_Start, _BoundSentinel> && copyable<_Start> - struct __iota_view_sentinel; - template<class> struct __iota_iterator_category {}; @@ -102,9 +97,211 @@ template <weakly_incrementable _Start, semiregular _BoundSentinel = unreachable_sentinel_t> requires __weakly_equality_comparable_with<_Start, _BoundSentinel> && copyable<_Start> class iota_view : public view_interface<iota_view<_Start, _BoundSentinel>> { + struct __iterator : public __iota_iterator_category<_Start> { + friend class iota_view; - using __iterator = __iota_view_iterator<_Start>; - using __sentinel = __iota_view_sentinel<_Start, _BoundSentinel>; + using iterator_concept = + _If<__advanceable<_Start>, random_access_iterator_tag, + _If<__decrementable<_Start>, bidirectional_iterator_tag, + _If<incrementable<_Start>, forward_iterator_tag, + /*Else*/ input_iterator_tag>>>; + + using value_type = _Start; + using difference_type = _IotaDiffT<_Start>; + + _Start __value_ = _Start(); + + _LIBCPP_HIDE_FROM_ABI + __iterator() requires default_initializable<_Start> = default; + + _LIBCPP_HIDE_FROM_ABI + constexpr explicit __iterator(_Start __value) : __value_(std::move(__value)) {} + + _LIBCPP_HIDE_FROM_ABI + constexpr _Start operator*() const noexcept(is_nothrow_copy_constructible_v<_Start>) { + return __value_; + } + + _LIBCPP_HIDE_FROM_ABI + constexpr __iterator& operator++() { + ++__value_; + return *this; + } + + _LIBCPP_HIDE_FROM_ABI + constexpr void operator++(int) { ++*this; } + + _LIBCPP_HIDE_FROM_ABI + constexpr __iterator operator++(int) requires incrementable<_Start> { + auto __tmp = *this; + ++*this; + return __tmp; + } + + _LIBCPP_HIDE_FROM_ABI + constexpr __iterator& operator--() requires __decrementable<_Start> { + --__value_; + return *this; + } + + _LIBCPP_HIDE_FROM_ABI + constexpr __iterator operator--(int) requires __decrementable<_Start> { + auto __tmp = *this; + --*this; + return __tmp; + } + + _LIBCPP_HIDE_FROM_ABI + constexpr __iterator& operator+=(difference_type __n) + requires __advanceable<_Start> + { + if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) { + if (__n >= difference_type(0)) { + __value_ += static_cast<_Start>(__n); + } else { + __value_ -= static_cast<_Start>(-__n); + } + } else { + __value_ += __n; + } + return *this; + } + + _LIBCPP_HIDE_FROM_ABI + constexpr __iterator& operator-=(difference_type __n) + requires __advanceable<_Start> + { + if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) { + if (__n >= difference_type(0)) { + __value_ -= static_cast<_Start>(__n); + } else { + __value_ += static_cast<_Start>(-__n); + } + } else { + __value_ -= __n; + } + return *this; + } + + _LIBCPP_HIDE_FROM_ABI + constexpr _Start operator[](difference_type __n) const + requires __advanceable<_Start> + { + return _Start(__value_ + __n); + } + + _LIBCPP_HIDE_FROM_ABI + friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) + requires equality_comparable<_Start> + { + return __x.__value_ == __y.__value_; + } + + _LIBCPP_HIDE_FROM_ABI + friend constexpr bool operator<(const __iterator& __x, const __iterator& __y) + requires totally_ordered<_Start> + { + return __x.__value_ < __y.__value_; + } + + _LIBCPP_HIDE_FROM_ABI + friend constexpr bool operator>(const __iterator& __x, const __iterator& __y) + requires totally_ordered<_Start> + { + return __y < __x; + } + + _LIBCPP_HIDE_FROM_ABI + friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y) + requires totally_ordered<_Start> + { + return !(__y < __x); + } + + _LIBCPP_HIDE_FROM_ABI + friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y) + requires totally_ordered<_Start> + { + return !(__x < __y); + } + + _LIBCPP_HIDE_FROM_ABI + friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y) + requires totally_ordered<_Start> && three_way_comparable<_Start> + { + return __x.__value_ <=> __y.__value_; + } + + _LIBCPP_HIDE_FROM_ABI + friend constexpr __iterator operator+(__iterator __i, difference_type __n) + requires __advanceable<_Start> + { + __i += __n; + return __i; + } + + _LIBCPP_HIDE_FROM_ABI + friend constexpr __iterator operator+(difference_type __n, __iterator __i) + requires __advanceable<_Start> + { + return __i + __n; + } + + _LIBCPP_HIDE_FROM_ABI + friend constexpr __iterator operator-(__iterator __i, difference_type __n) + requires __advanceable<_Start> + { + __i -= __n; + return __i; + } + + _LIBCPP_HIDE_FROM_ABI + friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y) + requires __advanceable<_Start> + { + if constexpr (__integer_like<_Start>) { + if constexpr (__signed_integer_like<_Start>) { + return difference_type(difference_type(__x.__value_) - difference_type(__y.__value_)); + } + if (__y.__value_ > __x.__value_) { + return difference_type(-difference_type(__y.__value_ - __x.__value_)); + } + return difference_type(__x.__value_ - __y.__value_); + } + return __x.__value_ - __y.__value_; + } + }; + + struct __sentinel { + friend class iota_view; + + private: + _BoundSentinel __bound_sentinel_ = _BoundSentinel(); + + public: + _LIBCPP_HIDE_FROM_ABI + __sentinel() = default; + constexpr explicit __sentinel(_BoundSentinel __bound_sentinel) : __bound_sentinel_(std::move(__bound_sentinel)) {} + + _LIBCPP_HIDE_FROM_ABI + friend constexpr bool operator==(const __iterator& __x, const __sentinel& __y) { + return __x.__value_ == __y.__bound_sentinel_; + } + + _LIBCPP_HIDE_FROM_ABI + friend constexpr iter_difference_t<_Start> operator-(const __iterator& __x, const __sentinel& __y) + requires sized_sentinel_for<_BoundSentinel, _Start> + { + return __x.__value_ - __y.__bound_sentinel_; + } + + _LIBCPP_HIDE_FROM_ABI + friend constexpr iter_difference_t<_Start> operator-(const __sentinel& __x, const __iterator& __y) + requires sized_sentinel_for<_BoundSentinel, _Start> + { + return -(__y - __x); + } + }; _Start __value_ = _Start(); _BoundSentinel __bound_sentinel_ = _BoundSentinel(); @@ -117,7 +314,7 @@ constexpr explicit iota_view(_Start __value) : __value_(std::move(__value)) { } _LIBCPP_HIDE_FROM_ABI - constexpr iota_view(type_identity_t<_Start> __value, type_identity_t<_BoundSentinel> __bound_sentinel) + constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(type_identity_t<_Start> __value, type_identity_t<_BoundSentinel> __bound_sentinel) : __value_(std::move(__value)), __bound_sentinel_(std::move(__bound_sentinel)) { // Validate the precondition if possible. if constexpr (totally_ordered_with<_Start, _BoundSentinel>) { @@ -127,17 +324,17 @@ } _LIBCPP_HIDE_FROM_ABI - constexpr iota_view(__iterator __first, __iterator __last) + constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __iterator __last) requires same_as<_Start, _BoundSentinel> : iota_view(std::move(__first.__value_), std::move(__last.__value_)) {} _LIBCPP_HIDE_FROM_ABI - constexpr iota_view(__iterator __first, _BoundSentinel __last) + constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, _BoundSentinel __last) requires same_as<_BoundSentinel, unreachable_sentinel_t> : iota_view(std::move(__first.__value_), std::move(__last)) {} _LIBCPP_HIDE_FROM_ABI - constexpr iota_view(__iterator __first, __sentinel __last) + constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 iota_view(__iterator __first, __sentinel __last) requires(!same_as<_Start, _BoundSentinel> && !same_as<_Start, unreachable_sentinel_t>) : iota_view(std::move(__first.__value_), std::move(__last.__bound_sentinel_)) {} @@ -185,224 +382,6 @@ template <class _Start, class _BoundSentinel> inline constexpr bool enable_borrowed_range<iota_view<_Start, _BoundSentinel>> = true; - template <weakly_incrementable _Start> - requires copyable<_Start> - struct __iota_view_iterator : public __iota_iterator_category<_Start> { - - template <weakly_incrementable _StartT, semiregular _BoundSentinelT> - requires __weakly_equality_comparable_with<_StartT, _BoundSentinelT> && copyable<_StartT> - friend class iota_view; - - using iterator_concept = - _If<__advanceable<_Start>, random_access_iterator_tag, - _If<__decrementable<_Start>, bidirectional_iterator_tag, - _If<incrementable<_Start>, forward_iterator_tag, - /*Else*/ input_iterator_tag>>>; - - using value_type = _Start; - using difference_type = _IotaDiffT<_Start>; - - _Start __value_ = _Start(); - - _LIBCPP_HIDE_FROM_ABI - __iota_view_iterator() requires default_initializable<_Start> = default; - - _LIBCPP_HIDE_FROM_ABI - constexpr explicit __iota_view_iterator(_Start __value) : __value_(std::move(__value)) {} - - _LIBCPP_HIDE_FROM_ABI - constexpr _Start operator*() const noexcept(is_nothrow_copy_constructible_v<_Start>) { - return __value_; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iota_view_iterator& operator++() { - ++__value_; - return *this; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr void operator++(int) { ++*this; } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iota_view_iterator operator++(int) requires incrementable<_Start> { - auto __tmp = *this; - ++*this; - return __tmp; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iota_view_iterator& operator--() requires __decrementable<_Start> { - --__value_; - return *this; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iota_view_iterator operator--(int) requires __decrementable<_Start> { - auto __tmp = *this; - --*this; - return __tmp; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iota_view_iterator& operator+=(difference_type __n) - requires __advanceable<_Start> - { - if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) { - if (__n >= difference_type(0)) { - __value_ += static_cast<_Start>(__n); - } else { - __value_ -= static_cast<_Start>(-__n); - } - } else { - __value_ += __n; - } - return *this; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr __iota_view_iterator& operator-=(difference_type __n) - requires __advanceable<_Start> - { - if constexpr (__integer_like<_Start> && !__signed_integer_like<_Start>) { - if (__n >= difference_type(0)) { - __value_ -= static_cast<_Start>(__n); - } else { - __value_ += static_cast<_Start>(-__n); - } - } else { - __value_ -= __n; - } - return *this; - } - - _LIBCPP_HIDE_FROM_ABI - constexpr _Start operator[](difference_type __n) const - requires __advanceable<_Start> - { - return _Start(__value_ + __n); - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator==(const __iota_view_iterator& __x, const __iota_view_iterator& __y) - requires equality_comparable<_Start> - { - return __x.__value_ == __y.__value_; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator<(const __iota_view_iterator& __x, const __iota_view_iterator& __y) - requires totally_ordered<_Start> - { - return __x.__value_ < __y.__value_; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator>(const __iota_view_iterator& __x, const __iota_view_iterator& __y) - requires totally_ordered<_Start> - { - return __y < __x; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator<=(const __iota_view_iterator& __x, const __iota_view_iterator& __y) - requires totally_ordered<_Start> - { - return !(__y < __x); - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator>=(const __iota_view_iterator& __x, const __iota_view_iterator& __y) - requires totally_ordered<_Start> - { - return !(__x < __y); - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr auto operator<=>(const __iota_view_iterator& __x, const __iota_view_iterator& __y) - requires totally_ordered<_Start> && three_way_comparable<_Start> - { - return __x.__value_ <=> __y.__value_; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr __iota_view_iterator operator+(__iota_view_iterator __i, difference_type __n) - requires __advanceable<_Start> - { - __i += __n; - return __i; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr __iota_view_iterator operator+(difference_type __n, __iota_view_iterator __i) - requires __advanceable<_Start> - { - return __i + __n; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr __iota_view_iterator operator-(__iota_view_iterator __i, difference_type __n) - requires __advanceable<_Start> - { - __i -= __n; - return __i; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr difference_type operator-(const __iota_view_iterator& __x, const __iota_view_iterator& __y) - requires __advanceable<_Start> - { - if constexpr (__integer_like<_Start>) { - if constexpr (__signed_integer_like<_Start>) { - return difference_type(difference_type(__x.__value_) - difference_type(__y.__value_)); - } - if (__y.__value_ > __x.__value_) { - return difference_type(-difference_type(__y.__value_ - __x.__value_)); - } - return difference_type(__x.__value_ - __y.__value_); - } - return __x.__value_ - __y.__value_; - } - }; - - template <weakly_incrementable _Start, semiregular _BoundSentinel> - requires __weakly_equality_comparable_with<_Start, _BoundSentinel> && copyable<_Start> - struct __iota_view_sentinel { - - template <weakly_incrementable _StartT, semiregular _BoundSentinelT> - requires __weakly_equality_comparable_with<_StartT, _BoundSentinelT> && copyable<_StartT> - friend class iota_view; - - using __iterator = __iota_view_iterator<_Start>; - - private: - _BoundSentinel __bound_sentinel_ = _BoundSentinel(); - - public: - _LIBCPP_HIDE_FROM_ABI - __iota_view_sentinel() = default; - constexpr explicit __iota_view_sentinel(_BoundSentinel __bound_sentinel) : __bound_sentinel_(std::move(__bound_sentinel)) {} - - _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator==(const __iterator& __x, const __iota_view_sentinel& __y) { - return __x.__value_ == __y.__bound_sentinel_; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr iter_difference_t<_Start> operator-(const __iterator& __x, const __iota_view_sentinel& __y) - requires sized_sentinel_for<_BoundSentinel, _Start> - { - return __x.__value_ - __y.__bound_sentinel_; - } - - _LIBCPP_HIDE_FROM_ABI - friend constexpr iter_difference_t<_Start> operator-(const __iota_view_sentinel& __x, const __iterator& __y) - requires sized_sentinel_for<_BoundSentinel, _Start> - { - return -(__y - __x); - } - }; - namespace views { namespace __iota { struct __fn { @@ -427,7 +406,7 @@ } // namespace views } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/istream_view.h b/third_party/llvm-project/libcxx/include/__ranges/istream_view.h index 69a9df3..66cd915 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/istream_view.h +++ b/third_party/llvm-project/libcxx/include/__ranges/istream_view.h
@@ -36,18 +36,10 @@ template <class _Val, class _CharT, class _Traits> concept __stream_extractable = requires(basic_istream<_CharT, _Traits>& __is, _Val& __t) { __is >> __t; }; -template <movable _Val, class _CharT, class _Traits> - requires default_initializable<_Val> && __stream_extractable<_Val, _CharT, _Traits> -class __basic_istream_view_iterator; - template <movable _Val, class _CharT, class _Traits = char_traits<_CharT>> requires default_initializable<_Val> && __stream_extractable<_Val, _CharT, _Traits> class basic_istream_view : public view_interface<basic_istream_view<_Val, _CharT, _Traits>> { - using __iterator = __basic_istream_view_iterator<_Val, _CharT, _Traits>; - - template <movable _ValueType, class _CharType, class _TraitsType> - requires default_initializable<_ValueType> && __stream_extractable<_ValueType, _CharType, _TraitsType> - friend class __basic_istream_view_iterator; + class __iterator; public: _LIBCPP_HIDE_FROM_ABI constexpr explicit basic_istream_view(basic_istream<_CharT, _Traits>& __stream) @@ -67,23 +59,23 @@ template <movable _Val, class _CharT, class _Traits> requires default_initializable<_Val> && __stream_extractable<_Val, _CharT, _Traits> -class __basic_istream_view_iterator { +class basic_istream_view<_Val, _CharT, _Traits>::__iterator { public: using iterator_concept = input_iterator_tag; using difference_type = ptrdiff_t; using value_type = _Val; - _LIBCPP_HIDE_FROM_ABI constexpr explicit __basic_istream_view_iterator( + _LIBCPP_HIDE_FROM_ABI constexpr explicit __iterator( basic_istream_view<_Val, _CharT, _Traits>& __parent) noexcept : __parent_(std::addressof(__parent)) {} - __basic_istream_view_iterator(const __basic_istream_view_iterator&) = delete; - _LIBCPP_HIDE_FROM_ABI __basic_istream_view_iterator(__basic_istream_view_iterator&&) = default; + __iterator(const __iterator&) = delete; + _LIBCPP_HIDE_FROM_ABI __iterator(__iterator&&) = default; - __basic_istream_view_iterator& operator=(const __basic_istream_view_iterator&) = delete; - _LIBCPP_HIDE_FROM_ABI __basic_istream_view_iterator& operator=(__basic_istream_view_iterator&&) = default; + __iterator& operator=(const __iterator&) = delete; + _LIBCPP_HIDE_FROM_ABI __iterator& operator=(__iterator&&) = default; - _LIBCPP_HIDE_FROM_ABI __basic_istream_view_iterator& operator++() { + _LIBCPP_HIDE_FROM_ABI __iterator& operator++() { *__parent_->__stream_ >> __parent_->__value_; return *this; } @@ -92,7 +84,7 @@ _LIBCPP_HIDE_FROM_ABI _Val& operator*() const { return __parent_->__value_; } - _LIBCPP_HIDE_FROM_ABI friend bool operator==(const __basic_istream_view_iterator& __x, default_sentinel_t) { + _LIBCPP_HIDE_FROM_ABI friend bool operator==(const __iterator& __x, default_sentinel_t) { return !*__x.__get_parent_stream(); }
diff --git a/third_party/llvm-project/libcxx/include/__ranges/join_view.h b/third_party/llvm-project/libcxx/include/__ranges/join_view.h index 869540f..83145ff 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/join_view.h +++ b/third_party/llvm-project/libcxx/include/__ranges/join_view.h
@@ -22,6 +22,7 @@ #include <__iterator/iterator_traits.h> #include <__iterator/iterator_with_data.h> #include <__iterator/segmented_iterator.h> +#include <__memory/addressof.h> #include <__ranges/access.h> #include <__ranges/all.h> #include <__ranges/concepts.h> @@ -32,7 +33,6 @@ #include <__type_traits/maybe_const.h> #include <__utility/forward.h> #include <optional> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -40,7 +40,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +// Note: `join_view` is still marked experimental because there is an ABI-breaking change that affects `join_view` in +// the pipeline (https://isocpp.org/files/papers/D2770R0.html). +// TODO: make `join_view` non-experimental once D2770 is implemented. +#if _LIBCPP_STD_VER >= 20 && defined(_LIBCPP_ENABLE_EXPERIMENTAL) namespace ranges { template<class> @@ -66,14 +69,6 @@ >; }; - template <input_range _View, bool _Const> - requires view<_View> && input_range<range_reference_t<_View>> - struct __join_view_iterator; - - template <input_range _View, bool _Const> - requires view<_View> && input_range<range_reference_t<_View>> - struct __join_view_sentinel; - template<input_range _View> requires view<_View> && input_range<range_reference_t<_View>> class join_view @@ -81,19 +76,9 @@ private: using _InnerRange = range_reference_t<_View>; - template<bool _Const> - using __iterator = __join_view_iterator<_View, _Const>; + template<bool> struct __iterator; - template<bool _Const> - using __sentinel = __join_view_sentinel<_View, _Const>; - - template <input_range _View2, bool _Const2> - requires view<_View2> && input_range<range_reference_t<_View2>> - friend struct __join_view_iterator; - - template <input_range _View2, bool _Const2> - requires view<_View2> && input_range<range_reference_t<_View2>> - friend struct __join_view_sentinel; + template<bool> struct __sentinel; template <class> friend struct std::__segmented_iterator_traits; @@ -164,12 +149,12 @@ } }; - template<input_range _View, bool _Const> + template<input_range _View> requires view<_View> && input_range<range_reference_t<_View>> - struct __join_view_sentinel { - template<input_range _View2, bool> - requires view<_View2> && input_range<range_reference_t<_View2>> - friend struct __join_view_sentinel; + template<bool _Const> + struct join_view<_View>::__sentinel { + template<bool> + friend struct __sentinel; private: using _Parent = __maybe_const<_Const, join_view<_View>>; @@ -178,37 +163,42 @@ public: _LIBCPP_HIDE_FROM_ABI - __join_view_sentinel() = default; + __sentinel() = default; _LIBCPP_HIDE_FROM_ABI - constexpr explicit __join_view_sentinel(_Parent& __parent) + constexpr explicit __sentinel(_Parent& __parent) : __end_(ranges::end(__parent.__base_)) {} _LIBCPP_HIDE_FROM_ABI - constexpr __join_view_sentinel(__join_view_sentinel<_View, !_Const> __s) + constexpr __sentinel(__sentinel<!_Const> __s) requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>> : __end_(std::move(__s.__end_)) {} template<bool _OtherConst> requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator==(const __join_view_iterator<_View, _OtherConst>& __x, const __join_view_sentinel& __y) { + friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) { return __x.__outer_ == __y.__end_; } }; - template<input_range _View, bool _Const> + // https://reviews.llvm.org/D142811#inline-1383022 + // To simplify the segmented iterator traits specialization, + // make the iterator `final` + template<input_range _View> requires view<_View> && input_range<range_reference_t<_View>> - struct __join_view_iterator + template<bool _Const> + struct join_view<_View>::__iterator final : public __join_view_iterator_category<__maybe_const<_Const, _View>> { - template<input_range _View2, bool> - requires view<_View2> && input_range<range_reference_t<_View2>> - friend struct __join_view_iterator; + template<bool> + friend struct __iterator; template <class> friend struct std::__segmented_iterator_traits; + static constexpr bool __is_join_view_iterator = true; + private: using _Parent = __maybe_const<_Const, join_view<_View>>; using _Base = __maybe_const<_Const, _View>; @@ -243,7 +233,7 @@ __inner_.reset(); } - _LIBCPP_HIDE_FROM_ABI constexpr __join_view_iterator(_Parent* __parent, _Outer __outer, _Inner __inner) + _LIBCPP_HIDE_FROM_ABI constexpr __iterator(_Parent* __parent, _Outer __outer, _Inner __inner) : __outer_(std::move(__outer)), __inner_(std::move(__inner)), __parent_(__parent) {} public: @@ -264,17 +254,17 @@ range_difference_t<_Base>, range_difference_t<range_reference_t<_Base>>>; _LIBCPP_HIDE_FROM_ABI - __join_view_iterator() requires default_initializable<_Outer> = default; + __iterator() requires default_initializable<_Outer> = default; _LIBCPP_HIDE_FROM_ABI - constexpr __join_view_iterator(_Parent& __parent, _Outer __outer) + constexpr __iterator(_Parent& __parent, _Outer __outer) : __outer_(std::move(__outer)) , __parent_(std::addressof(__parent)) { __satisfy(); } _LIBCPP_HIDE_FROM_ABI - constexpr __join_view_iterator(__join_view_iterator<_View, !_Const> __i) + constexpr __iterator(__iterator<!_Const> __i) requires _Const && convertible_to<iterator_t<_View>, _Outer> && convertible_to<iterator_t<_InnerRange>, _Inner> @@ -295,7 +285,7 @@ } _LIBCPP_HIDE_FROM_ABI - constexpr __join_view_iterator& operator++() { + constexpr __iterator& operator++() { auto&& __inner = [&]() -> auto&& { if constexpr (__ref_is_glvalue) return *__outer_; @@ -315,7 +305,7 @@ } _LIBCPP_HIDE_FROM_ABI - constexpr __join_view_iterator operator++(int) + constexpr __iterator operator++(int) requires __ref_is_glvalue && forward_range<_Base> && forward_range<range_reference_t<_Base>> @@ -326,7 +316,7 @@ } _LIBCPP_HIDE_FROM_ABI - constexpr __join_view_iterator& operator--() + constexpr __iterator& operator--() requires __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range<range_reference_t<_Base>> && @@ -345,7 +335,7 @@ } _LIBCPP_HIDE_FROM_ABI - constexpr __join_view_iterator operator--(int) + constexpr __iterator operator--(int) requires __ref_is_glvalue && bidirectional_range<_Base> && bidirectional_range<range_reference_t<_Base>> && @@ -357,7 +347,7 @@ } _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator==(const __join_view_iterator& __x, const __join_view_iterator& __y) + friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) requires __ref_is_glvalue && equality_comparable<iterator_t<_Base>> && equality_comparable<iterator_t<range_reference_t<_Base>>> @@ -366,14 +356,14 @@ } _LIBCPP_HIDE_FROM_ABI - friend constexpr decltype(auto) iter_move(const __join_view_iterator& __i) + friend constexpr decltype(auto) iter_move(const __iterator& __i) noexcept(noexcept(ranges::iter_move(*__i.__inner_))) { return ranges::iter_move(*__i.__inner_); } _LIBCPP_HIDE_FROM_ABI - friend constexpr void iter_swap(const __join_view_iterator& __x, const __join_view_iterator& __y) + friend constexpr void iter_swap(const __iterator& __x, const __iterator& __y) noexcept(noexcept(ranges::iter_swap(*__x.__inner_, *__y.__inner_))) requires indirectly_swappable<_Inner> { @@ -401,12 +391,12 @@ } // namespace views } // namespace ranges -template <class _View, bool _Const> - requires(ranges::common_range<typename ranges::__join_view_iterator<_View, _Const>::_Parent> && - __is_cpp17_random_access_iterator<typename ranges::__join_view_iterator<_View, _Const>::_Outer>::value && - __is_cpp17_random_access_iterator<typename ranges::__join_view_iterator<_View, _Const>::_Inner>::value) -struct __segmented_iterator_traits<ranges::__join_view_iterator<_View, _Const>> { - using _JoinViewIterator = ranges::__join_view_iterator<_View, _Const>; +template <class _JoinViewIterator> + requires(_JoinViewIterator::__is_join_view_iterator && + ranges::common_range<typename _JoinViewIterator::_Parent> && + __is_cpp17_random_access_iterator<typename _JoinViewIterator::_Outer>::value && + __is_cpp17_random_access_iterator<typename _JoinViewIterator::_Inner>::value) +struct __segmented_iterator_traits<_JoinViewIterator> { using __segment_iterator = _LIBCPP_NODEBUG __iterator_with_data<typename _JoinViewIterator::_Outer, typename _JoinViewIterator::_Parent*>; @@ -445,7 +435,7 @@ } }; -#endif // _LIBCPP_STD_VER > 17 +#endif // #if _LIBCPP_STD_VER >= 20 && defined(_LIBCPP_ENABLE_EXPERIMENTAL) _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/lazy_split_view.h b/third_party/llvm-project/libcxx/include/__ranges/lazy_split_view.h index 3a95075..186a0af 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/lazy_split_view.h +++ b/third_party/llvm-project/libcxx/include/__ranges/lazy_split_view.h
@@ -12,6 +12,7 @@ #include <__algorithm/ranges_find.h> #include <__algorithm/ranges_mismatch.h> +#include <__assert> #include <__concepts/constructible.h> #include <__concepts/convertible_to.h> #include <__concepts/derived_from.h> @@ -34,10 +35,13 @@ #include <__ranges/single_view.h> #include <__ranges/subrange.h> #include <__ranges/view_interface.h> +#include <__type_traits/conditional.h> +#include <__type_traits/decay.h> +#include <__type_traits/is_nothrow_constructible.h> #include <__type_traits/maybe_const.h> +#include <__type_traits/remove_reference.h> #include <__utility/forward.h> #include <__utility/move.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -45,7 +49,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { @@ -78,14 +82,14 @@ requires default_initializable<_View> && default_initializable<_Pattern> = default; _LIBCPP_HIDE_FROM_ABI - constexpr lazy_split_view(_View __base, _Pattern __pattern) + constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 lazy_split_view(_View __base, _Pattern __pattern) : __base_(std::move(__base)), __pattern_(std::move(__pattern)) {} template <input_range _Range> requires constructible_from<_View, views::all_t<_Range>> && constructible_from<_Pattern, single_view<range_value_t<_Range>>> _LIBCPP_HIDE_FROM_ABI - constexpr lazy_split_view(_Range&& __r, range_value_t<_Range> __e) + constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 lazy_split_view(_Range&& __r, range_value_t<_Range> __e) : __base_(views::all(std::forward<_Range>(__r))) , __pattern_(views::single(std::move(__e))) {} @@ -458,7 +462,7 @@ } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/non_propagating_cache.h b/third_party/llvm-project/libcxx/include/__ranges/non_propagating_cache.h index d50c577..2e6e72f 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/non_propagating_cache.h +++ b/third_party/llvm-project/libcxx/include/__ranges/non_propagating_cache.h
@@ -16,7 +16,6 @@ #include <__memory/addressof.h> #include <__utility/forward.h> #include <optional> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -24,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { // __non_propagating_cache is a helper type that allows storing an optional value in it, @@ -107,7 +106,7 @@ struct __empty_cache { }; } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/owning_view.h b/third_party/llvm-project/libcxx/include/__ranges/owning_view.h index e150f6d..cb1d0d5 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/owning_view.h +++ b/third_party/llvm-project/libcxx/include/__ranges/owning_view.h
@@ -20,8 +20,8 @@ #include <__ranges/enable_borrowed_range.h> #include <__ranges/size.h> #include <__ranges/view_interface.h> +#include <__type_traits/remove_cvref.h> #include <__utility/move.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -29,7 +29,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { template<range _Rp> @@ -76,7 +76,7 @@ } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/range_adaptor.h b/third_party/llvm-project/libcxx/include/__ranges/range_adaptor.h index 37e4817..f8fd2f6 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/range_adaptor.h +++ b/third_party/llvm-project/libcxx/include/__ranges/range_adaptor.h
@@ -20,7 +20,6 @@ #include <__ranges/concepts.h> #include <__utility/forward.h> #include <__utility/move.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -28,7 +27,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // CRTP base that one can derive from in order to be considered a range adaptor closure // by the library. When deriving from this class, a pipe operator will be provided to @@ -70,7 +69,7 @@ { return __range_adaptor_closure_t(std::__compose(std::forward<_OtherClosure>(__c2), std::forward<_Closure>(__c1))); } }; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/rbegin.h b/third_party/llvm-project/libcxx/include/__ranges/rbegin.h index 26b4732..1ceb111 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/rbegin.h +++ b/third_party/llvm-project/libcxx/include/__ranges/rbegin.h
@@ -17,8 +17,11 @@ #include <__iterator/readable_traits.h> #include <__iterator/reverse_iterator.h> #include <__ranges/access.h> +#include <__type_traits/decay.h> +#include <__type_traits/is_reference.h> +#include <__type_traits/remove_cvref.h> +#include <__type_traits/remove_reference.h> #include <__utility/auto_cast.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -26,7 +29,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [ranges.access.rbegin] @@ -124,7 +127,7 @@ } // namespace __cpo } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/ref_view.h b/third_party/llvm-project/libcxx/include/__ranges/ref_view.h index 1e5f746..be32b81 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/ref_view.h +++ b/third_party/llvm-project/libcxx/include/__ranges/ref_view.h
@@ -24,8 +24,9 @@ #include <__ranges/enable_borrowed_range.h> #include <__ranges/size.h> #include <__ranges/view_interface.h> +#include <__type_traits/is_object.h> +#include <__utility/declval.h> #include <__utility/forward.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -33,7 +34,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { template<range _Range> @@ -81,7 +82,7 @@ inline constexpr bool enable_borrowed_range<ref_view<_Tp>> = true; } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/rend.h b/third_party/llvm-project/libcxx/include/__ranges/rend.h index d2987e9..7ee574c 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/rend.h +++ b/third_party/llvm-project/libcxx/include/__ranges/rend.h
@@ -18,8 +18,11 @@ #include <__iterator/reverse_iterator.h> #include <__ranges/access.h> #include <__ranges/rbegin.h> +#include <__type_traits/decay.h> +#include <__type_traits/is_reference.h> +#include <__type_traits/remove_cvref.h> +#include <__type_traits/remove_reference.h> #include <__utility/auto_cast.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -27,7 +30,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // [range.access.rend] @@ -128,7 +131,7 @@ } // namespace __cpo } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/reverse_view.h b/third_party/llvm-project/libcxx/include/__ranges/reverse_view.h index d7b1378..01d1b97 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/reverse_view.h +++ b/third_party/llvm-project/libcxx/include/__ranges/reverse_view.h
@@ -24,9 +24,10 @@ #include <__ranges/size.h> #include <__ranges/subrange.h> #include <__ranges/view_interface.h> +#include <__type_traits/conditional.h> +#include <__type_traits/remove_cvref.h> #include <__utility/forward.h> #include <__utility/move.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -34,7 +35,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { template<view _View> @@ -184,7 +185,7 @@ } // namespace views } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/single_view.h b/third_party/llvm-project/libcxx/include/__ranges/single_view.h index 5c4b918..ccab2c1 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/single_view.h +++ b/third_party/llvm-project/libcxx/include/__ranges/single_view.h
@@ -15,10 +15,12 @@ #include <__ranges/copyable_box.h> #include <__ranges/range_adaptor.h> #include <__ranges/view_interface.h> +#include <__type_traits/decay.h> +#include <__type_traits/is_object.h> #include <__utility/forward.h> #include <__utility/in_place.h> #include <__utility/move.h> -#include <type_traits> +#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -26,7 +28,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { template<copy_constructible _Tp> @@ -95,7 +97,7 @@ } // namespace views } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/size.h b/third_party/llvm-project/libcxx/include/__ranges/size.h index 0ac8d63..f22dd1f 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/size.h +++ b/third_party/llvm-project/libcxx/include/__ranges/size.h
@@ -30,7 +30,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { template<class> @@ -141,7 +141,7 @@ } // namespace __cpo } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/split_view.h b/third_party/llvm-project/libcxx/include/__ranges/split_view.h index 9758ee9..a27ac4e 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/split_view.h +++ b/third_party/llvm-project/libcxx/include/__ranges/split_view.h
@@ -42,12 +42,6 @@ namespace ranges { -template <class _View, class _Pattern> -struct __split_view_iterator; - -template <class _View, class _Pattern> -struct __split_view_sentinel; - template <forward_range _View, forward_range _Pattern> requires view<_View> && view<_Pattern> && indirectly_comparable<iterator_t<_View>, iterator_t<_Pattern>, ranges::equal_to> @@ -59,13 +53,13 @@ _Cache __cached_begin_ = _Cache(); template <class, class> - friend struct __split_view_iterator; + friend struct __iterator; template <class, class> - friend struct __split_view_sentinel; + friend struct __sentinel; - using __iterator = __split_view_iterator<_View, _Pattern>; - using __sentinel = __split_view_sentinel<_View, _Pattern>; + struct __iterator; + struct __sentinel; _LIBCPP_HIDE_FROM_ABI constexpr subrange<iterator_t<_View>> __find_next(iterator_t<_View> __it) { auto [__begin, __end] = ranges::search(subrange(__it, ranges::end(__base_)), __pattern_); @@ -81,13 +75,14 @@ requires default_initializable<_View> && default_initializable<_Pattern> = default; - _LIBCPP_HIDE_FROM_ABI constexpr split_view(_View __base, _Pattern __pattern) + _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 split_view(_View __base, _Pattern __pattern) : __base_(std::move(__base)), __pattern_(std::move((__pattern))) {} template <forward_range _Range> requires constructible_from<_View, views::all_t<_Range>> && constructible_from<_Pattern, single_view<range_value_t<_Range>>> - _LIBCPP_HIDE_FROM_ABI constexpr split_view(_Range&& __range, range_value_t<_Range> __elem) + _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 + split_view(_Range&& __range, range_value_t<_Range> __elem) : __base_(views::all(std::forward<_Range>(__range))), __pattern_(views::single(std::move(__elem))) {} _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& @@ -120,16 +115,17 @@ template <forward_range _Range> split_view(_Range&&, range_value_t<_Range>) -> split_view<views::all_t<_Range>, single_view<range_value_t<_Range>>>; -template <class _View, class _Pattern> -struct __split_view_iterator { +template <forward_range _View, forward_range _Pattern> + requires view<_View> && view<_Pattern> && + indirectly_comparable<iterator_t<_View>, iterator_t<_Pattern>, ranges::equal_to> +struct split_view<_View, _Pattern>::__iterator { private: - split_view<_View, _Pattern>* __parent_ = nullptr; + split_view* __parent_ = nullptr; _LIBCPP_NO_UNIQUE_ADDRESS iterator_t<_View> __cur_ = iterator_t<_View>(); _LIBCPP_NO_UNIQUE_ADDRESS subrange<iterator_t<_View>> __next_ = subrange<iterator_t<_View>>(); bool __trailing_empty_ = false; - template <class, class> - friend struct __split_view_sentinel; + friend struct __sentinel; public: using iterator_concept = forward_iterator_tag; @@ -137,9 +133,9 @@ using value_type = subrange<iterator_t<_View>>; using difference_type = range_difference_t<_View>; - _LIBCPP_HIDE_FROM_ABI __split_view_iterator() = default; + _LIBCPP_HIDE_FROM_ABI __iterator() = default; - _LIBCPP_HIDE_FROM_ABI constexpr __split_view_iterator( + _LIBCPP_HIDE_FROM_ABI constexpr __iterator( split_view<_View, _Pattern>& __parent, iterator_t<_View> __current, subrange<iterator_t<_View>> __next) : __parent_(std::addressof(__parent)), __cur_(std::move(__current)), __next_(std::move(__next)) {} @@ -147,7 +143,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr value_type operator*() const { return {__cur_, __next_.begin()}; } - _LIBCPP_HIDE_FROM_ABI constexpr __split_view_iterator& operator++() { + _LIBCPP_HIDE_FROM_ABI constexpr __iterator& operator++() { __cur_ = __next_.begin(); if (__cur_ != ranges::end(__parent_->__base_)) { __cur_ = __next_.end(); @@ -163,36 +159,35 @@ return *this; } - _LIBCPP_HIDE_FROM_ABI constexpr __split_view_iterator operator++(int) { + _LIBCPP_HIDE_FROM_ABI constexpr __iterator operator++(int) { auto __tmp = *this; ++*this; return __tmp; } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool - operator==(const __split_view_iterator& __x, const __split_view_iterator& __y) { + _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) { return __x.__cur_ == __y.__cur_ && __x.__trailing_empty_ == __y.__trailing_empty_; } }; -template <class _View, class _Pattern> -struct __split_view_sentinel { +template <forward_range _View, forward_range _Pattern> + requires view<_View> && view<_Pattern> && + indirectly_comparable<iterator_t<_View>, iterator_t<_Pattern>, ranges::equal_to> +struct split_view<_View, _Pattern>::__sentinel { private: _LIBCPP_NO_UNIQUE_ADDRESS sentinel_t<_View> __end_ = sentinel_t<_View>(); - _LIBCPP_HIDE_FROM_ABI static constexpr bool - __equals(const __split_view_iterator<_View, _Pattern>& __x, const __split_view_sentinel& __y) { + _LIBCPP_HIDE_FROM_ABI static constexpr bool __equals(const __iterator& __x, const __sentinel& __y) { return __x.__cur_ == __y.__end_ && !__x.__trailing_empty_; } public: - _LIBCPP_HIDE_FROM_ABI __split_view_sentinel() = default; + _LIBCPP_HIDE_FROM_ABI __sentinel() = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit __split_view_sentinel(split_view<_View, _Pattern>& __parent) + _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(split_view<_View, _Pattern>& __parent) : __end_(ranges::end(__parent.__base_)) {} - _LIBCPP_HIDE_FROM_ABI friend constexpr bool - operator==(const __split_view_iterator<_View, _Pattern>& __x, const __split_view_sentinel& __y) { + _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __sentinel& __y) { return __equals(__x, __y); } };
diff --git a/third_party/llvm-project/libcxx/include/__ranges/subrange.h b/third_party/llvm-project/libcxx/include/__ranges/subrange.h index 2d9e4cc..b41b5db 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/subrange.h +++ b/third_party/llvm-project/libcxx/include/__ranges/subrange.h
@@ -29,9 +29,9 @@ #include <__ranges/enable_borrowed_range.h> #include <__ranges/size.h> #include <__ranges/view_interface.h> -#include <__tuple_dir/pair_like.h> -#include <__tuple_dir/tuple_element.h> -#include <__tuple_dir/tuple_size.h> +#include <__tuple/pair_like.h> +#include <__tuple/tuple_element.h> +#include <__tuple/tuple_size.h> #include <__type_traits/conditional.h> #include <__type_traits/decay.h> #include <__type_traits/is_pointer.h> @@ -48,7 +48,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { template<class _From, class _To> @@ -284,7 +284,7 @@ using type = _Sp; }; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/take_view.h b/third_party/llvm-project/libcxx/include/__ranges/take_view.h index bea3862..111e7e5 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/take_view.h +++ b/third_party/llvm-project/libcxx/include/__ranges/take_view.h
@@ -34,11 +34,14 @@ #include <__ranges/size.h> #include <__ranges/subrange.h> #include <__ranges/view_interface.h> +#include <__type_traits/decay.h> +#include <__type_traits/is_nothrow_constructible.h> #include <__type_traits/maybe_const.h> +#include <__type_traits/remove_cvref.h> #include <__utility/auto_cast.h> #include <__utility/forward.h> #include <__utility/move.h> -#include <type_traits> +#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -49,7 +52,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { @@ -64,7 +67,8 @@ _LIBCPP_HIDE_FROM_ABI take_view() requires default_initializable<_View> = default; - _LIBCPP_HIDE_FROM_ABI constexpr take_view(_View __base, range_difference_t<_View> __count) + _LIBCPP_HIDE_FROM_ABI + constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 take_view(_View __base, range_difference_t<_View> __count) : __base_(std::move(__base)), __count_(__count) { _LIBCPP_ASSERT(__count >= 0, "count has to be greater than or equal to zero"); } @@ -334,7 +338,7 @@ } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/take_while_view.h b/third_party/llvm-project/libcxx/include/__ranges/take_while_view.h index 59c0a4f..d1f1bfe 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/take_while_view.h +++ b/third_party/llvm-project/libcxx/include/__ranges/take_while_view.h
@@ -53,17 +53,11 @@ concept __take_while_const_is_range = range<const _View> && indirect_unary_predicate<const _Pred, iterator_t<const _View>>; -template <class, class, bool> -class __take_while_view_sentinel; - template <view _View, class _Pred> requires input_range<_View> && is_object_v<_Pred> && indirect_unary_predicate<const _Pred, iterator_t<_View>> class take_while_view : public view_interface<take_while_view<_View, _Pred>> { - template <class, class, bool> - friend class __take_while_view_sentinel; - - template <bool _Const> - using __sentinel = __take_while_view_sentinel<_View, _Pred, _Const>; + template <bool> + class __sentinel; _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); _LIBCPP_NO_UNIQUE_ADDRESS __copyable_box<_Pred> __pred_; @@ -73,7 +67,7 @@ requires default_initializable<_View> && default_initializable<_Pred> = default; - _LIBCPP_HIDE_FROM_ABI constexpr take_while_view(_View __base, _Pred __pred) + _LIBCPP_HIDE_FROM_ABI constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 take_while_view(_View __base, _Pred __pred) : __base_(std::move(__base)), __pred_(std::in_place, std::move(__pred)) {} _LIBCPP_HIDE_FROM_ABI constexpr _View base() const& @@ -114,37 +108,37 @@ template <class _Range, class _Pred> take_while_view(_Range&&, _Pred) -> take_while_view<views::all_t<_Range>, _Pred>; -template <class _View, class _Pred, bool _Const> -class __take_while_view_sentinel { +template <view _View, class _Pred> + requires input_range<_View> && is_object_v<_Pred> && indirect_unary_predicate<const _Pred, iterator_t<_View>> +template <bool _Const> +class take_while_view<_View, _Pred>::__sentinel { using _Base = __maybe_const<_Const, _View>; sentinel_t<_Base> __end_ = sentinel_t<_Base>(); const _Pred* __pred_ = nullptr; - template <class, class, bool> - friend class __take_while_view_sentinel; + friend class __sentinel<!_Const>; public: - _LIBCPP_HIDE_FROM_ABI __take_while_view_sentinel() = default; + _LIBCPP_HIDE_FROM_ABI __sentinel() = default; - _LIBCPP_HIDE_FROM_ABI constexpr explicit __take_while_view_sentinel(sentinel_t<_Base> __end, const _Pred* __pred) + _LIBCPP_HIDE_FROM_ABI constexpr explicit __sentinel(sentinel_t<_Base> __end, const _Pred* __pred) : __end_(std::move(__end)), __pred_(__pred) {} - _LIBCPP_HIDE_FROM_ABI constexpr __take_while_view_sentinel(__take_while_view_sentinel<_View, _Pred, !_Const> __s) + _LIBCPP_HIDE_FROM_ABI constexpr __sentinel(__sentinel<!_Const> __s) requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>> : __end_(std::move(__s.__end_)), __pred_(__s.__pred_) {} _LIBCPP_HIDE_FROM_ABI constexpr sentinel_t<_Base> base() const { return __end_; } - _LIBCPP_HIDE_FROM_ABI friend constexpr bool - operator==(const iterator_t<_Base>& __x, const __take_while_view_sentinel& __y) { + _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const iterator_t<_Base>& __x, const __sentinel& __y) { return __x == __y.__end_ || !std::invoke(*__y.__pred_, *__x); } template <bool _OtherConst = !_Const> requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> _LIBCPP_HIDE_FROM_ABI friend constexpr bool - operator==(const iterator_t<__maybe_const<_OtherConst, _View>>& __x, const __take_while_view_sentinel& __y) { + operator==(const iterator_t<__maybe_const<_OtherConst, _View>>& __x, const __sentinel& __y) { return __x == __y.__end_ || !std::invoke(*__y.__pred_, *__x); } };
diff --git a/third_party/llvm-project/libcxx/include/__ranges/transform_view.h b/third_party/llvm-project/libcxx/include/__ranges/transform_view.h index 66d9e80..14bd400 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/transform_view.h +++ b/third_party/llvm-project/libcxx/include/__ranges/transform_view.h
@@ -35,7 +35,6 @@ #include <__utility/forward.h> #include <__utility/in_place.h> #include <__utility/move.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -43,7 +42,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { @@ -57,31 +56,11 @@ regular_invocable<_Fn&, range_reference_t<_View>> && __can_reference<invoke_result_t<_Fn&, range_reference_t<_View>>>; -template <input_range _View, copy_constructible _Function, bool _IsConst> - requires __transform_view_constraints<_View, _Function> -class __transform_view_iterator; - -template <input_range _View, copy_constructible _Function, bool _IsConst> - requires __transform_view_constraints<_View, _Function> -class __transform_view_sentinel; - template<input_range _View, copy_constructible _Fn> requires __transform_view_constraints<_View, _Fn> class transform_view : public view_interface<transform_view<_View, _Fn>> { - - template <bool _IsConst> - using __iterator = __transform_view_iterator<_View, _Fn, _IsConst>; - - template <bool _IsConst> - using __sentinel = __transform_view_sentinel<_View, _Fn, _IsConst>; - - template <input_range _ViewType, copy_constructible _FunctionType, bool _IsConst> - requires __transform_view_constraints<_ViewType, _FunctionType> - friend class __transform_view_iterator; - - template <input_range _ViewType, copy_constructible _FunctionType, bool _IsConst> - requires __transform_view_constraints<_ViewType, _FunctionType> - friend class __transform_view_sentinel; + template<bool> class __iterator; + template<bool> class __sentinel; _LIBCPP_NO_UNIQUE_ADDRESS __copyable_box<_Fn> __func_; _LIBCPP_NO_UNIQUE_ADDRESS _View __base_ = _View(); @@ -92,7 +71,7 @@ requires default_initializable<_View> && default_initializable<_Fn> = default; _LIBCPP_HIDE_FROM_ABI - constexpr transform_view(_View __base, _Fn __func) + constexpr _LIBCPP_EXPLICIT_SINCE_CXX23 transform_view(_View __base, _Fn __func) : __func_(std::in_place, std::move(__func)), __base_(std::move(__base)) {} _LIBCPP_HIDE_FROM_ABI @@ -166,7 +145,7 @@ using _Cat = typename iterator_traits<iterator_t<_View>>::iterator_category; using iterator_category = conditional_t< - is_lvalue_reference_v<invoke_result_t<_Fn&, range_reference_t<_View>>>, + is_reference_v<invoke_result_t<_Fn&, range_reference_t<_View>>>, conditional_t< derived_from<_Cat, contiguous_iterator_tag>, random_access_iterator_tag, @@ -176,23 +155,22 @@ >; }; -template<input_range _View, copy_constructible _Fn, bool _Const> +template<input_range _View, copy_constructible _Fn> requires __transform_view_constraints<_View, _Fn> -class __transform_view_iterator +template<bool _Const> +class transform_view<_View, _Fn>::__iterator : public __transform_view_iterator_category_base<_View, _Fn> { - using _Parent = __maybe_const<_Const, transform_view<_View, _Fn>>; + using _Parent = __maybe_const<_Const, transform_view>; using _Base = __maybe_const<_Const, _View>; _Parent *__parent_ = nullptr; - template<input_range _ViewType, copy_constructible _FunctionType, bool _IsConst> - requires __transform_view_constraints<_ViewType, _FunctionType> - friend class __transform_view_iterator; + template<bool> + friend class transform_view<_View, _Fn>::__iterator; - template<input_range _ViewType, copy_constructible _FunctionType, bool _IsConst> - requires __transform_view_constraints<_ViewType, _FunctionType> - friend class __transform_view_sentinel; + template<bool> + friend class transform_view<_View, _Fn>::__sentinel; public: iterator_t<_Base> __current_ = iterator_t<_Base>(); @@ -202,17 +180,17 @@ using difference_type = range_difference_t<_Base>; _LIBCPP_HIDE_FROM_ABI - __transform_view_iterator() requires default_initializable<iterator_t<_Base>> = default; + __iterator() requires default_initializable<iterator_t<_Base>> = default; _LIBCPP_HIDE_FROM_ABI - constexpr __transform_view_iterator(_Parent& __parent, iterator_t<_Base> __current) + constexpr __iterator(_Parent& __parent, iterator_t<_Base> __current) : __parent_(std::addressof(__parent)), __current_(std::move(__current)) {} - // Note: `__i` should always be `__transform_view_iterator<false>`, but directly using - // `__transform_view_iterator<false>` is ill-formed when `_Const` is false + // Note: `__i` should always be `__iterator<false>`, but directly using + // `__iterator<false>` is ill-formed when `_Const` is false // (see http://wg21.link/class.copy.ctor#5). _LIBCPP_HIDE_FROM_ABI - constexpr __transform_view_iterator(__transform_view_iterator<_View, _Fn, !_Const> __i) + constexpr __iterator(__iterator<!_Const> __i) requires _Const && convertible_to<iterator_t<_View>, iterator_t<_Base>> : __parent_(__i.__parent_), __current_(std::move(__i.__current_)) {} @@ -234,7 +212,7 @@ } _LIBCPP_HIDE_FROM_ABI - constexpr __transform_view_iterator& operator++() { + constexpr __iterator& operator++() { ++__current_; return *this; } @@ -243,7 +221,7 @@ constexpr void operator++(int) { ++__current_; } _LIBCPP_HIDE_FROM_ABI - constexpr __transform_view_iterator operator++(int) + constexpr __iterator operator++(int) requires forward_range<_Base> { auto __tmp = *this; @@ -252,7 +230,7 @@ } _LIBCPP_HIDE_FROM_ABI - constexpr __transform_view_iterator& operator--() + constexpr __iterator& operator--() requires bidirectional_range<_Base> { --__current_; @@ -260,7 +238,7 @@ } _LIBCPP_HIDE_FROM_ABI - constexpr __transform_view_iterator operator--(int) + constexpr __iterator operator--(int) requires bidirectional_range<_Base> { auto __tmp = *this; @@ -269,7 +247,7 @@ } _LIBCPP_HIDE_FROM_ABI - constexpr __transform_view_iterator& operator+=(difference_type __n) + constexpr __iterator& operator+=(difference_type __n) requires random_access_range<_Base> { __current_ += __n; @@ -277,7 +255,7 @@ } _LIBCPP_HIDE_FROM_ABI - constexpr __transform_view_iterator& operator-=(difference_type __n) + constexpr __iterator& operator-=(difference_type __n) requires random_access_range<_Base> { __current_ -= __n; @@ -293,77 +271,77 @@ } _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator==(const __transform_view_iterator& __x, const __transform_view_iterator& __y) + friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) requires equality_comparable<iterator_t<_Base>> { return __x.__current_ == __y.__current_; } _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator<(const __transform_view_iterator& __x, const __transform_view_iterator& __y) + friend constexpr bool operator<(const __iterator& __x, const __iterator& __y) requires random_access_range<_Base> { return __x.__current_ < __y.__current_; } _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator>(const __transform_view_iterator& __x, const __transform_view_iterator& __y) + friend constexpr bool operator>(const __iterator& __x, const __iterator& __y) requires random_access_range<_Base> { return __x.__current_ > __y.__current_; } _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator<=(const __transform_view_iterator& __x, const __transform_view_iterator& __y) + friend constexpr bool operator<=(const __iterator& __x, const __iterator& __y) requires random_access_range<_Base> { return __x.__current_ <= __y.__current_; } _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator>=(const __transform_view_iterator& __x, const __transform_view_iterator& __y) + friend constexpr bool operator>=(const __iterator& __x, const __iterator& __y) requires random_access_range<_Base> { return __x.__current_ >= __y.__current_; } _LIBCPP_HIDE_FROM_ABI - friend constexpr auto operator<=>(const __transform_view_iterator& __x, const __transform_view_iterator& __y) + friend constexpr auto operator<=>(const __iterator& __x, const __iterator& __y) requires random_access_range<_Base> && three_way_comparable<iterator_t<_Base>> { return __x.__current_ <=> __y.__current_; } _LIBCPP_HIDE_FROM_ABI - friend constexpr __transform_view_iterator operator+(__transform_view_iterator __i, difference_type __n) + friend constexpr __iterator operator+(__iterator __i, difference_type __n) requires random_access_range<_Base> { - return __transform_view_iterator{*__i.__parent_, __i.__current_ + __n}; + return __iterator{*__i.__parent_, __i.__current_ + __n}; } _LIBCPP_HIDE_FROM_ABI - friend constexpr __transform_view_iterator operator+(difference_type __n, __transform_view_iterator __i) + friend constexpr __iterator operator+(difference_type __n, __iterator __i) requires random_access_range<_Base> { - return __transform_view_iterator{*__i.__parent_, __i.__current_ + __n}; + return __iterator{*__i.__parent_, __i.__current_ + __n}; } _LIBCPP_HIDE_FROM_ABI - friend constexpr __transform_view_iterator operator-(__transform_view_iterator __i, difference_type __n) + friend constexpr __iterator operator-(__iterator __i, difference_type __n) requires random_access_range<_Base> { - return __transform_view_iterator{*__i.__parent_, __i.__current_ - __n}; + return __iterator{*__i.__parent_, __i.__current_ - __n}; } _LIBCPP_HIDE_FROM_ABI - friend constexpr difference_type operator-(const __transform_view_iterator& __x, const __transform_view_iterator& __y) + friend constexpr difference_type operator-(const __iterator& __x, const __iterator& __y) requires sized_sentinel_for<iterator_t<_Base>, iterator_t<_Base>> { return __x.__current_ - __y.__current_; } _LIBCPP_HIDE_FROM_ABI - friend constexpr decltype(auto) iter_move(const __transform_view_iterator& __i) + friend constexpr decltype(auto) iter_move(const __iterator& __i) noexcept(noexcept(*__i)) { if constexpr (is_lvalue_reference_v<decltype(*__i)>) @@ -373,37 +351,33 @@ } }; -template<input_range _View, copy_constructible _Fn, bool _Const> +template<input_range _View, copy_constructible _Fn> requires __transform_view_constraints<_View, _Fn> -class __transform_view_sentinel { - using _Parent = __maybe_const<_Const, transform_view<_View, _Fn>>; +template<bool _Const> +class transform_view<_View, _Fn>::__sentinel { + using _Parent = __maybe_const<_Const, transform_view>; using _Base = __maybe_const<_Const, _View>; - template <bool _IsConst> - using __iterator = __transform_view_iterator<_View, _Fn, _IsConst>; - sentinel_t<_Base> __end_ = sentinel_t<_Base>(); - template<input_range _ViewType, copy_constructible _FunctionType, bool _IsConst> - requires __transform_view_constraints<_ViewType, _FunctionType> - friend class __transform_view_iterator; + template<bool> + friend class transform_view<_View, _Fn>::__iterator; - template<input_range _ViewType, copy_constructible _FunctionType, bool _IsConst> - requires __transform_view_constraints<_ViewType, _FunctionType> - friend class __transform_view_sentinel; + template<bool> + friend class transform_view<_View, _Fn>::__sentinel; public: _LIBCPP_HIDE_FROM_ABI - __transform_view_sentinel() = default; + __sentinel() = default; _LIBCPP_HIDE_FROM_ABI - constexpr explicit __transform_view_sentinel(sentinel_t<_Base> __end) : __end_(__end) {} + constexpr explicit __sentinel(sentinel_t<_Base> __end) : __end_(__end) {} - // Note: `__i` should always be `__transform_view_sentinel<false>`, but directly using - // `__transform_view_sentinel<false>` is ill-formed when `_Const` is false + // Note: `__i` should always be `__sentinel<false>`, but directly using + // `__sentinel<false>` is ill-formed when `_Const` is false // (see http://wg21.link/class.copy.ctor#5). _LIBCPP_HIDE_FROM_ABI - constexpr __transform_view_sentinel(__transform_view_sentinel<_View, _Fn, !_Const> __i) + constexpr __sentinel(__sentinel<!_Const> __i) requires _Const && convertible_to<sentinel_t<_View>, sentinel_t<_Base>> : __end_(std::move(__i.__end_)) {} @@ -413,7 +387,7 @@ template<bool _OtherConst> requires sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> _LIBCPP_HIDE_FROM_ABI - friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __transform_view_sentinel& __y) { + friend constexpr bool operator==(const __iterator<_OtherConst>& __x, const __sentinel& __y) { return __x.__current_ == __y.__end_; } @@ -421,7 +395,7 @@ requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> - operator-(const __iterator<_OtherConst>& __x, const __transform_view_sentinel& __y) { + operator-(const __iterator<_OtherConst>& __x, const __sentinel& __y) { return __x.__current_ - __y.__end_; } @@ -429,7 +403,7 @@ requires sized_sentinel_for<sentinel_t<_Base>, iterator_t<__maybe_const<_OtherConst, _View>>> _LIBCPP_HIDE_FROM_ABI friend constexpr range_difference_t<__maybe_const<_OtherConst, _View>> - operator-(const __transform_view_sentinel& __x, const __iterator<_OtherConst>& __y) { + operator-(const __sentinel& __x, const __iterator<_OtherConst>& __y) { return __x.__end_ - __y.__current_; } }; @@ -460,7 +434,7 @@ } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/view_interface.h b/third_party/llvm-project/libcxx/include/__ranges/view_interface.h index 5581eb9..0a14d0d 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/view_interface.h +++ b/third_party/llvm-project/libcxx/include/__ranges/view_interface.h
@@ -31,7 +31,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { @@ -170,7 +170,7 @@ } // namespace ranges -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/views.h b/third_party/llvm-project/libcxx/include/__ranges/views.h index d40c64a..906c4e4 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/views.h +++ b/third_party/llvm-project/libcxx/include/__ranges/views.h
@@ -18,7 +18,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 namespace ranges { @@ -28,7 +28,7 @@ namespace views = ranges::views; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__ranges/zip_view.h b/third_party/llvm-project/libcxx/include/__ranges/zip_view.h index 5624726..b2067f6 100644 --- a/third_party/llvm-project/libcxx/include/__ranges/zip_view.h +++ b/third_party/llvm-project/libcxx/include/__ranges/zip_view.h
@@ -30,11 +30,11 @@ #include <__ranges/enable_borrowed_range.h> #include <__ranges/size.h> #include <__ranges/view_interface.h> +#include <__utility/declval.h> #include <__utility/forward.h> #include <__utility/integer_sequence.h> #include <__utility/move.h> #include <tuple> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -45,7 +45,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 namespace ranges { @@ -77,7 +77,9 @@ template <class _Fun, class _Tuple> _LIBCPP_HIDE_FROM_ABI constexpr void __tuple_for_each(_Fun&& __f, _Tuple&& __tuple) { std::apply( - [&]<class... _Types>(_Types&&... __elements) { (std::invoke(__f, std::forward<_Types>(__elements)), ...); }, + [&]<class... _Types>(_Types&&... __elements) { + (static_cast<void>(std::invoke(__f, std::forward<_Types>(__elements))), ...); + }, std::forward<_Tuple>(__tuple)); } @@ -503,7 +505,7 @@ } // namespace views } // namespace ranges -#endif // _LIBCPP_STD_VER > 20 +#endif // _LIBCPP_STD_VER >= 23 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__split_buffer b/third_party/llvm-project/libcxx/include/__split_buffer index 7d0beda..c4f1315 100644 --- a/third_party/llvm-project/libcxx/include/__split_buffer +++ b/third_party/llvm-project/libcxx/include/__split_buffer
@@ -23,9 +23,18 @@ #include <__memory/compressed_pair.h> #include <__memory/pointer_traits.h> #include <__memory/swap_allocator.h> +#include <__type_traits/add_lvalue_reference.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_nothrow_default_constructible.h> +#include <__type_traits/is_nothrow_move_assignable.h> +#include <__type_traits/is_nothrow_move_constructible.h> +#include <__type_traits/is_swappable.h> +#include <__type_traits/is_trivially_destructible.h> +#include <__type_traits/remove_reference.h> #include <__utility/forward.h> #include <__utility/move.h> -#include <type_traits> +#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -44,139 +53,165 @@ template <class _Tp, class _Allocator = allocator<_Tp> > struct __split_buffer { -private: - __split_buffer(const __split_buffer&); - __split_buffer& operator=(const __split_buffer&); public: - typedef _Tp value_type; - typedef _Allocator allocator_type; - typedef __libcpp_remove_reference_t<allocator_type> __alloc_rr; - typedef allocator_traits<__alloc_rr> __alloc_traits; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef typename __alloc_traits::size_type size_type; - typedef typename __alloc_traits::difference_type difference_type; - typedef typename __alloc_traits::pointer pointer; - typedef typename __alloc_traits::const_pointer const_pointer; - typedef pointer iterator; - typedef const_pointer const_iterator; + using value_type = _Tp; + using allocator_type = _Allocator; + using __alloc_rr = __libcpp_remove_reference_t<allocator_type>; + using __alloc_traits = allocator_traits<__alloc_rr>; + using reference = value_type&; + using const_reference = const value_type&; + using size_type = typename __alloc_traits::size_type; + using difference_type = typename __alloc_traits::difference_type; + using pointer = typename __alloc_traits::pointer; + using const_pointer = typename __alloc_traits::const_pointer; + using iterator = pointer; + using const_iterator = const_pointer; - pointer __first_; - pointer __begin_; - pointer __end_; - __compressed_pair<pointer, allocator_type> __end_cap_; + pointer __first_; + pointer __begin_; + pointer __end_; + __compressed_pair<pointer, allocator_type> __end_cap_; - typedef __add_lvalue_reference_t<allocator_type> __alloc_ref; - typedef __add_lvalue_reference_t<allocator_type> __alloc_const_ref; + using __alloc_ref = __add_lvalue_reference_t<allocator_type>; + using __alloc_const_ref = __add_lvalue_reference_t<allocator_type>; - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __alloc_rr& __alloc() _NOEXCEPT {return __end_cap_.second();} - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const __alloc_rr& __alloc() const _NOEXCEPT {return __end_cap_.second();} - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer& __end_cap() _NOEXCEPT {return __end_cap_.first();} - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const pointer& __end_cap() const _NOEXCEPT {return __end_cap_.first();} + __split_buffer(const __split_buffer&) = delete; + __split_buffer& operator=(const __split_buffer&) = delete; - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI - __split_buffer() - _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value); - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI - explicit __split_buffer(__alloc_rr& __a); - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI - explicit __split_buffer(const __alloc_rr& __a); - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer(size_type __cap, size_type __start, __alloc_rr& __a); - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~__split_buffer(); + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer() + _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) + : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __default_init_tag()) {} - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer(__split_buffer&& __c) - _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value); - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer(__split_buffer&& __c, const __alloc_rr& __a); - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer& operator=(__split_buffer&& __c) - _NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value && - is_nothrow_move_assignable<allocator_type>::value) || - !__alloc_traits::propagate_on_container_move_assignment::value); + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit __split_buffer(__alloc_rr& __a) + : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a) {} - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT {return __begin_;} - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT {return __begin_;} - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT {return __end_;} - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT {return __end_;} + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit __split_buffer(const __alloc_rr& __a) + : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a) {} - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI - void clear() _NOEXCEPT - {__destruct_at_end(__begin_);} - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type size() const {return static_cast<size_type>(__end_ - __begin_);} - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool empty() const {return __end_ == __begin_;} - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type capacity() const {return static_cast<size_type>(__end_cap() - __first_);} - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __front_spare() const {return static_cast<size_type>(__begin_ - __first_);} - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __back_spare() const {return static_cast<size_type>(__end_cap() - __end_);} + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI + __split_buffer(size_type __cap, size_type __start, __alloc_rr& __a); - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference front() {return *__begin_;} - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference front() const {return *__begin_;} - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference back() {return *(__end_ - 1);} - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference back() const {return *(__end_ - 1);} + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer(__split_buffer&& __c) + _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value); - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n); - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void shrink_to_fit() _NOEXCEPT; - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_front(const_reference __x); - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_back(const_reference __x); - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_front(value_type&& __x); - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __x); - template <class... _Args> - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void emplace_back(_Args&&... __args); + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer(__split_buffer&& __c, const __alloc_rr& __a); - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void pop_front() {__destruct_at_begin(__begin_+1);} - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void pop_back() {__destruct_at_end(__end_-1);} + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __split_buffer& operator=(__split_buffer&& __c) + _NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value && + is_nothrow_move_assignable<allocator_type>::value) || + !__alloc_traits::propagate_on_container_move_assignment::value); - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_at_end(size_type __n); - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_at_end(size_type __n, const_reference __x); - template <class _InputIter> - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __enable_if_t<__is_exactly_cpp17_input_iterator<_InputIter>::value> - __construct_at_end(_InputIter __first, _InputIter __last); - template <class _ForwardIterator> - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value> - __construct_at_end(_ForwardIterator __first, _ForwardIterator __last); + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~__split_buffer(); - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __destruct_at_begin(pointer __new_begin) - {__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());} - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI - void __destruct_at_begin(pointer __new_begin, false_type); - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI - void __destruct_at_begin(pointer __new_begin, true_type); + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI __alloc_rr& __alloc() _NOEXCEPT { return __end_cap_.second(); } + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const __alloc_rr& __alloc() const _NOEXCEPT { + return __end_cap_.second(); + } - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI - void __destruct_at_end(pointer __new_last) _NOEXCEPT - {__destruct_at_end(__new_last, false_type());} - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI - void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT; - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI - void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT; + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI pointer& __end_cap() _NOEXCEPT { return __end_cap_.first(); } + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const pointer& __end_cap() const _NOEXCEPT { + return __end_cap_.first(); + } - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void swap(__split_buffer& __x) - _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value|| - __is_nothrow_swappable<__alloc_rr>::value); + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator begin() _NOEXCEPT { return __begin_; } + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator begin() const _NOEXCEPT { return __begin_; } - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __invariants() const; + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI iterator end() _NOEXCEPT { return __end_; } + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_iterator end() const _NOEXCEPT { return __end_; } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { __destruct_at_end(__begin_); } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type size() const { + return static_cast<size_type>(__end_ - __begin_); + } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool empty() const { return __end_ == __begin_; } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type capacity() const { + return static_cast<size_type>(__end_cap() - __first_); + } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __front_spare() const { + return static_cast<size_type>(__begin_ - __first_); + } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI size_type __back_spare() const { + return static_cast<size_type>(__end_cap() - __end_); + } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference front() { return *__begin_; } + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference front() const { return *__begin_; } + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI reference back() { return *(__end_ - 1); } + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI const_reference back() const { return *(__end_ - 1); } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void reserve(size_type __n); + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void shrink_to_fit() _NOEXCEPT; + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_front(const_reference __x); + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_back(const_reference __x); + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_front(value_type&& __x); + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void push_back(value_type&& __x); + + template <class... _Args> + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void emplace_back(_Args&&... __args); + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void pop_front() { __destruct_at_begin(__begin_ + 1); } + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void pop_back() { __destruct_at_end(__end_ - 1); } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_at_end(size_type __n); + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __construct_at_end(size_type __n, const_reference __x); + + template <class _InputIter> + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI + __enable_if_t<__is_exactly_cpp17_input_iterator<_InputIter>::value> + __construct_at_end(_InputIter __first, _InputIter __last); + + template <class _ForwardIterator> + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI + __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value> + __construct_at_end(_ForwardIterator __first, _ForwardIterator __last); + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __destruct_at_begin(pointer __new_begin) { + __destruct_at_begin(__new_begin, is_trivially_destructible<value_type>()); + } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __destruct_at_begin(pointer __new_begin, false_type); + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __destruct_at_begin(pointer __new_begin, true_type); + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __destruct_at_end(pointer __new_last) _NOEXCEPT { + __destruct_at_end(__new_last, false_type()); + } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT; + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT; + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void swap(__split_buffer& __x) + _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__alloc_rr>::value); + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI bool __invariants() const; private: - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI - void __move_assign_alloc(__split_buffer& __c, true_type) - _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) - { - __alloc() = _VSTD::move(__c.__alloc()); - } + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__split_buffer& __c, true_type) + _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) { + __alloc() = _VSTD::move(__c.__alloc()); + } - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI - void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT - {} + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT {} - struct _ConstructTransaction { - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit _ConstructTransaction(pointer* __p, size_type __n) _NOEXCEPT - : __pos_(*__p), __end_(*__p + __n), __dest_(__p) { - } - _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() { - *__dest_ = __pos_; - } - pointer __pos_; - const pointer __end_; - private: - pointer *__dest_; - }; + struct _ConstructTransaction { + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit _ConstructTransaction( + pointer* __p, size_type __n) _NOEXCEPT + : __pos_(*__p), + __end_(*__p + __n), + __dest_(__p) {} + + _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI ~_ConstructTransaction() { *__dest_ = __pos_; } + + pointer __pos_; + const pointer __end_; + + private: + pointer* __dest_; + }; }; template <class _Tp, class _Allocator> @@ -330,31 +365,6 @@ template <class _Tp, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 -inline -__split_buffer<_Tp, _Allocator>::__split_buffer() - _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value) - : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __default_init_tag()) -{ -} - -template <class _Tp, class _Allocator> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -inline -__split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a) - : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a) -{ -} - -template <class _Tp, class _Allocator> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -inline -__split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a) - : __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a) -{ -} - -template <class _Tp, class _Allocator> -_LIBCPP_CONSTEXPR_SINCE_CXX20 __split_buffer<_Tp, _Allocator>::~__split_buffer() { clear(); @@ -463,10 +473,10 @@ { if (capacity() > size()) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __split_buffer<value_type, __alloc_rr&> __t(size(), 0, __alloc()); __t.__construct_at_end(move_iterator<pointer>(__begin_), move_iterator<pointer>(__end_)); @@ -475,12 +485,12 @@ _VSTD::swap(__begin_, __t.__begin_); _VSTD::swap(__end_, __t.__end_); _VSTD::swap(__end_cap(), __t.__end_cap()); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } }
diff --git a/third_party/llvm-project/libcxx/include/__std_stream b/third_party/llvm-project/libcxx/include/__std_stream deleted file mode 100644 index e419e8c..0000000 --- a/third_party/llvm-project/libcxx/include/__std_stream +++ /dev/null
@@ -1,361 +0,0 @@ -// -*- 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___STD_STREAM -#define _LIBCPP___STD_STREAM - -#include <__config> -#include <__locale> -#include <cstdio> -#include <istream> -#include <ostream> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - - -_LIBCPP_BEGIN_NAMESPACE_STD - -static const int __limit = 8; - -// __stdinbuf - -template <class _CharT> -class _LIBCPP_HIDDEN __stdinbuf - : public basic_streambuf<_CharT, char_traits<_CharT> > -{ -public: - typedef _CharT char_type; - typedef char_traits<char_type> traits_type; - typedef typename traits_type::int_type int_type; - typedef typename traits_type::pos_type pos_type; - typedef typename traits_type::off_type off_type; - typedef typename traits_type::state_type state_type; - - __stdinbuf(FILE* __fp, state_type* __st); - -protected: - virtual int_type underflow(); - virtual int_type uflow(); - virtual int_type pbackfail(int_type __c = traits_type::eof()); - virtual void imbue(const locale& __loc); - -private: - - FILE* __file_; - const codecvt<char_type, char, state_type>* __cv_; - state_type* __st_; - int __encoding_; - int_type __last_consumed_; - bool __last_consumed_is_next_; - bool __always_noconv_; - - __stdinbuf(const __stdinbuf&); - __stdinbuf& operator=(const __stdinbuf&); - - int_type __getchar(bool __consume); -}; - -template <class _CharT> -__stdinbuf<_CharT>::__stdinbuf(FILE* __fp, state_type* __st) - : __file_(__fp), - __st_(__st), - __last_consumed_(traits_type::eof()), - __last_consumed_is_next_(false) -{ - imbue(this->getloc()); -} - -template <class _CharT> -void -__stdinbuf<_CharT>::imbue(const locale& __loc) -{ - __cv_ = &use_facet<codecvt<char_type, char, state_type> >(__loc); - __encoding_ = __cv_->encoding(); - __always_noconv_ = __cv_->always_noconv(); - if (__encoding_ > __limit) - __throw_runtime_error("unsupported locale for standard input"); -} - -template <class _CharT> -typename __stdinbuf<_CharT>::int_type -__stdinbuf<_CharT>::underflow() -{ - return __getchar(false); -} - -template <class _CharT> -typename __stdinbuf<_CharT>::int_type -__stdinbuf<_CharT>::uflow() -{ - return __getchar(true); -} - -template <class _CharT> -typename __stdinbuf<_CharT>::int_type -__stdinbuf<_CharT>::__getchar(bool __consume) -{ - if (__last_consumed_is_next_) - { - int_type __result = __last_consumed_; - if (__consume) - { - __last_consumed_ = traits_type::eof(); - __last_consumed_is_next_ = false; - } - return __result; - } - char __extbuf[__limit]; - int __nread = _VSTD::max(1, __encoding_); - for (int __i = 0; __i < __nread; ++__i) - { - int __c = getc(__file_); - if (__c == EOF) - return traits_type::eof(); - __extbuf[__i] = static_cast<char>(__c); - } - char_type __1buf; - if (__always_noconv_) - __1buf = static_cast<char_type>(__extbuf[0]); - else - { - const char* __enxt; - char_type* __inxt; - codecvt_base::result __r; - do - { - state_type __sv_st = *__st_; - __r = __cv_->in(*__st_, __extbuf, __extbuf + __nread, __enxt, - &__1buf, &__1buf + 1, __inxt); - switch (__r) - { - case _VSTD::codecvt_base::ok: - break; - case codecvt_base::partial: - *__st_ = __sv_st; - if (__nread == sizeof(__extbuf)) - return traits_type::eof(); - { - int __c = getc(__file_); - if (__c == EOF) - return traits_type::eof(); - __extbuf[__nread] = static_cast<char>(__c); - } - ++__nread; - break; - case codecvt_base::error: - return traits_type::eof(); - case _VSTD::codecvt_base::noconv: - __1buf = static_cast<char_type>(__extbuf[0]); - break; - } - } while (__r == _VSTD::codecvt_base::partial); - } - if (!__consume) - { - for (int __i = __nread; __i > 0;) - { - if (ungetc(traits_type::to_int_type(__extbuf[--__i]), __file_) == EOF) - return traits_type::eof(); - } - } - else - __last_consumed_ = traits_type::to_int_type(__1buf); - return traits_type::to_int_type(__1buf); -} - -template <class _CharT> -typename __stdinbuf<_CharT>::int_type -__stdinbuf<_CharT>::pbackfail(int_type __c) -{ - if (traits_type::eq_int_type(__c, traits_type::eof())) - { - if (!__last_consumed_is_next_) - { - __c = __last_consumed_; - __last_consumed_is_next_ = !traits_type::eq_int_type(__last_consumed_, - traits_type::eof()); - } - return __c; - } - if (__last_consumed_is_next_) - { - char __extbuf[__limit]; - char* __enxt; - const char_type __ci = traits_type::to_char_type(__last_consumed_); - const char_type* __inxt; - switch (__cv_->out(*__st_, &__ci, &__ci + 1, __inxt, - __extbuf, __extbuf + sizeof(__extbuf), __enxt)) - { - case _VSTD::codecvt_base::ok: - break; - case _VSTD::codecvt_base::noconv: - __extbuf[0] = static_cast<char>(__last_consumed_); - __enxt = __extbuf + 1; - break; - case codecvt_base::partial: - case codecvt_base::error: - return traits_type::eof(); - } - while (__enxt > __extbuf) - if (ungetc(*--__enxt, __file_) == EOF) - return traits_type::eof(); - } - __last_consumed_ = __c; - __last_consumed_is_next_ = true; - return __c; -} - -// __stdoutbuf - -template <class _CharT> -class _LIBCPP_HIDDEN __stdoutbuf - : public basic_streambuf<_CharT, char_traits<_CharT> > -{ -public: - typedef _CharT char_type; - typedef char_traits<char_type> traits_type; - typedef typename traits_type::int_type int_type; - typedef typename traits_type::pos_type pos_type; - typedef typename traits_type::off_type off_type; - typedef typename traits_type::state_type state_type; - - __stdoutbuf(FILE* __fp, state_type* __st); - -protected: - virtual int_type overflow (int_type __c = traits_type::eof()); - virtual streamsize xsputn(const char_type* __s, streamsize __n); - virtual int sync(); - virtual void imbue(const locale& __loc); - -private: - FILE* __file_; - const codecvt<char_type, char, state_type>* __cv_; - state_type* __st_; - bool __always_noconv_; - - __stdoutbuf(const __stdoutbuf&); - __stdoutbuf& operator=(const __stdoutbuf&); -}; - -template <class _CharT> -__stdoutbuf<_CharT>::__stdoutbuf(FILE* __fp, state_type* __st) - : __file_(__fp), - __cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())), - __st_(__st), - __always_noconv_(__cv_->always_noconv()) -{ -} - -template <class _CharT> -typename __stdoutbuf<_CharT>::int_type -__stdoutbuf<_CharT>::overflow(int_type __c) -{ - char __extbuf[__limit]; - char_type __1buf; - if (!traits_type::eq_int_type(__c, traits_type::eof())) - { - __1buf = traits_type::to_char_type(__c); - if (__always_noconv_) - { - if (fwrite(&__1buf, sizeof(char_type), 1, __file_) != 1) - return traits_type::eof(); - } - else - { - char* __extbe = __extbuf; - codecvt_base::result __r; - char_type* pbase = &__1buf; - char_type* pptr = pbase + 1; - do - { - const char_type* __e; - __r = __cv_->out(*__st_, pbase, pptr, __e, - __extbuf, - __extbuf + sizeof(__extbuf), - __extbe); - if (__e == pbase) - return traits_type::eof(); - if (__r == codecvt_base::noconv) - { - if (fwrite(pbase, 1, 1, __file_) != 1) - return traits_type::eof(); - } - else if (__r == codecvt_base::ok || __r == codecvt_base::partial) - { - size_t __nmemb = static_cast<size_t>(__extbe - __extbuf); - if (fwrite(__extbuf, 1, __nmemb, __file_) != __nmemb) - return traits_type::eof(); - if (__r == codecvt_base::partial) - { - pbase = const_cast<char_type*>(__e); - } - } - else - return traits_type::eof(); - } while (__r == codecvt_base::partial); - } - } - return traits_type::not_eof(__c); -} - -template <class _CharT> -streamsize -__stdoutbuf<_CharT>::xsputn(const char_type* __s, streamsize __n) -{ - if (__always_noconv_) - return fwrite(__s, sizeof(char_type), __n, __file_); - streamsize __i = 0; - for (; __i < __n; ++__i, ++__s) - if (overflow(traits_type::to_int_type(*__s)) == traits_type::eof()) - break; - return __i; -} - -template <class _CharT> -int -__stdoutbuf<_CharT>::sync() -{ - char __extbuf[__limit]; - codecvt_base::result __r; - do - { - char* __extbe; - __r = __cv_->unshift(*__st_, __extbuf, - __extbuf + sizeof(__extbuf), - __extbe); - size_t __nmemb = static_cast<size_t>(__extbe - __extbuf); - if (fwrite(__extbuf, 1, __nmemb, __file_) != __nmemb) - return -1; - } while (__r == codecvt_base::partial); - if (__r == codecvt_base::error) - return -1; - if (fflush(__file_)) - return -1; - return 0; -} - -template <class _CharT> -void -__stdoutbuf<_CharT>::imbue(const locale& __loc) -{ - sync(); - __cv_ = &use_facet<codecvt<char_type, char, state_type> >(__loc); - __always_noconv_ = __cv_->always_noconv(); -} - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___STD_STREAM
diff --git a/third_party/llvm-project/libcxx/include/__string/char_traits.h b/third_party/llvm-project/libcxx/include/__string/char_traits.h index 622ee22..9d96242 100644 --- a/third_party/llvm-project/libcxx/include/__string/char_traits.h +++ b/third_party/llvm-project/libcxx/include/__string/char_traits.h
@@ -18,11 +18,11 @@ #include <__config> #include <__functional/hash.h> #include <__iterator/iterator_traits.h> +#include <__string/constexpr_c_functions.h> #include <__type_traits/is_constant_evaluated.h> #include <cstddef> #include <cstdint> #include <cstdio> -#include <cstring> #include <iosfwd> #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS @@ -199,7 +199,7 @@ using off_type = streamoff; using pos_type = streampos; using state_type = mbstate_t; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 using comparison_category = strong_ordering; #endif @@ -269,7 +269,7 @@ using off_type = streamoff; using pos_type = streampos; using state_type = mbstate_t; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 using comparison_category = strong_ordering; #endif @@ -339,7 +339,7 @@ using off_type = streamoff; using pos_type = u8streampos; using state_type = mbstate_t; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 using comparison_category = strong_ordering; #endif @@ -427,7 +427,7 @@ using off_type = streamoff; using pos_type = u16streampos; using state_type = mbstate_t; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 using comparison_category = strong_ordering; #endif @@ -521,7 +521,7 @@ using off_type = streamoff; using pos_type = u32streampos; using state_type = mbstate_t; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 using comparison_category = strong_ordering; #endif
diff --git a/third_party/llvm-project/libcxx/include/__string/constexpr_c_functions.h b/third_party/llvm-project/libcxx/include/__string/constexpr_c_functions.h new file mode 100644 index 0000000..500fa47 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__string/constexpr_c_functions.h
@@ -0,0 +1,84 @@ +//===----------------------------------------------------------------------===// +// +// 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___STRING_CONSTEXPR_C_FUNCTIONS_H +#define _LIBCPP___STRING_CONSTEXPR_C_FUNCTIONS_H + +#include <__config> +#include <__type_traits/is_constant_evaluated.h> +#include <__type_traits/is_equality_comparable.h> +#include <__type_traits/is_same.h> +#include <cstddef> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 size_t __constexpr_strlen(const char* __str) { + // GCC currently doesn't support __builtin_strlen for heap-allocated memory during constant evaluation. + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70816 +#ifdef _LIBCPP_COMPILER_GCC + if (__libcpp_is_constant_evaluated()) { + size_t __i = 0; + for (; __str[__i] != '\0'; ++__i) + ; + return __i; + } +#endif + return __builtin_strlen(__str); +} + +template <class _Tp, class _Up> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int +__constexpr_memcmp(const _Tp* __lhs, const _Up* __rhs, size_t __count) { + static_assert(__libcpp_is_trivially_equality_comparable<_Tp, _Up>::value, + "_Tp and _Up have to be trivially equality comparable"); + + if (__libcpp_is_constant_evaluated()) { +#ifdef _LIBCPP_COMPILER_CLANG_BASED + if (sizeof(_Tp) == 1 && !is_same<_Tp, bool>::value) + return __builtin_memcmp(__lhs, __rhs, __count); +#endif + + while (__count != 0) { + if (*__lhs < *__rhs) + return -1; + if (*__rhs < *__lhs) + return 1; + + __count -= sizeof(_Tp); + ++__lhs; + ++__rhs; + } + return 0; + } else { + return __builtin_memcmp(__lhs, __rhs, __count); + } +} + +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const char* +__constexpr_char_memchr(const char* __str, int __char, size_t __count) { +#if __has_builtin(__builtin_char_memchr) + return __builtin_char_memchr(__str, __char, __count); +#else + if (!__libcpp_is_constant_evaluated()) + return static_cast<const char*>(__builtin_memchr(__str, __char, __count)); + for (; __count; --__count) { + if (*__str == __char) + return __str; + ++__str; + } + return nullptr; +#endif +} + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___STRING_CONSTEXPR_C_FUNCTIONS_H
diff --git a/third_party/llvm-project/libcxx/include/__errc b/third_party/llvm-project/libcxx/include/__system_error/errc.h similarity index 100% rename from third_party/llvm-project/libcxx/include/__errc rename to third_party/llvm-project/libcxx/include/__system_error/errc.h
diff --git a/third_party/llvm-project/libcxx/include/__system_error/error_category.h b/third_party/llvm-project/libcxx/include/__system_error/error_category.h new file mode 100644 index 0000000..5c6bb79 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__system_error/error_category.h
@@ -0,0 +1,75 @@ +// -*- 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___SYSTEM_ERROR_ERROR_CATEGORY_H +#define _LIBCPP___SYSTEM_ERROR_ERROR_CATEGORY_H + +#include <__compare/ordering.h> +#include <__config> +#include <string> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +class _LIBCPP_TYPE_VIS error_condition; +class _LIBCPP_TYPE_VIS error_code; + +class _LIBCPP_HIDDEN __do_message; + +class _LIBCPP_TYPE_VIS error_category { +public: + virtual ~error_category() _NOEXCEPT; + +#if defined(_LIBCPP_ERROR_CATEGORY_DEFINE_LEGACY_INLINE_FUNCTIONS) + error_category() noexcept; +#else + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 error_category() _NOEXCEPT = default; +#endif + error_category(const error_category&) = delete; + error_category& operator=(const error_category&) = delete; + + virtual const char* name() const _NOEXCEPT = 0; + virtual error_condition default_error_condition(int __ev) const _NOEXCEPT; + virtual bool equivalent(int __code, const error_condition& __condition) const _NOEXCEPT; + virtual bool equivalent(const error_code& __code, int __condition) const _NOEXCEPT; + virtual string message(int __ev) const = 0; + + _LIBCPP_HIDE_FROM_ABI bool operator==(const error_category& __rhs) const _NOEXCEPT { return this == &__rhs; } + +#if _LIBCPP_STD_VER >= 20 + + _LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(const error_category& __rhs) const noexcept { + return compare_three_way()(this, std::addressof(__rhs)); + } + +#else // _LIBCPP_STD_VER >= 20 + + _LIBCPP_HIDE_FROM_ABI bool operator!=(const error_category& __rhs) const _NOEXCEPT { return !(*this == __rhs); } + + _LIBCPP_HIDE_FROM_ABI bool operator<(const error_category& __rhs) const _NOEXCEPT { return this < &__rhs; } + +#endif // _LIBCPP_STD_VER >= 20 + + friend class _LIBCPP_HIDDEN __do_message; +}; + +class _LIBCPP_HIDDEN __do_message : public error_category { +public: + string message(int __ev) const override; +}; + +_LIBCPP_FUNC_VIS const error_category& generic_category() _NOEXCEPT; +_LIBCPP_FUNC_VIS const error_category& system_category() _NOEXCEPT; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___SYSTEM_ERROR_ERROR_CATEGORY_H
diff --git a/third_party/llvm-project/libcxx/include/__system_error/error_code.h b/third_party/llvm-project/libcxx/include/__system_error/error_code.h new file mode 100644 index 0000000..3b19a68 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__system_error/error_code.h
@@ -0,0 +1,145 @@ +// -*- 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___SYSTEM_ERROR_ERROR_CODE_H +#define _LIBCPP___SYSTEM_ERROR_ERROR_CODE_H + +#include <__compare/ordering.h> +#include <__config> +#include <__functional/hash.h> +#include <__functional/unary_function.h> +#include <__system_error/errc.h> +#include <__system_error/error_category.h> +#include <__system_error/error_condition.h> +#include <cstddef> +#include <string> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_error_code_enum : public false_type {}; + +#if _LIBCPP_STD_VER >= 17 +template <class _Tp> +inline constexpr bool is_error_code_enum_v = is_error_code_enum<_Tp>::value; +#endif + +namespace __adl_only { +// Those cause ADL to trigger but they are not viable candidates, +// so they are never actually selected. +void make_error_code() = delete; +} // namespace __adl_only + +class _LIBCPP_TYPE_VIS error_code { + int __val_; + const error_category* __cat_; + +public: + _LIBCPP_HIDE_FROM_ABI error_code() _NOEXCEPT : __val_(0), __cat_(&system_category()) {} + + _LIBCPP_HIDE_FROM_ABI error_code(int __val, const error_category& __cat) _NOEXCEPT : __val_(__val), __cat_(&__cat) {} + + template <class _Ep> + _LIBCPP_HIDE_FROM_ABI + error_code(_Ep __e, typename enable_if<is_error_code_enum<_Ep>::value>::type* = nullptr) _NOEXCEPT { + using __adl_only::make_error_code; + *this = make_error_code(__e); + } + + _LIBCPP_HIDE_FROM_ABI void assign(int __val, const error_category& __cat) _NOEXCEPT { + __val_ = __val; + __cat_ = &__cat; + } + + template <class _Ep> + _LIBCPP_HIDE_FROM_ABI typename enable_if< is_error_code_enum<_Ep>::value, error_code& >::type + operator=(_Ep __e) _NOEXCEPT { + using __adl_only::make_error_code; + *this = make_error_code(__e); + return *this; + } + + _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { + __val_ = 0; + __cat_ = &system_category(); + } + + _LIBCPP_HIDE_FROM_ABI int value() const _NOEXCEPT { return __val_; } + + _LIBCPP_HIDE_FROM_ABI const error_category& category() const _NOEXCEPT { return *__cat_; } + + _LIBCPP_HIDE_FROM_ABI error_condition default_error_condition() const _NOEXCEPT { + return __cat_->default_error_condition(__val_); + } + + string message() const; + + _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return __val_ != 0; } +}; + +inline _LIBCPP_HIDE_FROM_ABI error_code make_error_code(errc __e) _NOEXCEPT { + return error_code(static_cast<int>(__e), generic_category()); +} + +inline _LIBCPP_HIDE_FROM_ABI bool operator==(const error_code& __x, const error_code& __y) _NOEXCEPT { + return __x.category() == __y.category() && __x.value() == __y.value(); +} + +inline _LIBCPP_HIDE_FROM_ABI bool operator==(const error_code& __x, const error_condition& __y) _NOEXCEPT { + return __x.category().equivalent(__x.value(), __y) || __y.category().equivalent(__x, __y.value()); +} + +#if _LIBCPP_STD_VER <= 17 +inline _LIBCPP_HIDE_FROM_ABI bool operator==(const error_condition& __x, const error_code& __y) _NOEXCEPT { + return __y == __x; +} +#endif + +#if _LIBCPP_STD_VER <= 17 + +inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const error_code& __x, const error_code& __y) _NOEXCEPT { + return !(__x == __y); +} + +inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const error_code& __x, const error_condition& __y) _NOEXCEPT { + return !(__x == __y); +} + +inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const error_condition& __x, const error_code& __y) _NOEXCEPT { + return !(__x == __y); +} + +inline _LIBCPP_HIDE_FROM_ABI bool operator<(const error_code& __x, const error_code& __y) _NOEXCEPT { + return __x.category() < __y.category() || (__x.category() == __y.category() && __x.value() < __y.value()); +} + +#else // _LIBCPP_STD_VER <= 17 + +inline _LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(const error_code& __x, const error_code& __y) noexcept { + if (auto __c = __x.category() <=> __y.category(); __c != 0) + return __c; + return __x.value() <=> __y.value(); +} + +#endif // _LIBCPP_STD_VER <= 17 + +template <> +struct _LIBCPP_TEMPLATE_VIS hash<error_code> : public __unary_function<error_code, size_t> { + _LIBCPP_HIDE_FROM_ABI size_t operator()(const error_code& __ec) const _NOEXCEPT { + return static_cast<size_t>(__ec.value()); + } +}; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___SYSTEM_ERROR_ERROR_CODE_H
diff --git a/third_party/llvm-project/libcxx/include/__system_error/error_condition.h b/third_party/llvm-project/libcxx/include/__system_error/error_condition.h new file mode 100644 index 0000000..cefb499 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__system_error/error_condition.h
@@ -0,0 +1,131 @@ +// -*- 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___SYSTEM_ERROR_ERROR_CONDITION_H +#define _LIBCPP___SYSTEM_ERROR_ERROR_CONDITION_H + +#include <__compare/ordering.h> +#include <__config> +#include <__functional/unary_function.h> +#include <__system_error/errc.h> +#include <__system_error/error_category.h> +#include <cstddef> +#include <string> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Tp> +struct _LIBCPP_TEMPLATE_VIS is_error_condition_enum : public false_type {}; + +#if _LIBCPP_STD_VER >= 17 +template <class _Tp> +inline constexpr bool is_error_condition_enum_v = is_error_condition_enum<_Tp>::value; +#endif + +template <> +struct _LIBCPP_TEMPLATE_VIS is_error_condition_enum<errc> : true_type {}; + +#ifdef _LIBCPP_CXX03_LANG +template <> +struct _LIBCPP_TEMPLATE_VIS is_error_condition_enum<errc::__lx> : true_type {}; +#endif + +namespace __adl_only { +// Those cause ADL to trigger but they are not viable candidates, +// so they are never actually selected. +void make_error_condition() = delete; +} // namespace __adl_only + +class _LIBCPP_TYPE_VIS error_condition { + int __val_; + const error_category* __cat_; + +public: + _LIBCPP_HIDE_FROM_ABI error_condition() _NOEXCEPT : __val_(0), __cat_(&generic_category()) {} + + _LIBCPP_HIDE_FROM_ABI error_condition(int __val, const error_category& __cat) _NOEXCEPT + : __val_(__val), + __cat_(&__cat) {} + + template <class _Ep> + _LIBCPP_HIDE_FROM_ABI + error_condition(_Ep __e, typename enable_if<is_error_condition_enum<_Ep>::value>::type* = nullptr) _NOEXCEPT { + using __adl_only::make_error_condition; + *this = make_error_condition(__e); + } + + _LIBCPP_HIDE_FROM_ABI void assign(int __val, const error_category& __cat) _NOEXCEPT { + __val_ = __val; + __cat_ = &__cat; + } + + template <class _Ep> + _LIBCPP_HIDE_FROM_ABI typename enable_if< is_error_condition_enum<_Ep>::value, error_condition& >::type + operator=(_Ep __e) _NOEXCEPT { + using __adl_only::make_error_condition; + *this = make_error_condition(__e); + return *this; + } + + _LIBCPP_HIDE_FROM_ABI void clear() _NOEXCEPT { + __val_ = 0; + __cat_ = &generic_category(); + } + + _LIBCPP_HIDE_FROM_ABI int value() const _NOEXCEPT { return __val_; } + + _LIBCPP_HIDE_FROM_ABI const error_category& category() const _NOEXCEPT { return *__cat_; } + string message() const; + + _LIBCPP_HIDE_FROM_ABI explicit operator bool() const _NOEXCEPT { return __val_ != 0; } +}; + +inline _LIBCPP_HIDE_FROM_ABI error_condition make_error_condition(errc __e) _NOEXCEPT { + return error_condition(static_cast<int>(__e), generic_category()); +} + +inline _LIBCPP_HIDE_FROM_ABI bool operator==(const error_condition& __x, const error_condition& __y) _NOEXCEPT { + return __x.category() == __y.category() && __x.value() == __y.value(); +} + +#if _LIBCPP_STD_VER <= 17 + +inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const error_condition& __x, const error_condition& __y) _NOEXCEPT { + return !(__x == __y); +} + +inline _LIBCPP_HIDE_FROM_ABI bool operator<(const error_condition& __x, const error_condition& __y) _NOEXCEPT { + return __x.category() < __y.category() || (__x.category() == __y.category() && __x.value() < __y.value()); +} + +#else // _LIBCPP_STD_VER <= 17 + +inline _LIBCPP_HIDE_FROM_ABI strong_ordering +operator<=>(const error_condition& __x, const error_condition& __y) noexcept { + if (auto __c = __x.category() <=> __y.category(); __c != 0) + return __c; + return __x.value() <=> __y.value(); +} + +#endif // _LIBCPP_STD_VER <= 17 + +template <> +struct _LIBCPP_TEMPLATE_VIS hash<error_condition> : public __unary_function<error_condition, size_t> { + _LIBCPP_HIDE_FROM_ABI size_t operator()(const error_condition& __ec) const _NOEXCEPT { + return static_cast<size_t>(__ec.value()); + } +}; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___SYSTEM_ERROR_ERROR_CONDITION_H
diff --git a/third_party/llvm-project/libcxx/include/__system_error/system_error.h b/third_party/llvm-project/libcxx/include/__system_error/system_error.h new file mode 100644 index 0000000..d199feb --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__system_error/system_error.h
@@ -0,0 +1,48 @@ +// -*- 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___SYSTEM_ERROR_SYSTEM_ERROR_H +#define _LIBCPP___SYSTEM_ERROR_SYSTEM_ERROR_H + +#include <__config> +#include <__system_error/error_category.h> +#include <__system_error/error_code.h> +#include <stdexcept> +#include <string> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +class _LIBCPP_TYPE_VIS system_error : public runtime_error { + error_code __ec_; + +public: + system_error(error_code __ec, const string& __what_arg); + system_error(error_code __ec, const char* __what_arg); + system_error(error_code __ec); + system_error(int __ev, const error_category& __ecat, const string& __what_arg); + system_error(int __ev, const error_category& __ecat, const char* __what_arg); + system_error(int __ev, const error_category& __ecat); + system_error(const system_error&) _NOEXCEPT = default; + ~system_error() _NOEXCEPT override; + + _LIBCPP_HIDE_FROM_ABI const error_code& code() const _NOEXCEPT { return __ec_; } + +private: + static string __init(const error_code&, string); +}; + +_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_system_error(int __ev, const char* __what_arg); + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___SYSTEM_ERROR_SYSTEM_ERROR_H
diff --git a/third_party/llvm-project/libcxx/include/__threading_support b/third_party/llvm-project/libcxx/include/__threading_support index dcf2763..08dfd73 100644 --- a/third_party/llvm-project/libcxx/include/__threading_support +++ b/third_party/llvm-project/libcxx/include/__threading_support
@@ -259,21 +259,21 @@ int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m) { - pthread_mutexattr_t attr; - int __ec = pthread_mutexattr_init(&attr); + pthread_mutexattr_t __attr; + int __ec = pthread_mutexattr_init(&__attr); if (__ec) return __ec; - __ec = pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + __ec = pthread_mutexattr_settype(&__attr, PTHREAD_MUTEX_RECURSIVE); if (__ec) { - pthread_mutexattr_destroy(&attr); + pthread_mutexattr_destroy(&__attr); return __ec; } - __ec = pthread_mutex_init(__m, &attr); + __ec = pthread_mutex_init(__m, &__attr); if (__ec) { - pthread_mutexattr_destroy(&attr); + pthread_mutexattr_destroy(&__attr); return __ec; } - __ec = pthread_mutexattr_destroy(&attr); + __ec = pthread_mutexattr_destroy(&__attr); if (__ec) { pthread_mutex_destroy(__m); return __ec; @@ -380,8 +380,8 @@ __libcpp_thread_id __libcpp_thread_get_current_id() { - const __libcpp_thread_t thread = pthread_self(); - return __libcpp_thread_get_id(&thread); + const __libcpp_thread_t __current_thread = pthread_self(); + return __libcpp_thread_get_id(&__current_thread); } __libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t) @@ -643,6 +643,8 @@ _LIBCPP_INLINE_VISIBILITY __thread_id(__libcpp_thread_id __id) : __id_(__id) {} + _LIBCPP_HIDE_FROM_ABI friend __libcpp_thread_id __get_underlying_id(const __thread_id __id) { return __id.__id_; } + friend __thread_id this_thread::get_id() _NOEXCEPT; friend class _LIBCPP_TYPE_VIS thread; friend struct _LIBCPP_TEMPLATE_VIS hash<__thread_id>;
diff --git a/third_party/llvm-project/libcxx/include/__tree b/third_party/llvm-project/libcxx/include/__tree index f5d9d59..8b2965a 100644 --- a/third_party/llvm-project/libcxx/include/__tree +++ b/third_party/llvm-project/libcxx/include/__tree
@@ -18,6 +18,7 @@ #include <__iterator/distance.h> #include <__iterator/iterator_traits.h> #include <__iterator/next.h> +#include <__memory/addressof.h> #include <__memory/allocator_traits.h> #include <__memory/compressed_pair.h> #include <__memory/pointer_traits.h> @@ -375,7 +376,7 @@ { _LIBCPP_ASSERT(__root != nullptr, "Root node should not be null"); _LIBCPP_ASSERT(__z != nullptr, "The node to remove should not be null"); - _LIBCPP_DEBUG_ASSERT(__tree_invariant(__root), "The tree invariants should hold"); + _LIBCPP_DEBUG_ASSERT(std::__tree_invariant(__root), "The tree invariants should hold"); // __z will be removed from the tree. Client still needs to destruct/deallocate it // __y is either __z, or if __z has two children, __tree_next(__z). // __y will have at most one child. @@ -818,7 +819,7 @@ template <class> friend class __map_node_destructor; }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _NodeType, class _Alloc> struct __generic_container_node_destructor; template <class _Tp, class _VoidPtr, class _Alloc> @@ -849,7 +850,7 @@ typedef typename _NodeTypes::__node_value_type_pointer pointer; _LIBCPP_INLINE_VISIBILITY __tree_iterator() _NOEXCEPT -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 : __ptr_(nullptr) #endif {} @@ -922,7 +923,7 @@ typedef typename _NodeTypes::__const_node_value_type_pointer pointer; _LIBCPP_INLINE_VISIBILITY __tree_const_iterator() _NOEXCEPT -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 : __ptr_(nullptr) #endif {} @@ -1331,7 +1332,7 @@ _LIBCPP_INLINE_VISIBILITY iterator __remove_node_pointer(__node_pointer) _NOEXCEPT; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _NodeHandle, class _InsertReturnType> _LIBCPP_INLINE_VISIBILITY _InsertReturnType __node_handle_insert_unique(_NodeHandle&&); @@ -2265,7 +2266,7 @@ return __r; } -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp, class _Compare, class _Allocator> template <class _NodeHandle, class _InsertReturnType> _LIBCPP_INLINE_VISIBILITY @@ -2422,7 +2423,7 @@ } } -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 template <class _Tp, class _Compare, class _Allocator> typename __tree<_Tp, _Compare, _Allocator>::iterator
diff --git a/third_party/llvm-project/libcxx/include/__tuple_dir/apply_cv.h b/third_party/llvm-project/libcxx/include/__tuple/apply_cv.h similarity index 100% rename from third_party/llvm-project/libcxx/include/__tuple_dir/apply_cv.h rename to third_party/llvm-project/libcxx/include/__tuple/apply_cv.h
diff --git a/third_party/llvm-project/libcxx/include/__tuple_dir/make_tuple_types.h b/third_party/llvm-project/libcxx/include/__tuple/make_tuple_types.h similarity index 93% rename from third_party/llvm-project/libcxx/include/__tuple_dir/make_tuple_types.h rename to third_party/llvm-project/libcxx/include/__tuple/make_tuple_types.h index 913ff9b..38e2547 100644 --- a/third_party/llvm-project/libcxx/include/__tuple_dir/make_tuple_types.h +++ b/third_party/llvm-project/libcxx/include/__tuple/make_tuple_types.h
@@ -12,11 +12,11 @@ #include <__config> #include <__fwd/array.h> #include <__fwd/tuple.h> -#include <__tuple_dir/apply_cv.h> -#include <__tuple_dir/tuple_element.h> -#include <__tuple_dir/tuple_indices.h> -#include <__tuple_dir/tuple_size.h> -#include <__tuple_dir/tuple_types.h> +#include <__tuple/apply_cv.h> +#include <__tuple/tuple_element.h> +#include <__tuple/tuple_indices.h> +#include <__tuple/tuple_size.h> +#include <__tuple/tuple_types.h> #include <__type_traits/remove_cv.h> #include <__type_traits/remove_reference.h> #include <cstddef>
diff --git a/third_party/llvm-project/libcxx/include/__tuple_dir/pair_like.h b/third_party/llvm-project/libcxx/include/__tuple/pair_like.h similarity index 92% rename from third_party/llvm-project/libcxx/include/__tuple_dir/pair_like.h rename to third_party/llvm-project/libcxx/include/__tuple/pair_like.h index 87407ad..192682d 100644 --- a/third_party/llvm-project/libcxx/include/__tuple_dir/pair_like.h +++ b/third_party/llvm-project/libcxx/include/__tuple/pair_like.h
@@ -10,8 +10,8 @@ #define _LIBCPP___TUPLE_PAIR_LIKE_H #include <__config> -#include <__tuple_dir/tuple_like.h> -#include <__tuple_dir/tuple_size.h> +#include <__tuple/tuple_like.h> +#include <__tuple/tuple_size.h> #include <__type_traits/remove_cvref.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/third_party/llvm-project/libcxx/include/__tuple_dir/sfinae_helpers.h b/third_party/llvm-project/libcxx/include/__tuple/sfinae_helpers.h similarity index 96% rename from third_party/llvm-project/libcxx/include/__tuple_dir/sfinae_helpers.h rename to third_party/llvm-project/libcxx/include/__tuple/sfinae_helpers.h index fcd65a0..589f450 100644 --- a/third_party/llvm-project/libcxx/include/__tuple_dir/sfinae_helpers.h +++ b/third_party/llvm-project/libcxx/include/__tuple/sfinae_helpers.h
@@ -11,11 +11,11 @@ #include <__config> #include <__fwd/tuple.h> -#include <__tuple_dir/make_tuple_types.h> -#include <__tuple_dir/tuple_element.h> -#include <__tuple_dir/tuple_like_ext.h> -#include <__tuple_dir/tuple_size.h> -#include <__tuple_dir/tuple_types.h> +#include <__tuple/make_tuple_types.h> +#include <__tuple/tuple_element.h> +#include <__tuple/tuple_like_ext.h> +#include <__tuple/tuple_size.h> +#include <__tuple/tuple_types.h> #include <__type_traits/enable_if.h> #include <__type_traits/integral_constant.h> #include <__type_traits/is_assignable.h> @@ -134,7 +134,7 @@ }; #endif // !defined(_LIBCPP_CXX03_LANG) -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <bool _CanCopy, bool _CanMove> struct __sfinae_ctor_base {}; @@ -189,7 +189,7 @@ __sfinae_assign_base& operator=(__sfinae_assign_base const&) = delete; __sfinae_assign_base& operator=(__sfinae_assign_base&&) = default; }; -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__tuple_dir/tuple_element.h b/third_party/llvm-project/libcxx/include/__tuple/tuple_element.h similarity index 96% rename from third_party/llvm-project/libcxx/include/__tuple_dir/tuple_element.h rename to third_party/llvm-project/libcxx/include/__tuple/tuple_element.h index 06f49bf..478dd08 100644 --- a/third_party/llvm-project/libcxx/include/__tuple_dir/tuple_element.h +++ b/third_party/llvm-project/libcxx/include/__tuple/tuple_element.h
@@ -10,8 +10,8 @@ #define _LIBCPP___TUPLE_TUPLE_ELEMENT_H #include <__config> -#include <__tuple_dir/tuple_indices.h> -#include <__tuple_dir/tuple_types.h> +#include <__tuple/tuple_indices.h> +#include <__tuple/tuple_types.h> #include <__type_traits/add_const.h> #include <__type_traits/add_cv.h> #include <__type_traits/add_volatile.h> @@ -81,7 +81,7 @@ typedef _LIBCPP_NODEBUG __type_pack_element<_Ip, _Types...> type; }; -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <size_t _Ip, class ..._Tp> using tuple_element_t _LIBCPP_NODEBUG = typename tuple_element <_Ip, _Tp...>::type; #endif
diff --git a/third_party/llvm-project/libcxx/include/__tuple_dir/tuple_indices.h b/third_party/llvm-project/libcxx/include/__tuple/tuple_indices.h similarity index 100% rename from third_party/llvm-project/libcxx/include/__tuple_dir/tuple_indices.h rename to third_party/llvm-project/libcxx/include/__tuple/tuple_indices.h
diff --git a/third_party/llvm-project/libcxx/include/__tuple_dir/tuple_like.h b/third_party/llvm-project/libcxx/include/__tuple/tuple_like.h similarity index 100% rename from third_party/llvm-project/libcxx/include/__tuple_dir/tuple_like.h rename to third_party/llvm-project/libcxx/include/__tuple/tuple_like.h
diff --git a/third_party/llvm-project/libcxx/include/__tuple_dir/tuple_like_ext.h b/third_party/llvm-project/libcxx/include/__tuple/tuple_like_ext.h similarity index 97% rename from third_party/llvm-project/libcxx/include/__tuple_dir/tuple_like_ext.h rename to third_party/llvm-project/libcxx/include/__tuple/tuple_like_ext.h index bf98696..36f5c48 100644 --- a/third_party/llvm-project/libcxx/include/__tuple_dir/tuple_like_ext.h +++ b/third_party/llvm-project/libcxx/include/__tuple/tuple_like_ext.h
@@ -13,7 +13,7 @@ #include <__fwd/array.h> #include <__fwd/pair.h> #include <__fwd/tuple.h> -#include <__tuple_dir/tuple_types.h> +#include <__tuple/tuple_types.h> #include <__type_traits/integral_constant.h> #include <cstddef>
diff --git a/third_party/llvm-project/libcxx/include/__tuple_dir/tuple_size.h b/third_party/llvm-project/libcxx/include/__tuple/tuple_size.h similarity index 98% rename from third_party/llvm-project/libcxx/include/__tuple_dir/tuple_size.h rename to third_party/llvm-project/libcxx/include/__tuple/tuple_size.h index d551b22..26f9d97 100644 --- a/third_party/llvm-project/libcxx/include/__tuple_dir/tuple_size.h +++ b/third_party/llvm-project/libcxx/include/__tuple/tuple_size.h
@@ -11,7 +11,7 @@ #include <__config> #include <__fwd/tuple.h> -#include <__tuple_dir/tuple_types.h> +#include <__tuple/tuple_types.h> #include <__type_traits/is_const.h> #include <__type_traits/is_volatile.h> #include <cstddef>
diff --git a/third_party/llvm-project/libcxx/include/__tuple_dir/tuple_types.h b/third_party/llvm-project/libcxx/include/__tuple/tuple_types.h similarity index 100% rename from third_party/llvm-project/libcxx/include/__tuple_dir/tuple_types.h rename to third_party/llvm-project/libcxx/include/__tuple/tuple_types.h
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/add_const.h b/third_party/llvm-project/libcxx/include/__type_traits/add_const.h index c616a13..44d4058 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/add_const.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/add_const.h
@@ -21,7 +21,7 @@ typedef _LIBCPP_NODEBUG const _Tp type; }; -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp> using add_const_t = typename add_const<_Tp>::type; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/add_cv.h b/third_party/llvm-project/libcxx/include/__type_traits/add_cv.h index 8a85353..ee821b3 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/add_cv.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/add_cv.h
@@ -21,7 +21,7 @@ typedef _LIBCPP_NODEBUG const volatile _Tp type; }; -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp> using add_cv_t = typename add_cv<_Tp>::type; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/add_lvalue_reference.h b/third_party/llvm-project/libcxx/include/__type_traits/add_lvalue_reference.h index daa5cb9..848cc21 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/add_lvalue_reference.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/add_lvalue_reference.h
@@ -44,7 +44,7 @@ using type _LIBCPP_NODEBUG = __add_lvalue_reference_t<_Tp>; }; -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp> using add_lvalue_reference_t = __add_lvalue_reference_t<_Tp>; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/add_pointer.h b/third_party/llvm-project/libcxx/include/__type_traits/add_pointer.h index 9d0c201..1e74daf 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/add_pointer.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/add_pointer.h
@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_builtin(__add_pointer) +#if !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__add_pointer) template <class _Tp> using __add_pointer_t = __add_pointer(_Tp); @@ -39,14 +39,14 @@ template <class _Tp> using __add_pointer_t = typename __add_pointer_impl<_Tp>::type; -#endif // __has_builtin(__add_pointer) +#endif // !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__add_pointer) template <class _Tp> struct add_pointer { using type _LIBCPP_NODEBUG = __add_pointer_t<_Tp>; }; -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp> using add_pointer_t = __add_pointer_t<_Tp>; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/add_rvalue_reference.h b/third_party/llvm-project/libcxx/include/__type_traits/add_rvalue_reference.h index 098e84c..a54aae7 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/add_rvalue_reference.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/add_rvalue_reference.h
@@ -44,7 +44,7 @@ using type = __add_rvalue_reference_t<_Tp>; }; -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp> using add_rvalue_reference_t = __add_rvalue_reference_t<_Tp>; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/add_volatile.h b/third_party/llvm-project/libcxx/include/__type_traits/add_volatile.h index 73b1cb8..f4fc42f 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/add_volatile.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/add_volatile.h
@@ -21,7 +21,7 @@ typedef _LIBCPP_NODEBUG volatile _Tp type; }; -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp> using add_volatile_t = typename add_volatile<_Tp>::type; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/aligned_storage.h b/third_party/llvm-project/libcxx/include/__type_traits/aligned_storage.h index c564d58..29938d2 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/aligned_storage.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/aligned_storage.h
@@ -93,7 +93,7 @@ }; }; -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 _LIBCPP_SUPPRESS_DEPRECATED_PUSH template <size_t _Len, size_t _Align = __find_max_align<__all_types, _Len>::value> @@ -102,15 +102,13 @@ #endif -#define _CREATE_ALIGNED_STORAGE_SPECIALIZATION(n) \ -template <size_t _Len>\ -struct _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_TEMPLATE_VIS aligned_storage<_Len, n>\ -{\ - struct _ALIGNAS(n) type\ - {\ - unsigned char __lx[(_Len + n - 1)/n * n];\ - };\ -} +#define _CREATE_ALIGNED_STORAGE_SPECIALIZATION(n) \ + template <size_t _Len> \ + struct _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_TEMPLATE_VIS aligned_storage<_Len, n> { \ + struct _ALIGNAS(n) type { \ + unsigned char __lx[(_Len + n - 1) / n * n]; \ + }; \ + } _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x1); _CREATE_ALIGNED_STORAGE_SPECIALIZATION(0x2);
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/aligned_union.h b/third_party/llvm-project/libcxx/include/__type_traits/aligned_union.h index 2c64130..dd1515a 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/aligned_union.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/aligned_union.h
@@ -46,7 +46,7 @@ typedef typename aligned_storage<__len, alignment_value>::type type; }; -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <size_t _Len, class... _Types> using aligned_union_t _LIBCPP_DEPRECATED_IN_CXX23 = typename aligned_union<_Len, _Types...>::type; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/alignment_of.h b/third_party/llvm-project/libcxx/include/__type_traits/alignment_of.h index 45b4cbc..d7851ae 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/alignment_of.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/alignment_of.h
@@ -22,7 +22,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS alignment_of : public integral_constant<size_t, _LIBCPP_ALIGNOF(_Tp)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr size_t alignment_of_v = _LIBCPP_ALIGNOF(_Tp); #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/common_reference.h b/third_party/llvm-project/libcxx/include/__type_traits/common_reference.h index f919586..59b3dfb 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/common_reference.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/common_reference.h
@@ -27,7 +27,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD // common_reference -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // Let COND_RES(X, Y) be: template <class _Xp, class _Yp> using __cond_res = @@ -181,7 +181,7 @@ // bullet 5 - Otherwise, there shall be no member `type`. template <class...> struct common_reference {}; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/common_type.h b/third_party/llvm-project/libcxx/include/__type_traits/common_type.h index 6d2df6c..afd766f 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/common_type.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/common_type.h
@@ -23,7 +23,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // Let COND_RES(X, Y) be: template <class _Tp, class _Up> using __cond_type = decltype(false ? std::declval<_Tp>() : std::declval<_Up>()); @@ -49,9 +49,9 @@ template <class _Tp, class _Up> struct __common_type2_imp<_Tp, _Up, __void_t<decltype(true ? std::declval<_Tp>() : std::declval<_Up>())> > { - typedef _LIBCPP_NODEBUG typename decay<decltype( + typedef _LIBCPP_NODEBUG __decay_t<decltype( true ? std::declval<_Tp>() : std::declval<_Up>() - )>::type type; + )> type; }; template <class, class = void> @@ -109,9 +109,9 @@ template <class _Tp, class _Up> struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, _Up> : conditional< - _IsSame<_Tp, typename decay<_Tp>::type>::value && _IsSame<_Up, typename decay<_Up>::type>::value, + _IsSame<_Tp, __decay_t<_Tp> >::value && _IsSame<_Up, __decay_t<_Up> >::value, __common_type2_imp<_Tp, _Up>, - common_type<typename decay<_Tp>::type, typename decay<_Up>::type> + common_type<__decay_t<_Tp>, __decay_t<_Up> > >::type {}; @@ -125,7 +125,7 @@ #undef _LIBCPP_OPTIONAL_PACK -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class ..._Tp> using common_type_t = typename common_type<_Tp...>::type; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/conditional.h b/third_party/llvm-project/libcxx/include/__type_traits/conditional.h index 6249812..5b5445a 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/conditional.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/conditional.h
@@ -44,7 +44,7 @@ using type _LIBCPP_NODEBUG = _Then; }; -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <bool _Bp, class _IfRes, class _ElseRes> using conditional_t _LIBCPP_NODEBUG = typename conditional<_Bp, _IfRes, _ElseRes>::type; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/conjunction.h b/third_party/llvm-project/libcxx/include/__type_traits/conjunction.h index 0d95347..4bfa5a2 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/conjunction.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/conjunction.h
@@ -37,7 +37,7 @@ template <class... _Pred> using _And _LIBCPP_NODEBUG = decltype(std::__and_helper<_Pred...>(0)); -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class...> struct conjunction : true_type {}; @@ -51,7 +51,7 @@ template <class... _Args> inline constexpr bool conjunction_v = conjunction<_Args...>::value; -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/decay.h b/third_party/llvm-project/libcxx/include/__type_traits/decay.h index f45d33b..a32c140 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/decay.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/decay.h
@@ -27,9 +27,13 @@ #if __has_builtin(__decay) template <class _Tp> +using __decay_t _LIBCPP_NODEBUG = __decay(_Tp); + +template <class _Tp> struct decay { - using type _LIBCPP_NODEBUG = __decay(_Tp); + using type _LIBCPP_NODEBUG = __decay_t<_Tp>; }; + #else template <class _Up, bool> struct __decay { @@ -60,10 +64,13 @@ public: typedef _LIBCPP_NODEBUG typename __decay<_Up, __libcpp_is_referenceable<_Up>::value>::type type; }; + +template <class _Tp> +using __decay_t = typename decay<_Tp>::type; #endif // __has_builtin(__decay) -#if _LIBCPP_STD_VER > 11 -template <class _Tp> using decay_t = typename decay<_Tp>::type; +#if _LIBCPP_STD_VER >= 14 +template <class _Tp> using decay_t = __decay_t<_Tp>; #endif _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/disjunction.h b/third_party/llvm-project/libcxx/include/__type_traits/disjunction.h index 125f168..2c89528 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/disjunction.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/disjunction.h
@@ -43,7 +43,7 @@ template <class... _Args> using _Or _LIBCPP_NODEBUG = typename _OrImpl<sizeof...(_Args) != 0>::template _Result<false_type, _Args...>; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class... _Args> struct disjunction : _Or<_Args...> {}; @@ -51,7 +51,7 @@ template <class... _Args> inline constexpr bool disjunction_v = _Or<_Args...>::value; -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/enable_if.h b/third_party/llvm-project/libcxx/include/__type_traits/enable_if.h index c5e8df4..4859981 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/enable_if.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/enable_if.h
@@ -22,7 +22,7 @@ template <bool _Bp, class _Tp = void> using __enable_if_t _LIBCPP_NODEBUG = typename enable_if<_Bp, _Tp>::type; -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/extent.h b/third_party/llvm-project/libcxx/include/__type_traits/extent.h index 0a4d84e..a031f5e 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/extent.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/extent.h
@@ -25,7 +25,7 @@ struct _LIBCPP_TEMPLATE_VIS extent : integral_constant<size_t, __array_extent(_Tp, _Dim)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp, unsigned _Ip = 0> inline constexpr size_t extent_v = __array_extent(_Tp, _Ip); #endif @@ -43,7 +43,7 @@ template <class _Tp, size_t _Np, unsigned _Ip> struct _LIBCPP_TEMPLATE_VIS extent<_Tp[_Np], _Ip> : public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp, unsigned _Ip = 0> inline constexpr size_t extent_v = extent<_Tp, _Ip>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/has_unique_object_representation.h b/third_party/llvm-project/libcxx/include/__type_traits/has_unique_object_representation.h index d6f75c9..aa45bbb 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/has_unique_object_representation.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/has_unique_object_representation.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_unique_object_representations : public integral_constant<bool,
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/has_virtual_destructor.h b/third_party/llvm-project/libcxx/include/__type_traits/has_virtual_destructor.h index e73a2b2..ae3137e 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/has_virtual_destructor.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/has_virtual_destructor.h
@@ -21,7 +21,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS has_virtual_destructor : public integral_constant<bool, __has_virtual_destructor(_Tp)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool has_virtual_destructor_v = __has_virtual_destructor(_Tp); #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/integral_constant.h b/third_party/llvm-project/libcxx/include/__type_traits/integral_constant.h index 2449d1a..0951ab5 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/integral_constant.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/integral_constant.h
@@ -25,7 +25,7 @@ typedef integral_constant type; _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR operator value_type() const _NOEXCEPT {return value;} -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 _LIBCPP_INLINE_VISIBILITY constexpr value_type operator ()() const _NOEXCEPT {return value;} #endif @@ -40,7 +40,7 @@ template <bool _Val> using _BoolConstant _LIBCPP_NODEBUG = integral_constant<bool, _Val>; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <bool __b> using bool_constant = integral_constant<bool, __b>; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_abstract.h b/third_party/llvm-project/libcxx/include/__type_traits/is_abstract.h index c74b328..5e886bb 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_abstract.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_abstract.h
@@ -21,7 +21,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_abstract : public integral_constant<bool, __is_abstract(_Tp)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_abstract_v = __is_abstract(_Tp); #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_aggregate.h b/third_party/llvm-project/libcxx/include/__type_traits/is_aggregate.h index ea9de84..3b09420 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_aggregate.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_aggregate.h
@@ -18,7 +18,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_aggregate : public integral_constant<bool, __is_aggregate(_Tp)> {}; @@ -26,7 +26,7 @@ template <class _Tp> inline constexpr bool is_aggregate_v = __is_aggregate(_Tp); -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_arithmetic.h b/third_party/llvm-project/libcxx/include/__type_traits/is_arithmetic.h index 6d631f4..03218c8 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_arithmetic.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_arithmetic.h
@@ -24,7 +24,7 @@ : public integral_constant<bool, is_integral<_Tp>::value || is_floating_point<_Tp>::value> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_arithmetic_v = is_arithmetic<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_array.h b/third_party/llvm-project/libcxx/include/__type_traits/is_array.h index bc10590..8275176 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_array.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_array.h
@@ -26,7 +26,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_array : _BoolConstant<__is_array(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_array_v = __is_array(_Tp); #endif @@ -40,7 +40,7 @@ template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS is_array<_Tp[_Np]> : public true_type {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_array_v = is_array<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_assignable.h b/third_party/llvm-project/libcxx/include/__type_traits/is_assignable.h index 13cd682..3ee3e21 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_assignable.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_assignable.h
@@ -21,7 +21,7 @@ template<class _Tp, class _Up> struct _LIBCPP_TEMPLATE_VIS is_assignable : _BoolConstant<__is_assignable(_Tp, _Up)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp, class _Arg> inline constexpr bool is_assignable_v = __is_assignable(_Tp, _Arg); #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_base_of.h b/third_party/llvm-project/libcxx/include/__type_traits/is_base_of.h index 0e6dec0..3338fff 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_base_of.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_base_of.h
@@ -22,7 +22,7 @@ struct _LIBCPP_TEMPLATE_VIS is_base_of : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Bp, class _Dp> inline constexpr bool is_base_of_v = __is_base_of(_Bp, _Dp); #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_bounded_array.h b/third_party/llvm-project/libcxx/include/__type_traits/is_bounded_array.h index 27de9df..46da83a 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_bounded_array.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_bounded_array.h
@@ -22,7 +22,7 @@ template <class> struct _LIBCPP_TEMPLATE_VIS __libcpp_is_bounded_array : false_type {}; template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS __libcpp_is_bounded_array<_Tp[_Np]> : true_type {}; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class> struct _LIBCPP_TEMPLATE_VIS is_bounded_array : false_type {}; template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS is_bounded_array<_Tp[_Np]> : true_type {};
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_class.h b/third_party/llvm-project/libcxx/include/__type_traits/is_class.h index 031430f..62bf6d9 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_class.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_class.h
@@ -21,7 +21,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_class : public integral_constant<bool, __is_class(_Tp)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_class_v = __is_class(_Tp); #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_compound.h b/third_party/llvm-project/libcxx/include/__type_traits/is_compound.h index 1395ed8..73d830c 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_compound.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_compound.h
@@ -24,7 +24,7 @@ template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_compound : _BoolConstant<__is_compound(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_compound_v = __is_compound(_Tp); #endif @@ -34,7 +34,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_compound : public integral_constant<bool, !is_fundamental<_Tp>::value> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_compound_v = is_compound<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_const.h b/third_party/llvm-project/libcxx/include/__type_traits/is_const.h index 42b892c..fad3602 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_const.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_const.h
@@ -23,7 +23,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_const : _BoolConstant<__is_const(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_const_v = __is_const(_Tp); #endif @@ -33,7 +33,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_const : public false_type {}; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_const<_Tp const> : public true_type {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_const_v = is_const<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_constant_evaluated.h b/third_party/llvm-project/libcxx/include/__type_traits/is_constant_evaluated.h index ae903da..d6278f5 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_constant_evaluated.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_constant_evaluated.h
@@ -17,7 +17,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY inline constexpr bool is_constant_evaluated() noexcept { return __builtin_is_constant_evaluated();
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_constructible.h b/third_party/llvm-project/libcxx/include/__type_traits/is_constructible.h index cbe61b4..ebe7bfd 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_constructible.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_constructible.h
@@ -23,7 +23,7 @@ : public integral_constant<bool, __is_constructible(_Tp, _Args...)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp, class ..._Args> inline constexpr bool is_constructible_v = __is_constructible(_Tp, _Args...); #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_convertible.h b/third_party/llvm-project/libcxx/include/__type_traits/is_convertible.h index 5f77fd4..873a64b 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_convertible.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_convertible.h
@@ -98,7 +98,7 @@ #endif // __has_builtin(__is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK) -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _From, class _To> inline constexpr bool is_convertible_v = is_convertible<_From, _To>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_copy_assignable.h b/third_party/llvm-project/libcxx/include/__type_traits/is_copy_assignable.h index b3a965f..245ae4b 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_copy_assignable.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_copy_assignable.h
@@ -27,7 +27,7 @@ __is_assignable(__add_lvalue_reference_t<_Tp>, __add_lvalue_reference_t<typename add_const<_Tp>::type>)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_copy_assignable_v = is_copy_assignable<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_copy_constructible.h b/third_party/llvm-project/libcxx/include/__type_traits/is_copy_constructible.h index 053e159..07e2c93 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_copy_constructible.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_copy_constructible.h
@@ -26,7 +26,7 @@ bool, __is_constructible(_Tp, __add_lvalue_reference_t<typename add_const<_Tp>::type>)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_copy_constructible_v = is_copy_constructible<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_default_constructible.h b/third_party/llvm-project/libcxx/include/__type_traits/is_default_constructible.h index d2180c6..7bc21f5 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_default_constructible.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_default_constructible.h
@@ -23,7 +23,7 @@ : public integral_constant<bool, __is_constructible(_Tp)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_default_constructible_v = __is_constructible(_Tp); #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_destructible.h b/third_party/llvm-project/libcxx/include/__type_traits/is_destructible.h index 376d74d..d785b4b 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_destructible.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_destructible.h
@@ -27,7 +27,7 @@ template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_destructible : _BoolConstant<__is_destructible(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_destructible_v = __is_destructible(_Tp); #endif @@ -90,7 +90,7 @@ struct is_destructible<void> : public false_type {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_destructible_v = is_destructible<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_empty.h b/third_party/llvm-project/libcxx/include/__type_traits/is_empty.h index 042b4e6..46518e1 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_empty.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_empty.h
@@ -22,7 +22,7 @@ struct _LIBCPP_TEMPLATE_VIS is_empty : public integral_constant<bool, __is_empty(_Tp)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_empty_v = __is_empty(_Tp); #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_enum.h b/third_party/llvm-project/libcxx/include/__type_traits/is_enum.h index 4c1db41..7b7221d 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_enum.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_enum.h
@@ -21,7 +21,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_enum : public integral_constant<bool, __is_enum(_Tp)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_enum_v = __is_enum(_Tp); #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_equality_comparable.h b/third_party/llvm-project/libcxx/include/__type_traits/is_equality_comparable.h new file mode 100644 index 0000000..b7a7cd2 --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_equality_comparable.h
@@ -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___TYPE_TRAITS_IS_EQUAILITY_COMPARABLE_H +#define _LIBCPP___TYPE_TRAITS_IS_EQUAILITY_COMPARABLE_H + +#include <__config> +#include <__type_traits/integral_constant.h> +#include <__type_traits/is_integral.h> +#include <__type_traits/is_same.h> +#include <__type_traits/is_void.h> +#include <__type_traits/remove_cv.h> +#include <__type_traits/void_t.h> +#include <__utility/declval.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_equality_comparable : false_type {}; + +template <class _Tp, class _Up> +struct __is_equality_comparable<_Tp, _Up, __void_t<decltype(std::declval<_Tp>() == std::declval<_Up>())> > : true_type { +}; + +// A type is_trivially_equality_comparable if the expression `a == b` is equivalent to `std::memcmp(&a, &b, sizeof(T))` +// (with `a` and `b` being of type `T`). There is no compiler built-in to check this, so we can only do this for known +// types. In particular, these are the integral types and raw pointers. +// +// The following types are not trivially equality comparable: +// floating-point types: different bit-patterns can compare equal. (e.g 0.0 and -0.0) +// enums: The user is allowed to specialize operator== for enums +// pointers that don't have the same type (ignoring cv-qualifiers): pointers to virtual bases are equality comparable, +// but don't have the same bit-pattern. An exception to this is comparing to a void-pointer. There the bit-pattern is +// always compared. + +template <class _Tp, class _Up> +struct __libcpp_is_trivially_equality_comparable + : integral_constant<bool, + __is_equality_comparable<_Tp, _Up>::value && is_integral<_Tp>::value && + is_same<__remove_cv_t<_Tp>, __remove_cv_t<_Up> >::value> {}; + +// TODO: Use is_pointer_inverconvertible_base_of +template <class _Tp, class _Up> +struct __libcpp_is_trivially_equality_comparable<_Tp*, _Up*> + : integral_constant< + bool, + __is_equality_comparable<_Tp*, _Up*>::value && + (is_same<__remove_cv_t<_Tp>, __remove_cv_t<_Up> >::value || is_void<_Tp>::value || is_void<_Up>::value)> { +}; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_IS_EQUAILITY_COMPARABLE_H
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_final.h b/third_party/llvm-project/libcxx/include/__type_traits/is_final.h index 74ced23..ad03b213 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_final.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_final.h
@@ -21,12 +21,12 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS __libcpp_is_final : public integral_constant<bool, __is_final(_Tp)> {}; -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_final : public integral_constant<bool, __is_final(_Tp)> {}; #endif -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_final_v = __is_final(_Tp); #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_floating_point.h b/third_party/llvm-project/libcxx/include/__type_traits/is_floating_point.h index 3928448..2789943 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_floating_point.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_floating_point.h
@@ -27,7 +27,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_floating_point : public __libcpp_is_floating_point<__remove_cv_t<_Tp> > {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_floating_point_v = is_floating_point<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_function.h b/third_party/llvm-project/libcxx/include/__type_traits/is_function.h index 53f34b3..f09f19a 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_function.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_function.h
@@ -33,7 +33,7 @@ #endif // __has_builtin(__is_function) -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_function_v = is_function<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_fundamental.h b/third_party/llvm-project/libcxx/include/__type_traits/is_fundamental.h index 46f81a1..8a1c814 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_fundamental.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_fundamental.h
@@ -25,7 +25,7 @@ template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_fundamental : _BoolConstant<__is_fundamental(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_fundamental_v = __is_fundamental(_Tp); #endif @@ -37,7 +37,7 @@ __is_nullptr_t<_Tp>::value || is_arithmetic<_Tp>::value> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_fundamental_v = is_fundamental<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_integral.h b/third_party/llvm-project/libcxx/include/__type_traits/is_integral.h index 4dcc191..c4803cb 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_integral.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_integral.h
@@ -50,7 +50,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_integral : _BoolConstant<__is_integral(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_integral_v = __is_integral(_Tp); #endif @@ -60,7 +60,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_integral : public _BoolConstant<__libcpp_is_integral<__remove_cv_t<_Tp> >::value> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_integral_v = is_integral<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_literal_type.h b/third_party/llvm-project/libcxx/include/__type_traits/is_literal_type.h index be01745..624fa5d 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_literal_type.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_literal_type.h
@@ -23,10 +23,10 @@ : public integral_constant<bool, __is_literal_type(_Tp)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> _LIBCPP_DEPRECATED_IN_CXX17 inline constexpr bool is_literal_type_v = __is_literal_type(_Tp); -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_member_function_pointer.h b/third_party/llvm-project/libcxx/include/__type_traits/is_member_function_pointer.h index c28f359..72f84bd 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_member_function_pointer.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_member_function_pointer.h
@@ -42,7 +42,7 @@ struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer : _BoolConstant<__is_member_function_pointer(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_member_function_pointer_v = __is_member_function_pointer(_Tp); #endif @@ -52,7 +52,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_function_pointer : public _BoolConstant< __libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_func > {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_member_function_pointer_v = is_member_function_pointer<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_member_object_pointer.h b/third_party/llvm-project/libcxx/include/__type_traits/is_member_object_pointer.h index 5bab14b..bcdc651 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_member_object_pointer.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_member_object_pointer.h
@@ -24,7 +24,7 @@ struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer : _BoolConstant<__is_member_object_pointer(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_member_object_pointer_v = __is_member_object_pointer(_Tp); #endif @@ -34,7 +34,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_object_pointer : public _BoolConstant< __libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_obj > {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_member_object_pointer_v = is_member_object_pointer<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_member_pointer.h b/third_party/llvm-project/libcxx/include/__type_traits/is_member_pointer.h index 904d845..5339fb0 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_member_pointer.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_member_pointer.h
@@ -24,7 +24,7 @@ template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_pointer : _BoolConstant<__is_member_pointer(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_member_pointer_v = __is_member_pointer(_Tp); #endif @@ -34,7 +34,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_member_pointer : public _BoolConstant< __libcpp_is_member_pointer<__remove_cv_t<_Tp> >::__is_member > {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_member_pointer_v = is_member_pointer<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_move_assignable.h b/third_party/llvm-project/libcxx/include/__type_traits/is_move_assignable.h index 3c7158b..8c4c820 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_move_assignable.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_move_assignable.h
@@ -26,7 +26,7 @@ bool, __is_assignable(__add_lvalue_reference_t<_Tp>, __add_rvalue_reference_t<_Tp>)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_move_assignable_v = is_move_assignable<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_move_constructible.h b/third_party/llvm-project/libcxx/include/__type_traits/is_move_constructible.h index 667d104..d908e49 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_move_constructible.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_move_constructible.h
@@ -24,7 +24,7 @@ : public integral_constant<bool, __is_constructible(_Tp, __add_rvalue_reference_t<_Tp>)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_move_constructible_v = is_move_constructible<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_assignable.h b/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_assignable.h index 0cd9d5d..4d17b9f 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_assignable.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_assignable.h
@@ -22,7 +22,7 @@ struct _LIBCPP_TEMPLATE_VIS is_nothrow_assignable : public integral_constant<bool, __is_nothrow_assignable(_Tp, _Arg)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp, class _Arg> inline constexpr bool is_nothrow_assignable_v = __is_nothrow_assignable(_Tp, _Arg); #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_constructible.h b/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_constructible.h index 8919b79..a967bc8 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_constructible.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_constructible.h
@@ -68,7 +68,7 @@ #endif // __has_builtin(__is_nothrow_constructible) -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp, class ..._Args> inline constexpr bool is_nothrow_constructible_v = is_nothrow_constructible<_Tp, _Args...>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_convertible.h b/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_convertible.h index a8ca1c4..64f75e1 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_convertible.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_convertible.h
@@ -24,13 +24,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <typename _Tp> -static void __test_noexcept(_Tp) noexcept; +void __test_noexcept(_Tp) noexcept; template<typename _Fm, typename _To> -static bool_constant<noexcept(_VSTD::__test_noexcept<_To>(std::declval<_Fm>()))> +bool_constant<noexcept(_VSTD::__test_noexcept<_To>(std::declval<_Fm>()))> __is_nothrow_convertible_test(); template <typename _Fm, typename _To> @@ -46,7 +46,7 @@ template <typename _Fm, typename _To> inline constexpr bool is_nothrow_convertible_v = is_nothrow_convertible<_Fm, _To>::value; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_copy_assignable.h b/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_copy_assignable.h index 58f7d97..d11ec1c 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_copy_assignable.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_copy_assignable.h
@@ -28,7 +28,7 @@ __add_lvalue_reference_t<_Tp>, __add_lvalue_reference_t<typename add_const<_Tp>::type>)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_nothrow_copy_assignable_v = is_nothrow_copy_assignable<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_copy_constructible.h b/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_copy_constructible.h index ce17334..de4e272 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_copy_constructible.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_copy_constructible.h
@@ -38,7 +38,7 @@ #endif // _LIBCPP_COMPILER_GCC -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_nothrow_copy_constructible_v = is_nothrow_copy_constructible<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_default_constructible.h b/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_default_constructible.h index 91bffa5..446808f 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_default_constructible.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_default_constructible.h
@@ -22,7 +22,7 @@ : public integral_constant<bool, __is_nothrow_constructible(_Tp)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_nothrow_default_constructible_v = __is_nothrow_constructible(_Tp); #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_destructible.h b/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_destructible.h index 03ebf44..e842465 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_destructible.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_destructible.h
@@ -79,7 +79,7 @@ #endif -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_nothrow_destructible_v = is_nothrow_destructible<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_move_assignable.h b/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_move_assignable.h index 18dcc9b..7649a3f 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_move_assignable.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_move_assignable.h
@@ -27,7 +27,7 @@ __is_nothrow_assignable(__add_lvalue_reference_t<_Tp>, __add_rvalue_reference_t<_Tp>)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_nothrow_move_assignable_v = is_nothrow_move_assignable<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_move_constructible.h b/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_move_constructible.h index ad8222a..21a22bb 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_move_constructible.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_nothrow_move_constructible.h
@@ -35,7 +35,7 @@ #endif // _LIBCPP_COMPILER_GCC -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_nothrow_move_constructible_v = is_nothrow_move_constructible<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_null_pointer.h b/third_party/llvm-project/libcxx/include/__type_traits/is_null_pointer.h index 4864cee..3a94fce 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_null_pointer.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_null_pointer.h
@@ -26,15 +26,15 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS __is_nullptr_t : public __is_nullptr_t_impl<__remove_cv_t<_Tp> > {}; -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_null_pointer : public __is_nullptr_t_impl<__remove_cv_t<_Tp> > {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_null_pointer_v = is_null_pointer<_Tp>::value; #endif -#endif // _LIBCPP_STD_VER > 11 +#endif // _LIBCPP_STD_VER >= 14 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_object.h b/third_party/llvm-project/libcxx/include/__type_traits/is_object.h index 943f1a7..4d038c3 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_object.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_object.h
@@ -27,7 +27,7 @@ template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_object : _BoolConstant<__is_object(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_object_v = __is_object(_Tp); #endif @@ -40,7 +40,7 @@ is_union<_Tp>::value || is_class<_Tp>::value > {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_object_v = is_object<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_pod.h b/third_party/llvm-project/libcxx/include/__type_traits/is_pod.h index c1d00b2..851cbd1 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_pod.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_pod.h
@@ -21,7 +21,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pod : public integral_constant<bool, __is_pod(_Tp)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_pod_v = __is_pod(_Tp); #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_pointer.h b/third_party/llvm-project/libcxx/include/__type_traits/is_pointer.h index 3c0ad04..51c628f 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_pointer.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_pointer.h
@@ -24,7 +24,7 @@ template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pointer : _BoolConstant<__is_pointer(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_pointer_v = __is_pointer(_Tp); #endif @@ -45,7 +45,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_pointer : public __libcpp_is_pointer<typename __libcpp_remove_objc_qualifiers<__remove_cv_t<_Tp> >::type> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_pointer_v = is_pointer<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_polymorphic.h b/third_party/llvm-project/libcxx/include/__type_traits/is_polymorphic.h index 96da48a..21b3cdc 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_polymorphic.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_polymorphic.h
@@ -22,7 +22,7 @@ struct _LIBCPP_TEMPLATE_VIS is_polymorphic : public integral_constant<bool, __is_polymorphic(_Tp)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_polymorphic_v = __is_polymorphic(_Tp); #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_reference.h b/third_party/llvm-project/libcxx/include/__type_traits/is_reference.h index 27ca2dd..3334c60 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_reference.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_reference.h
@@ -31,7 +31,7 @@ template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference : _BoolConstant<__is_reference(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_reference_v = __is_reference(_Tp); template <class _Tp> @@ -52,7 +52,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&> : public true_type {}; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_reference<_Tp&&> : public true_type {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_reference_v = is_reference<_Tp>::value;
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_same.h b/third_party/llvm-project/libcxx/include/__type_traits/is_same.h index 6fa0afb..c598f0d 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_same.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_same.h
@@ -21,7 +21,7 @@ template <class _Tp, class _Up> struct _LIBCPP_TEMPLATE_VIS is_same : _BoolConstant<__is_same(_Tp, _Up)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp, class _Up> inline constexpr bool is_same_v = __is_same(_Tp, _Up); #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_scalar.h b/third_party/llvm-project/libcxx/include/__type_traits/is_scalar.h index b4dc70b..9892ae0 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_scalar.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_scalar.h
@@ -28,7 +28,7 @@ template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_scalar : _BoolConstant<__is_scalar(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_scalar_v = __is_scalar(_Tp); #endif @@ -50,7 +50,7 @@ template <> struct _LIBCPP_TEMPLATE_VIS is_scalar<nullptr_t> : public true_type {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_scalar_v = is_scalar<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_scoped_enum.h b/third_party/llvm-project/libcxx/include/__type_traits/is_scoped_enum.h index 85a4128..3f0fd58 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_scoped_enum.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_scoped_enum.h
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <class _Tp, bool = is_enum_v<_Tp> > struct __is_scoped_enum_helper : false_type {};
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_signed.h b/third_party/llvm-project/libcxx/include/__type_traits/is_signed.h index aa42a4e..ebd3873 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_signed.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_signed.h
@@ -25,7 +25,7 @@ template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_signed : _BoolConstant<__is_signed(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_signed_v = __is_signed(_Tp); #endif @@ -45,7 +45,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_signed : public __libcpp_is_signed<_Tp> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_signed_v = is_signed<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_specialization.h b/third_party/llvm-project/libcxx/include/__type_traits/is_specialization.h index 0cc3667..9b75636 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_specialization.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_specialization.h
@@ -30,7 +30,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp, template <class...> class _Template> inline constexpr bool __is_specialization_v = false; // true if and only if _Tp is a specialization of _Template @@ -38,7 +38,7 @@ template <template <class...> class _Template, class... _Args> inline constexpr bool __is_specialization_v<_Template<_Args...>, _Template> = true; -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_standard_layout.h b/third_party/llvm-project/libcxx/include/__type_traits/is_standard_layout.h index 12c1712..aae533b 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_standard_layout.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_standard_layout.h
@@ -22,7 +22,7 @@ : public integral_constant<bool, __is_standard_layout(_Tp)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_standard_layout_v = __is_standard_layout(_Tp); #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_swappable.h b/third_party/llvm-project/libcxx/include/__type_traits/is_swappable.h index 3821de1..5a78f47 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_swappable.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_swappable.h
@@ -108,7 +108,7 @@ { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp, class _Up> struct _LIBCPP_TEMPLATE_VIS is_swappable_with @@ -158,7 +158,7 @@ template <class _Tp> inline constexpr bool is_nothrow_swappable_v = is_nothrow_swappable<_Tp>::value; -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_trivial.h b/third_party/llvm-project/libcxx/include/__type_traits/is_trivial.h index 840770d..f439048 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_trivial.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_trivial.h
@@ -22,7 +22,7 @@ : public integral_constant<bool, __is_trivial(_Tp)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_trivial_v = __is_trivial(_Tp); #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_assignable.h b/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_assignable.h index 9ef101f..c16d177 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_assignable.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_assignable.h
@@ -23,7 +23,7 @@ : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp, class _Arg> inline constexpr bool is_trivially_assignable_v = __is_trivially_assignable(_Tp, _Arg); #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_constructible.h b/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_constructible.h index 4173e3b..a71a49b 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_constructible.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_constructible.h
@@ -24,7 +24,7 @@ { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp, class... _Args> inline constexpr bool is_trivially_constructible_v = __is_trivially_constructible(_Tp, _Args...); #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_copy_assignable.h b/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_copy_assignable.h index e6a4a35..b38ab7e 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_copy_assignable.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_copy_assignable.h
@@ -28,7 +28,7 @@ __add_lvalue_reference_t<_Tp>, __add_lvalue_reference_t<typename add_const<_Tp>::type>)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_trivially_copy_assignable_v = is_trivially_copy_assignable<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_copy_constructible.h b/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_copy_constructible.h index 4bbb803..c6c96a0 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_copy_constructible.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_copy_constructible.h
@@ -23,7 +23,7 @@ : public integral_constant<bool, __is_trivially_constructible(_Tp, __add_lvalue_reference_t<const _Tp>)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_trivially_copy_constructible_v = is_trivially_copy_constructible<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_copyable.h b/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_copyable.h index ef118bf..a725a0b 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_copyable.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_copyable.h
@@ -11,6 +11,7 @@ #include <__config> #include <__type_traits/integral_constant.h> +#include <cstdint> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -22,11 +23,16 @@ : public integral_constant<bool, __is_trivially_copyable(_Tp)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_trivially_copyable_v = __is_trivially_copyable(_Tp); #endif +#if _LIBCPP_STD_VER >= 20 +template <class _Tp> +inline constexpr bool __is_cheap_to_copy = is_trivially_copyable_v<_Tp> && sizeof(_Tp) <= sizeof(std::intmax_t); +#endif + _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___TYPE_TRAITS_IS_TRIVIALLY_COPYABLE_H
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_default_constructible.h b/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_default_constructible.h index 5c53bd5..2b64a69 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_default_constructible.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_default_constructible.h
@@ -22,7 +22,7 @@ : public integral_constant<bool, __is_trivially_constructible(_Tp)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_trivially_default_constructible_v = __is_trivially_constructible(_Tp); #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_destructible.h b/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_destructible.h index 0239fca..e718af0 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_destructible.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_destructible.h
@@ -35,7 +35,7 @@ #endif // __has_builtin(__is_trivially_destructible) -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_trivially_destructible_v = is_trivially_destructible<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_move_assignable.h b/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_move_assignable.h index 8f8876f..daf890b 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_move_assignable.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_move_assignable.h
@@ -26,7 +26,7 @@ bool, __is_trivially_assignable(__add_lvalue_reference_t<_Tp>, __add_rvalue_reference_t<_Tp>)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_trivially_move_assignable_v = is_trivially_move_assignable<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_move_constructible.h b/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_move_constructible.h index 151bb25..71e6f89 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_move_constructible.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_trivially_move_constructible.h
@@ -23,7 +23,7 @@ struct _LIBCPP_TEMPLATE_VIS is_trivially_move_constructible : public integral_constant<bool, __is_trivially_constructible(_Tp, __add_rvalue_reference_t<_Tp>)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_trivially_move_constructible_v = is_trivially_move_constructible<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_unbounded_array.h b/third_party/llvm-project/libcxx/include/__type_traits/is_unbounded_array.h index 11a1260..16bc62d 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_unbounded_array.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_unbounded_array.h
@@ -21,7 +21,7 @@ template <class> struct _LIBCPP_TEMPLATE_VIS __libcpp_is_unbounded_array : false_type {}; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS __libcpp_is_unbounded_array<_Tp[]> : true_type {}; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class> struct _LIBCPP_TEMPLATE_VIS is_unbounded_array : false_type {}; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_unbounded_array<_Tp[]> : true_type {};
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_union.h b/third_party/llvm-project/libcxx/include/__type_traits/is_union.h index 998aedd..6d2f47a 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_union.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_union.h
@@ -21,7 +21,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_union : public integral_constant<bool, __is_union(_Tp)> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_union_v = __is_union(_Tp); #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_unsigned.h b/third_party/llvm-project/libcxx/include/__type_traits/is_unsigned.h index 3d75409..d955106 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_unsigned.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_unsigned.h
@@ -25,7 +25,7 @@ template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_unsigned : _BoolConstant<__is_unsigned(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_unsigned_v = __is_unsigned(_Tp); #endif @@ -45,7 +45,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_unsigned : public __libcpp_is_unsigned<_Tp> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_unsigned_v = is_unsigned<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_void.h b/third_party/llvm-project/libcxx/include/__type_traits/is_void.h index d8ffdbd..7e8b8b6 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_void.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_void.h
@@ -25,7 +25,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_void : _BoolConstant<__is_void(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_void_v = __is_void(_Tp); #endif @@ -35,7 +35,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_void : public is_same<__remove_cv_t<_Tp>, void> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_void_v = is_void<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/is_volatile.h b/third_party/llvm-project/libcxx/include/__type_traits/is_volatile.h index fb92267..c020220 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/is_volatile.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/is_volatile.h
@@ -23,7 +23,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_volatile : _BoolConstant<__is_volatile(_Tp)> { }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_volatile_v = __is_volatile(_Tp); #endif @@ -33,7 +33,7 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_volatile : public false_type {}; template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_volatile<_Tp volatile> : public true_type {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr bool is_volatile_v = is_volatile<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/make_32_64_or_128_bit.h b/third_party/llvm-project/libcxx/include/__type_traits/make_32_64_or_128_bit.h index 87340ea..3059571 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/make_32_64_or_128_bit.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/make_32_64_or_128_bit.h
@@ -27,7 +27,7 @@ /// /// The restriction is the same as the integral version of to_char. template <class _Tp> -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 requires (is_signed_v<_Tp> || is_unsigned_v<_Tp> || is_same_v<_Tp, char>) #endif using __make_32_64_or_128_bit_t =
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/make_signed.h b/third_party/llvm-project/libcxx/include/__type_traits/make_signed.h index bff8744..71383d0 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/make_signed.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/make_signed.h
@@ -77,7 +77,7 @@ using type _LIBCPP_NODEBUG = __make_signed_t<_Tp>; }; -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp> using make_signed_t = __make_signed_t<_Tp>; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/make_unsigned.h b/third_party/llvm-project/libcxx/include/__type_traits/make_unsigned.h index 33c3014..76d1889 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/make_unsigned.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/make_unsigned.h
@@ -79,7 +79,7 @@ using type _LIBCPP_NODEBUG = __make_unsigned_t<_Tp>; }; -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp> using make_unsigned_t = __make_unsigned_t<_Tp>; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/negation.h b/third_party/llvm-project/libcxx/include/__type_traits/negation.h index b72f285..3a70ef1 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/negation.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/negation.h
@@ -21,12 +21,12 @@ template <class _Pred> struct _Not : _BoolConstant<!_Pred::value> {}; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> struct negation : _Not<_Tp> {}; template<class _Tp> inline constexpr bool negation_v = !_Tp::value; -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/noexcept_move_assign_container.h b/third_party/llvm-project/libcxx/include/__type_traits/noexcept_move_assign_container.h index 35b0e51..65384d0 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/noexcept_move_assign_container.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/noexcept_move_assign_container.h
@@ -23,7 +23,7 @@ template <typename _Alloc, typename _Traits=allocator_traits<_Alloc> > struct __noexcept_move_assign_container : public integral_constant<bool, _Traits::propagate_on_container_move_assignment::value -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 || _Traits::is_always_equal::value #else && is_nothrow_move_assignable<_Alloc>::value
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/predicate_traits.h b/third_party/llvm-project/libcxx/include/__type_traits/predicate_traits.h new file mode 100644 index 0000000..872608e --- /dev/null +++ b/third_party/llvm-project/libcxx/include/__type_traits/predicate_traits.h
@@ -0,0 +1,26 @@ +//===----------------------------------------------------------------------===// +// +// 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___TYPE_TRAITS_PREDICATE_TRAITS +#define _LIBCPP___TYPE_TRAITS_PREDICATE_TRAITS + +#include <__config> +#include <__type_traits/integral_constant.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template <class _Pred, class _Lhs, class _Rhs> +struct __is_trivial_equality_predicate : false_type {}; + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___TYPE_TRAITS_PREDICATE_TRAITS
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/promote.h b/third_party/llvm-project/libcxx/include/__type_traits/promote.h index c2af327..e01e778 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/promote.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/promote.h
@@ -13,7 +13,6 @@ #include <__type_traits/integral_constant.h> #include <__type_traits/is_same.h> #include <__utility/declval.h> -#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/rank.h b/third_party/llvm-project/libcxx/include/__type_traits/rank.h index 9950907..5f3fab8 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/rank.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/rank.h
@@ -36,7 +36,7 @@ #endif // __has_builtin(__array_rank) -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr size_t rank_v = rank<_Tp>::value; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/remove_all_extents.h b/third_party/llvm-project/libcxx/include/__type_traits/remove_all_extents.h index 868cf10..f7e3225 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/remove_all_extents.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/remove_all_extents.h
@@ -38,7 +38,7 @@ using __remove_all_extents_t = typename remove_all_extents<_Tp>::type; #endif // __has_builtin(__remove_all_extents) -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp> using remove_all_extents_t = __remove_all_extents_t<_Tp>; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/remove_const.h b/third_party/llvm-project/libcxx/include/__type_traits/remove_const.h index dc56533..37f0609 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/remove_const.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/remove_const.h
@@ -33,7 +33,7 @@ using __remove_const_t = typename remove_const<_Tp>::type; #endif // __has_builtin(__remove_const) -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp> using remove_const_t = __remove_const_t<_Tp>; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/remove_cv.h b/third_party/llvm-project/libcxx/include/__type_traits/remove_cv.h index ea85e23..7eb8940 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/remove_cv.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/remove_cv.h
@@ -35,7 +35,7 @@ using __remove_cv_t = __remove_volatile_t<__remove_const_t<_Tp> >; #endif // __has_builtin(__remove_cv) -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp> using remove_cv_t = __remove_cv_t<_Tp>; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/remove_cvref.h b/third_party/llvm-project/libcxx/include/__type_traits/remove_cvref.h index e96cc65..f1111fd 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/remove_cvref.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/remove_cvref.h
@@ -31,7 +31,7 @@ template <class _Tp, class _Up> struct __is_same_uncvref : _IsSame<__remove_cvref_t<_Tp>, __remove_cvref_t<_Up> > {}; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Tp> struct remove_cvref { using type _LIBCPP_NODEBUG = __remove_cvref_t<_Tp>;
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/remove_extent.h b/third_party/llvm-project/libcxx/include/__type_traits/remove_extent.h index 79d6e57..65dfcdc 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/remove_extent.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/remove_extent.h
@@ -38,7 +38,7 @@ using __remove_extent_t = typename remove_extent<_Tp>::type; #endif // __has_builtin(__remove_extent) -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp> using remove_extent_t = __remove_extent_t<_Tp>; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/remove_pointer.h b/third_party/llvm-project/libcxx/include/__type_traits/remove_pointer.h index 33ddb71..8b3a9c7 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/remove_pointer.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/remove_pointer.h
@@ -17,7 +17,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_builtin(__remove_pointer) +#if !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__remove_pointer) template <class _Tp> struct remove_pointer { using type _LIBCPP_NODEBUG = __remove_pointer(_Tp); @@ -34,9 +34,9 @@ template <class _Tp> using __remove_pointer_t = typename remove_pointer<_Tp>::type; -#endif // __has_builtin(__remove_pointer) +#endif // !defined(_LIBCPP_WORKAROUND_OBJCXX_COMPILER_INTRINSICS) && __has_builtin(__remove_pointer) -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp> using remove_pointer_t = __remove_pointer_t<_Tp>; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/remove_reference.h b/third_party/llvm-project/libcxx/include/__type_traits/remove_reference.h index b9a6974..1d510c2 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/remove_reference.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/remove_reference.h
@@ -35,7 +35,7 @@ using __libcpp_remove_reference_t = typename remove_reference<_Tp>::type; #endif // __has_builtin(__remove_reference_t) -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp> using remove_reference_t = __libcpp_remove_reference_t<_Tp>; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/remove_volatile.h b/third_party/llvm-project/libcxx/include/__type_traits/remove_volatile.h index ed6d63b..cc9fb55 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/remove_volatile.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/remove_volatile.h
@@ -33,7 +33,7 @@ using __remove_volatile_t = typename remove_volatile<_Tp>::type; #endif // __has_builtin(__remove_volatile) -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp> using remove_volatile_t = __remove_volatile_t<_Tp>; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/result_of.h b/third_party/llvm-project/libcxx/include/__type_traits/result_of.h index 804173e..dff2828 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/result_of.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/result_of.h
@@ -29,9 +29,9 @@ { }; -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp> using result_of_t _LIBCPP_DEPRECATED_IN_CXX17 = typename result_of<_Tp>::type; -#endif // _LIBCPP_STD_VER > 11 +#endif // _LIBCPP_STD_VER >= 14 #endif // _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_TYPE_TRAITS) _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/type_identity.h b/third_party/llvm-project/libcxx/include/__type_traits/type_identity.h index 42e52b1..92f288f 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/type_identity.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/type_identity.h
@@ -23,7 +23,7 @@ template <class _Tp> using __type_identity_t _LIBCPP_NODEBUG = typename __type_identity<_Tp>::type; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template<class _Tp> struct type_identity { typedef _Tp type; }; template<class _Tp> using type_identity_t = typename type_identity<_Tp>::type; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/underlying_type.h b/third_party/llvm-project/libcxx/include/__type_traits/underlying_type.h index 1c8db64..6f52d67 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/underlying_type.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/underlying_type.h
@@ -32,7 +32,7 @@ template <class _Tp> struct underlying_type : __underlying_type_impl<_Tp, is_enum<_Tp>::value> {}; -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp> using underlying_type_t = typename underlying_type<_Tp>::type; #endif
diff --git a/third_party/llvm-project/libcxx/include/__type_traits/void_t.h b/third_party/llvm-project/libcxx/include/__type_traits/void_t.h index 1ed4e43..2fe438c 100644 --- a/third_party/llvm-project/libcxx/include/__type_traits/void_t.h +++ b/third_party/llvm-project/libcxx/include/__type_traits/void_t.h
@@ -17,7 +17,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class...> using void_t = void; #endif
diff --git a/third_party/llvm-project/libcxx/include/__utility/as_const.h b/third_party/llvm-project/libcxx/include/__utility/as_const.h index d4a72f4..b5c6091 100644 --- a/third_party/llvm-project/libcxx/include/__utility/as_const.h +++ b/third_party/llvm-project/libcxx/include/__utility/as_const.h
@@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#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; }
diff --git a/third_party/llvm-project/libcxx/include/__utility/auto_cast.h b/third_party/llvm-project/libcxx/include/__utility/auto_cast.h index 381ed0c..06715b3 100644 --- a/third_party/llvm-project/libcxx/include/__utility/auto_cast.h +++ b/third_party/llvm-project/libcxx/include/__utility/auto_cast.h
@@ -17,6 +17,6 @@ # pragma GCC system_header #endif -#define _LIBCPP_AUTO_CAST(expr) static_cast<typename decay<decltype((expr))>::type>(expr) +#define _LIBCPP_AUTO_CAST(expr) static_cast<::std::__decay_t<decltype((expr))> >(expr) #endif // _LIBCPP___UTILITY_AUTO_CAST_H
diff --git a/third_party/llvm-project/libcxx/include/__utility/cmp.h b/third_party/llvm-project/libcxx/include/__utility/cmp.h index d448a1d..7b7b901 100644 --- a/third_party/llvm-project/libcxx/include/__utility/cmp.h +++ b/third_party/llvm-project/libcxx/include/__utility/cmp.h
@@ -28,7 +28,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template<class _Tp, class... _Up> struct _IsSameAsAny : _Or<_IsSame<_Tp, _Up>...> {}; @@ -102,7 +102,7 @@ return _VSTD::cmp_less_equal(__u, numeric_limits<_Tp>::max()) && _VSTD::cmp_greater_equal(__u, numeric_limits<_Tp>::min()); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__utility/exception_guard.h b/third_party/llvm-project/libcxx/include/__utility/exception_guard.h index 737d1a6..1db8f8a 100644 --- a/third_party/llvm-project/libcxx/include/__utility/exception_guard.h +++ b/third_party/llvm-project/libcxx/include/__utility/exception_guard.h
@@ -41,7 +41,7 @@ // less common, especially one that tries to catch an exception through -fno-exceptions code. // // __exception_guard can help greatly simplify code that would normally be cluttered by -// `#if _LIBCPP_NO_EXCEPTIONS`. For example: +// `#if _LIBCPP_HAS_NO_EXCEPTIONS`. For example: // // template <class Iterator, class Size, class OutputIterator> // Iterator uninitialized_copy_n(Iterator iter, Size n, OutputIterator out) { @@ -58,27 +58,27 @@ // } // -#ifndef _LIBCPP_NO_EXCEPTIONS template <class _Rollback> -struct __exception_guard { - __exception_guard() = delete; +struct __exception_guard_exceptions { + __exception_guard_exceptions() = delete; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit __exception_guard(_Rollback __rollback) + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit __exception_guard_exceptions(_Rollback __rollback) : __rollback_(std::move(__rollback)), __completed_(false) {} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __exception_guard(__exception_guard&& __other) + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 + __exception_guard_exceptions(__exception_guard_exceptions&& __other) _NOEXCEPT_(is_nothrow_move_constructible<_Rollback>::value) : __rollback_(std::move(__other.__rollback_)), __completed_(__other.__completed_) { __other.__completed_ = true; } - __exception_guard(__exception_guard const&) = delete; - __exception_guard& operator=(__exception_guard const&) = delete; - __exception_guard& operator=(__exception_guard&&) = delete; + __exception_guard_exceptions(__exception_guard_exceptions const&) = delete; + __exception_guard_exceptions& operator=(__exception_guard_exceptions const&) = delete; + __exception_guard_exceptions& operator=(__exception_guard_exceptions&&) = delete; _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __complete() _NOEXCEPT { __completed_ = true; } - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~__exception_guard() { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~__exception_guard_exceptions() { if (!__completed_) __rollback_(); } @@ -87,36 +87,47 @@ _Rollback __rollback_; bool __completed_; }; -#else // _LIBCPP_NO_EXCEPTIONS -template <class _Rollback> -struct __exception_guard { - __exception_guard() = delete; - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NODEBUG explicit __exception_guard(_Rollback) {} - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NODEBUG __exception_guard(__exception_guard&& __other) +_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 + __exception_guard_noexceptions(__exception_guard_noexceptions&& __other) _NOEXCEPT_(is_nothrow_move_constructible<_Rollback>::value) : __completed_(__other.__completed_) { __other.__completed_ = true; } - __exception_guard(__exception_guard const&) = delete; - __exception_guard& operator=(__exception_guard const&) = delete; - __exception_guard& operator=(__exception_guard&&) = delete; + __exception_guard_noexceptions(__exception_guard_noexceptions const&) = delete; + __exception_guard_noexceptions& operator=(__exception_guard_noexceptions const&) = delete; + __exception_guard_noexceptions& operator=(__exception_guard_noexceptions&&) = delete; _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NODEBUG void __complete() _NOEXCEPT { __completed_ = true; } - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NODEBUG ~__exception_guard() { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_NODEBUG ~__exception_guard_noexceptions() { _LIBCPP_ASSERT(__completed_, "__exception_guard not completed with exceptions disabled"); } private: bool __completed_ = false; }; -#endif // _LIBCPP_NO_EXCEPTIONS -_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(__exception_guard); +_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(__exception_guard_noexceptions); + +#ifdef _LIBCPP_HAS_NO_EXCEPTIONS +template <class _Rollback> +using __exception_guard = __exception_guard_noexceptions<_Rollback>; +#else +template <class _Rollback> +using __exception_guard = __exception_guard_exceptions<_Rollback>; +#endif template <class _Rollback> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __exception_guard<_Rollback> __make_exception_guard(_Rollback __rollback) {
diff --git a/third_party/llvm-project/libcxx/include/__utility/exchange.h b/third_party/llvm-project/libcxx/include/__utility/exchange.h index 8df71a1..4cc5e04 100644 --- a/third_party/llvm-project/libcxx/include/__utility/exchange.h +++ b/third_party/llvm-project/libcxx/include/__utility/exchange.h
@@ -21,7 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 11 +#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) @@ -31,7 +31,7 @@ __obj = _VSTD::forward<_T2>(__new_value); return __old_value; } -#endif // _LIBCPP_STD_VER > 11 +#endif // _LIBCPP_STD_VER >= 14 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__utility/forward_like.h b/third_party/llvm-project/libcxx/include/__utility/forward_like.h index 7bb0d7d..ce11b64 100644 --- a/third_party/llvm-project/libcxx/include/__utility/forward_like.h +++ b/third_party/llvm-project/libcxx/include/__utility/forward_like.h
@@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <class _Ap, class _Bp> using _CopyConst = _If<is_const_v<_Ap>, const _Bp, _Bp>; @@ -39,7 +39,7 @@ return static_cast<_ForwardLike<_Tp, _Up>>(__ux); } -#endif // _LIBCPP_STD_VER > 20 +#endif // _LIBCPP_STD_VER >= 23 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__utility/in_place.h b/third_party/llvm-project/libcxx/include/__utility/in_place.h index a351845..c1c6a67 100644 --- a/third_party/llvm-project/libcxx/include/__utility/in_place.h +++ b/third_party/llvm-project/libcxx/include/__utility/in_place.h
@@ -19,7 +19,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 struct _LIBCPP_TYPE_VIS in_place_t { explicit in_place_t() = default; @@ -52,7 +52,7 @@ template <class _Tp> using __is_inplace_index = __is_inplace_index_imp<__remove_cvref_t<_Tp>>; -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__utility/integer_sequence.h b/third_party/llvm-project/libcxx/include/__utility/integer_sequence.h index 257b430..633b387 100644 --- a/third_party/llvm-project/libcxx/include/__utility/integer_sequence.h +++ b/third_party/llvm-project/libcxx/include/__utility/integer_sequence.h
@@ -85,7 +85,7 @@ #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template<class _Tp, _Tp... _Ip> struct _LIBCPP_TEMPLATE_VIS integer_sequence @@ -138,15 +138,15 @@ template<class... _Tp> using index_sequence_for = make_index_sequence<sizeof...(_Tp)>; -# if _LIBCPP_STD_VER > 17 +# 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>(), ...); } -# endif // _LIBCPP_STD_VER > 17 +# endif // _LIBCPP_STD_VER >= 20 -#endif // _LIBCPP_STD_VER > 11 +#endif // _LIBCPP_STD_VER >= 14 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__utility/pair.h b/third_party/llvm-project/libcxx/include/__utility/pair.h index 8151674..77baba9 100644 --- a/third_party/llvm-project/libcxx/include/__utility/pair.h +++ b/third_party/llvm-project/libcxx/include/__utility/pair.h
@@ -15,13 +15,14 @@ #include <__functional/unwrap_ref.h> #include <__fwd/get.h> #include <__fwd/tuple.h> -#include <__tuple_dir/sfinae_helpers.h> -#include <__tuple_dir/tuple_element.h> -#include <__tuple_dir/tuple_indices.h> -#include <__tuple_dir/tuple_size.h> +#include <__tuple/sfinae_helpers.h> +#include <__tuple/tuple_element.h> +#include <__tuple/tuple_indices.h> +#include <__tuple/tuple_size.h> #include <__type_traits/common_reference.h> #include <__type_traits/common_type.h> #include <__type_traits/conditional.h> +#include <__type_traits/decay.h> #include <__type_traits/is_assignable.h> #include <__type_traits/is_constructible.h> #include <__type_traits/is_convertible.h> @@ -49,15 +50,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if defined(_LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR) template <class, class> struct __non_trivially_copyable_base { - _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR _LIBCPP_HIDE_FROM_ABI __non_trivially_copyable_base() _NOEXCEPT {} - _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI __non_trivially_copyable_base(__non_trivially_copyable_base const&) _NOEXCEPT {} }; -#endif template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS pair @@ -65,8 +64,8 @@ : private __non_trivially_copyable_base<_T1, _T2> #endif { - typedef _T1 first_type; - typedef _T2 second_type; + using first_type = _T1; + using second_type = _T2; _T1 first; _T2 second; @@ -75,17 +74,17 @@ pair(pair&&) = default; #ifdef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI pair() : first(), second() {} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI pair(_T1 const& __t1, _T2 const& __t2) : first(__t1), second(__t2) {} template <class _U1, class _U2> - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI pair(const pair<_U1, _U2>& __p) : first(__p.first), second(__p.second) {} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI pair& operator=(pair const& __p) { first = __p.first; second = __p.second; @@ -154,7 +153,7 @@ template <class _Tuple> using _CheckTLC _LIBCPP_NODEBUG = __conditional_t< __tuple_like_with_size<_Tuple, 2>::value - && !is_same<typename decay<_Tuple>::type, pair>::value, + && !is_same<__decay_t<_Tuple>, pair>::value, _CheckTupleLikeConstructor, __check_tuple_constructor_fail >; @@ -162,7 +161,7 @@ template<bool _Dummy = true, typename enable_if< _CheckArgsDep<_Dummy>::__enable_explicit_default() >::type* = nullptr> - explicit _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + explicit _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR pair() _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value && is_nothrow_default_constructible<second_type>::value) : first(), second() {} @@ -170,7 +169,7 @@ template<bool _Dummy = true, typename enable_if< _CheckArgsDep<_Dummy>::__enable_implicit_default() >::type* = nullptr> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR pair() _NOEXCEPT_(is_nothrow_default_constructible<first_type>::value && is_nothrow_default_constructible<second_type>::value) : first(), second() {} @@ -178,7 +177,7 @@ template <bool _Dummy = true, typename enable_if< _CheckArgsDep<_Dummy>::template __enable_explicit<_T1 const&, _T2 const&>() >::type* = nullptr> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(_T1 const& __t1, _T2 const& __t2) _NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value && is_nothrow_copy_constructible<second_type>::value) @@ -187,41 +186,41 @@ template<bool _Dummy = true, typename enable_if< _CheckArgsDep<_Dummy>::template __enable_implicit<_T1 const&, _T2 const&>() >::type* = nullptr> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(_T1 const& __t1, _T2 const& __t2) _NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value && is_nothrow_copy_constructible<second_type>::value) : first(__t1), second(__t2) {} template < -#if _LIBCPP_STD_VER > 20 // http://wg21.link/P1951 +#if _LIBCPP_STD_VER >= 23 // http://wg21.link/P1951 class _U1 = _T1, class _U2 = _T2, #else class _U1, class _U2, #endif typename enable_if<_CheckArgs::template __enable_explicit<_U1, _U2>()>::type* = nullptr > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(_U1&& __u1, _U2&& __u2) _NOEXCEPT_((is_nothrow_constructible<first_type, _U1>::value && is_nothrow_constructible<second_type, _U2>::value)) - : first(_VSTD::forward<_U1>(__u1)), second(_VSTD::forward<_U2>(__u2)) {} + : first(std::forward<_U1>(__u1)), second(std::forward<_U2>(__u2)) {} template < -#if _LIBCPP_STD_VER > 20 // http://wg21.link/P1951 +#if _LIBCPP_STD_VER >= 23 // http://wg21.link/P1951 class _U1 = _T1, class _U2 = _T2, #else class _U1, class _U2, #endif typename enable_if<_CheckArgs::template __enable_implicit<_U1, _U2>()>::type* = nullptr > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(_U1&& __u1, _U2&& __u2) _NOEXCEPT_((is_nothrow_constructible<first_type, _U1>::value && is_nothrow_constructible<second_type, _U2>::value)) - : first(_VSTD::forward<_U1>(__u1)), second(_VSTD::forward<_U2>(__u2)) {} + : first(std::forward<_U1>(__u1)), second(std::forward<_U2>(__u2)) {} -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template<class _U1, class _U2, __enable_if_t< _CheckArgs::template __is_pair_constructible<_U1&, _U2&>() >* = nullptr> @@ -235,7 +234,7 @@ template<class _U1, class _U2, typename enable_if< _CheckArgs::template __enable_explicit<_U1 const&, _U2 const&>() >::type* = nullptr> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(pair<_U1, _U2> const& __p) _NOEXCEPT_((is_nothrow_constructible<first_type, _U1 const&>::value && is_nothrow_constructible<second_type, _U2 const&>::value)) @@ -244,7 +243,7 @@ template<class _U1, class _U2, typename enable_if< _CheckArgs::template __enable_implicit<_U1 const&, _U2 const&>() >::type* = nullptr> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(pair<_U1, _U2> const& __p) _NOEXCEPT_((is_nothrow_constructible<first_type, _U1 const&>::value && is_nothrow_constructible<second_type, _U2 const&>::value)) @@ -253,22 +252,22 @@ template<class _U1, class _U2, typename enable_if< _CheckArgs::template __enable_explicit<_U1, _U2>() >::type* = nullptr> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(pair<_U1, _U2>&&__p) _NOEXCEPT_((is_nothrow_constructible<first_type, _U1&&>::value && is_nothrow_constructible<second_type, _U2&&>::value)) - : first(_VSTD::forward<_U1>(__p.first)), second(_VSTD::forward<_U2>(__p.second)) {} + : first(std::forward<_U1>(__p.first)), second(std::forward<_U2>(__p.second)) {} template<class _U1, class _U2, typename enable_if< _CheckArgs::template __enable_implicit<_U1, _U2>() >::type* = nullptr> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(pair<_U1, _U2>&& __p) _NOEXCEPT_((is_nothrow_constructible<first_type, _U1&&>::value && is_nothrow_constructible<second_type, _U2&&>::value)) - : first(_VSTD::forward<_U1>(__p.first)), second(_VSTD::forward<_U2>(__p.second)) {} + : first(std::forward<_U1>(__p.first)), second(std::forward<_U2>(__p.second)) {} -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template<class _U1, class _U2, __enable_if_t< _CheckArgs::template __is_pair_constructible<const _U1&&, const _U2&&>() >* = nullptr> @@ -283,21 +282,21 @@ template<class _Tuple, typename enable_if< _CheckTLC<_Tuple>::template __enable_explicit<_Tuple>() >::type* = nullptr> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 explicit pair(_Tuple&& __p) - : first(_VSTD::get<0>(_VSTD::forward<_Tuple>(__p))), - second(_VSTD::get<1>(_VSTD::forward<_Tuple>(__p))) {} + : first(std::get<0>(std::forward<_Tuple>(__p))), + second(std::get<1>(std::forward<_Tuple>(__p))) {} template<class _Tuple, typename enable_if< _CheckTLC<_Tuple>::template __enable_implicit<_Tuple>() >::type* = nullptr> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair(_Tuple&& __p) - : first(_VSTD::get<0>(_VSTD::forward<_Tuple>(__p))), - second(_VSTD::get<1>(_VSTD::forward<_Tuple>(__p))) {} + : first(std::get<0>(std::forward<_Tuple>(__p))), + second(std::get<1>(std::forward<_Tuple>(__p))) {} template <class... _Args1, class... _Args2> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args, tuple<_Args2...> __second_args) _NOEXCEPT_((is_nothrow_constructible<first_type, _Args1...>::value && @@ -306,7 +305,7 @@ typename __make_tuple_indices<sizeof...(_Args1)>::type(), typename __make_tuple_indices<sizeof...(_Args2) >::type()) {} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=(__conditional_t< is_copy_assignable<first_type>::value && is_copy_assignable<second_type>::value, @@ -319,7 +318,7 @@ return *this; } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=(__conditional_t< is_move_assignable<first_type>::value && is_move_assignable<second_type>::value, @@ -327,12 +326,12 @@ _NOEXCEPT_(is_nothrow_move_assignable<first_type>::value && is_nothrow_move_assignable<second_type>::value) { - first = _VSTD::forward<first_type>(__p.first); - second = _VSTD::forward<second_type>(__p.second); + first = std::forward<first_type>(__p.first); + second = std::forward<second_type>(__p.second); return *this; } -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 _LIBCPP_HIDE_FROM_ABI constexpr const pair& operator=(pair const& __p) const noexcept(is_nothrow_copy_assignable_v<const first_type> && @@ -374,30 +373,30 @@ second = std::forward<_U2>(__p.second); return *this; } -#endif // _LIBCPP_STD_VER > 20 +#endif // _LIBCPP_STD_VER >= 23 template <class _Tuple, typename enable_if< _CheckTLC<_Tuple>::template __enable_assign<_Tuple>() >::type* = nullptr> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair& operator=(_Tuple&& __p) { - first = _VSTD::get<0>(_VSTD::forward<_Tuple>(__p)); - second = _VSTD::get<1>(_VSTD::forward<_Tuple>(__p)); + first = std::get<0>(std::forward<_Tuple>(__p)); + second = std::get<1>(std::forward<_Tuple>(__p)); return *this; } -#endif +#endif // _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(pair& __p) _NOEXCEPT_(__is_nothrow_swappable<first_type>::value && __is_nothrow_swappable<second_type>::value) { - using _VSTD::swap; + using std::swap; swap(first, __p.first); swap(second, __p.second); } -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 _LIBCPP_HIDE_FROM_ABI constexpr void swap(const pair& __p) const noexcept(__is_nothrow_swappable<const first_type>::value && @@ -412,88 +411,88 @@ #ifndef _LIBCPP_CXX03_LANG template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 pair(piecewise_construct_t, tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args, __tuple_indices<_I1...>, __tuple_indices<_I2...>); #endif }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template<class _T1, class _T2> pair(_T1, _T2) -> pair<_T1, _T2>; #endif // [pairs.spec], specialized algorithms -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 +template <class _T1, class _T2, class _U1, class _U2> +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool -operator==(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) +operator==(const pair<_T1,_T2>& __x, const pair<_U1,_U2>& __y) { return __x.first == __y.first && __x.second == __y.second; } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 -template <class _T1, class _T2> +template <class _T1, class _T2, class _U1, class _U2> _LIBCPP_HIDE_FROM_ABI constexpr common_comparison_category_t< - __synth_three_way_result<_T1>, - __synth_three_way_result<_T2> > -operator<=>(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) + __synth_three_way_result<_T1, _U1>, + __synth_three_way_result<_T2, _U2> > +operator<=>(const pair<_T1,_T2>& __x, const pair<_U1,_U2>& __y) { - if (auto __c = _VSTD::__synth_three_way(__x.first, __y.first); __c != 0) { + if (auto __c = std::__synth_three_way(__x.first, __y.first); __c != 0) { return __c; } - return _VSTD::__synth_three_way(__x.second, __y.second); + return std::__synth_three_way(__x.second, __y.second); } -#else // _LIBCPP_STD_VER > 17 +#else // _LIBCPP_STD_VER >= 20 -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 +template <class _T1, class _T2, class _U1, class _U2> +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool -operator!=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) +operator!=(const pair<_T1,_T2>& __x, const pair<_U1,_U2>& __y) { return !(__x == __y); } -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 +template <class _T1, class _T2, class _U1, class _U2> +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool -operator< (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) +operator< (const pair<_T1,_T2>& __x, const pair<_U1,_U2>& __y) { return __x.first < __y.first || (!(__y.first < __x.first) && __x.second < __y.second); } -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 +template <class _T1, class _T2, class _U1, class _U2> +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool -operator> (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) +operator> (const pair<_T1,_T2>& __x, const pair<_U1,_U2>& __y) { return __y < __x; } -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 +template <class _T1, class _T2, class _U1, class _U2> +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool -operator>=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) +operator>=(const pair<_T1,_T2>& __x, const pair<_U1,_U2>& __y) { return !(__x < __y); } -template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 +template <class _T1, class _T2, class _U1, class _U2> +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 bool -operator<=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y) +operator<=(const pair<_T1,_T2>& __x, const pair<_U1,_U2>& __y) { return !(__y < __x); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <class _T1, class _T2, class _U1, class _U2, template<class> class _TQual, template<class> class _UQual> requires requires { typename pair<common_reference_t<_TQual<_T1>, _UQual<_U1>>, common_reference_t<_TQual<_T2>, _UQual<_U2>>>; } @@ -507,10 +506,10 @@ struct common_type<pair<_T1, _T2>, pair<_U1, _U2>> { using type = pair<common_type_t<_T1, _U1>, common_type_t<_T2, _U2>>; }; -#endif // _LIBCPP_STD_VER > 20 +#endif // _LIBCPP_STD_VER >= 23 template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 typename enable_if < __is_swappable<_T1>::value && @@ -524,7 +523,7 @@ __x.swap(__y); } -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <class _T1, class _T2> requires (__is_swappable<const _T1>::value && __is_swappable<const _T2>::value) @@ -537,12 +536,12 @@ #endif template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 pair<typename __unwrap_ref_decay<_T1>::type, typename __unwrap_ref_decay<_T2>::type> make_pair(_T1&& __t1, _T2&& __t2) { return pair<typename __unwrap_ref_decay<_T1>::type, typename __unwrap_ref_decay<_T2>::type> - (_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2)); + (std::forward<_T1>(__t1), std::forward<_T2>(__t2)); } template <class _T1, class _T2> @@ -558,13 +557,13 @@ template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS tuple_element<0, pair<_T1, _T2> > { - typedef _LIBCPP_NODEBUG _T1 type; + using type _LIBCPP_NODEBUG = _T1; }; template <class _T1, class _T2> struct _LIBCPP_TEMPLATE_VIS tuple_element<1, pair<_T1, _T2> > { - typedef _LIBCPP_NODEBUG _T2 type; + using type _LIBCPP_NODEBUG = _T2; }; template <size_t _Ip> struct __get_pair; @@ -574,27 +573,27 @@ { template <class _T1, class _T2> static - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T1& get(pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;} template <class _T1, class _T2> static - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T1& get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;} template <class _T1, class _T2> static - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T1&& - get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T1>(__p.first);} + get(pair<_T1, _T2>&& __p) _NOEXCEPT {return std::forward<_T1>(__p.first);} template <class _T1, class _T2> static - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T1&& - get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<const _T1>(__p.first);} + get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return std::forward<const _T1>(__p.first);} }; template <> @@ -602,31 +601,31 @@ { template <class _T1, class _T2> static - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T2& get(pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;} template <class _T1, class _T2> static - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T2& get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;} template <class _T1, class _T2> static - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _T2&& - get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T2>(__p.second);} + get(pair<_T1, _T2>&& __p) _NOEXCEPT {return std::forward<_T2>(__p.second);} template <class _T1, class _T2> static - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const _T2&& - get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<const _T2>(__p.second);} + get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return std::forward<const _T2>(__p.second);} }; template <size_t _Ip, class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type& get(pair<_T1, _T2>& __p) _NOEXCEPT { @@ -634,7 +633,7 @@ } template <size_t _Ip, class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type& get(const pair<_T1, _T2>& __p) _NOEXCEPT { @@ -642,79 +641,79 @@ } template <size_t _Ip, class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename tuple_element<_Ip, pair<_T1, _T2> >::type&& get(pair<_T1, _T2>&& __p) _NOEXCEPT { - return __get_pair<_Ip>::get(_VSTD::move(__p)); + return __get_pair<_Ip>::get(std::move(__p)); } template <size_t _Ip, class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const typename tuple_element<_Ip, pair<_T1, _T2> >::type&& get(const pair<_T1, _T2>&& __p) _NOEXCEPT { - return __get_pair<_Ip>::get(_VSTD::move(__p)); + return __get_pair<_Ip>::get(std::move(__p)); } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 & get(pair<_T1, _T2>& __p) _NOEXCEPT { return __get_pair<0>::get(__p); } template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const & get(pair<_T1, _T2> const& __p) _NOEXCEPT { return __get_pair<0>::get(__p); } template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 && get(pair<_T1, _T2>&& __p) _NOEXCEPT { - return __get_pair<0>::get(_VSTD::move(__p)); + return __get_pair<0>::get(std::move(__p)); } template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const && get(pair<_T1, _T2> const&& __p) _NOEXCEPT { - return __get_pair<0>::get(_VSTD::move(__p)); + return __get_pair<0>::get(std::move(__p)); } template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 & get(pair<_T2, _T1>& __p) _NOEXCEPT { return __get_pair<1>::get(__p); } template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const & get(pair<_T2, _T1> const& __p) _NOEXCEPT { return __get_pair<1>::get(__p); } template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 && get(pair<_T2, _T1>&& __p) _NOEXCEPT { - return __get_pair<1>::get(_VSTD::move(__p)); + return __get_pair<1>::get(std::move(__p)); } template <class _T1, class _T2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI constexpr _T1 const && get(pair<_T2, _T1> const&& __p) _NOEXCEPT { - return __get_pair<1>::get(_VSTD::move(__p)); + return __get_pair<1>::get(std::move(__p)); } -#endif // _LIBCPP_STD_VER > 11 +#endif // _LIBCPP_STD_VER >= 14 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__utility/piecewise_construct.h b/third_party/llvm-project/libcxx/include/__utility/piecewise_construct.h index 3cc86fe..071e207 100644 --- a/third_party/llvm-project/libcxx/include/__utility/piecewise_construct.h +++ b/third_party/llvm-project/libcxx/include/__utility/piecewise_construct.h
@@ -18,9 +18,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t { explicit piecewise_construct_t() = default; }; -#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY) -extern _LIBCPP_EXPORTED_FROM_ABI const piecewise_construct_t piecewise_construct;// = piecewise_construct_t(); -#else + +#if defined(_LIBCPP_BUILDING_LIBRARY) +extern _LIBCPP_EXPORTED_FROM_ABI const piecewise_construct_t piecewise_construct; +#elif !defined(_LIBCPP_CXX03_LANG) /* inline */ constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t(); #endif
diff --git a/third_party/llvm-project/libcxx/include/__utility/to_underlying.h b/third_party/llvm-project/libcxx/include/__utility/to_underlying.h index a194d3e..b70f70a 100644 --- a/third_party/llvm-project/libcxx/include/__utility/to_underlying.h +++ b/third_party/llvm-project/libcxx/include/__utility/to_underlying.h
@@ -27,7 +27,7 @@ } #endif // !_LIBCPP_CXX03_LANG -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <class _Tp> _LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY constexpr underlying_type_t<_Tp> to_underlying(_Tp __val) noexcept {
diff --git a/third_party/llvm-project/libcxx/include/__utility/unreachable.h b/third_party/llvm-project/libcxx/include/__utility/unreachable.h index d93e60b..bd1c6be 100644 --- a/third_party/llvm-project/libcxx/include/__utility/unreachable.h +++ b/third_party/llvm-project/libcxx/include/__utility/unreachable.h
@@ -23,7 +23,7 @@ __builtin_unreachable(); } -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 [[noreturn]] _LIBCPP_HIDE_FROM_ABI inline void unreachable() { __libcpp_unreachable(); }
diff --git a/third_party/llvm-project/libcxx/include/__variant/monostate.h b/third_party/llvm-project/libcxx/include/__variant/monostate.h index b3b4597..8fec340 100644 --- a/third_party/llvm-project/libcxx/include/__variant/monostate.h +++ b/third_party/llvm-project/libcxx/include/__variant/monostate.h
@@ -21,19 +21,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 struct _LIBCPP_TEMPLATE_VIS monostate {}; _LIBCPP_HIDE_FROM_ABI constexpr bool operator==(monostate, monostate) noexcept { return true; } -# if _LIBCPP_STD_VER > 17 +# if _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI constexpr strong_ordering operator<=>(monostate, monostate) noexcept { return strong_ordering::equal; } -# else // _LIBCPP_STD_VER > 17 +# else // _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI constexpr bool operator!=(monostate, monostate) noexcept { return false; } @@ -45,7 +45,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr bool operator>=(monostate, monostate) noexcept { return true; } -# endif // _LIBCPP_STD_VER > 17 +# endif // _LIBCPP_STD_VER >= 20 template <> struct _LIBCPP_TEMPLATE_VIS hash<monostate> { @@ -57,7 +57,7 @@ } }; -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/__verbose_abort b/third_party/llvm-project/libcxx/include/__verbose_abort index a16d75d..048d9ff 100644 --- a/third_party/llvm-project/libcxx/include/__verbose_abort +++ b/third_party/llvm-project/libcxx/include/__verbose_abort
@@ -21,7 +21,7 @@ // This function should never be called directly from the code -- it should only be called through // the _LIBCPP_VERBOSE_ABORT macro. -_LIBCPP_NORETURN _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) +_LIBCPP_NORETURN _LIBCPP_AVAILABILITY_VERBOSE_ABORT _LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) void __libcpp_verbose_abort(const char *__format, ...); // _LIBCPP_VERBOSE_ABORT(format, args...) @@ -40,16 +40,19 @@ // Support _LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED until LLVM 18, but tell people // to move to customizing _LIBCPP_VERBOSE_ABORT instead. -# if defined(_LIBCPP_HAS_NO_VERBOSE_ABORT_IN_LIBRARY) && defined(_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED) -# undef _LIBCPP_HAS_NO_VERBOSE_ABORT_IN_LIBRARY +# if defined(_LIBCPP_AVAILABILITY_HAS_NO_VERBOSE_ABORT) && defined(_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED) +# undef _LIBCPP_AVAILABILITY_HAS_NO_VERBOSE_ABORT # warning _LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED is deprecated, please customize _LIBCPP_VERBOSE_ABORT instead # endif -# if defined(_LIBCPP_HAS_NO_VERBOSE_ABORT_IN_LIBRARY) -# define _LIBCPP_VERBOSE_ABORT(...) __builtin_abort() +# if defined(_LIBCPP_AVAILABILITY_HAS_NO_VERBOSE_ABORT) +// The decltype is there to suppress -Wunused warnings in this configuration. +_LIBCPP_HIDE_FROM_ABI inline _LIBCPP_CONSTEXPR void __use(const char*, ...) { } +# define _LIBCPP_VERBOSE_ABORT(...) (decltype(::std::__use(__VA_ARGS__))(), __builtin_abort()) # else # define _LIBCPP_VERBOSE_ABORT(...) ::std::__libcpp_verbose_abort(__VA_ARGS__) # endif + #endif // !defined(_LIBCPP_VERBOSE_ABORT) _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/algorithm b/third_party/llvm-project/libcxx/include/algorithm index cb2d27c..9970a63 100644 --- a/third_party/llvm-project/libcxx/include/algorithm +++ b/third_party/llvm-project/libcxx/include/algorithm
@@ -22,41 +22,41 @@ // [algorithms.results], algorithm result types template <class I, class F> - struct in_fun_result; // since C++20 + struct in_fun_result; // since C++20 template <class I1, class I2> - struct in_in_result; // since C++20 + struct in_in_result; // since C++20 template <class I, class O> - struct in_out_result; // since C++20 + struct in_out_result; // since C++20 template <class I1, class I2, class O> - struct in_in_out_result; // since C++20 + struct in_in_out_result; // since C++20 template <class I, class O1, class O2> - struct in_out_out_result; // since C++20 + struct in_out_out_result; // since C++20 template <class I1, class I2> - struct min_max_result; // since C++20 + struct min_max_result; // since C++20 template <class I> - struct in_found_result; // since C++20 + struct in_found_result; // since C++20 template<forward_iterator I, sentinel_for<I> S, class Proj = identity, - indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20 + indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> // since C++20 constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {}); template<forward_range R, class Proj = identity, - indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> // since C++20 + indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> // since C++20 constexpr borrowed_iterator_t<R> min_element(R&& r, Comp comp = {}, Proj proj = {}); template<forward_iterator I, sentinel_for<I> S, class Proj = identity, indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> - constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 + constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 template<forward_range R, class Proj = identity, indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> - constexpr borrowed_iterator_t<R> ranges::max_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + constexpr borrowed_iterator_t<R> ranges::max_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 template<class I1, class I2> using mismatch_result = in_in_result<I1, I2>; @@ -64,86 +64,86 @@ template <input_iterator I1, sentinel_for<_I1> S1, input_iterator I2, sentinel_for<_I2> S2, class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> requires indirectly_comparable<I1, I2, Pred, Proj1, Proj2> - constexpr mismatch_result<_I1, _I2> - mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20 + constexpr mismatch_result<_I1, _I2> // since C++20 + mismatch()(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) template <input_range R1, input_range R2, class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> requires indirectly_comparable<iterator_t<R1>, iterator_t<R2>, Pred, Proj1, Proj2> constexpr mismatch_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> - mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20 + mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}) // since C++20 requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> - constexpr I find(I first, S last, const T& value, Proj proj = {}); // since C++20 + constexpr I find(I first, S last, const T& value, Proj proj = {}); // since C++20 template<input_range R, class T, class Proj = identity> requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> constexpr borrowed_iterator_t<R> - find(R&& r, const T& value, Proj proj = {}); // since C++20 + find(R&& r, const T& value, Proj proj = {}); // since C++20 template<input_iterator I, sentinel_for<I> S, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> - constexpr I find_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 + constexpr I find_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 template<input_range R, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> constexpr borrowed_iterator_t<R> - find_if(R&& r, Pred pred, Proj proj = {}); // since C++20 + find_if(R&& r, Pred pred, Proj proj = {}); // since C++20 template<input_iterator I, sentinel_for<I> S, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> - constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++20 + constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {}); // since C++20 template<input_range R, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> constexpr borrowed_iterator_t<R> - find_if_not(R&& r, Pred pred, Proj proj = {}); // since C++20 + find_if_not(R&& r, Pred pred, Proj proj = {}); // since C++20 template<class T, class Proj = identity, indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> - constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 + constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 template<copyable T, class Proj = identity, indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> - constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 + constexpr T min(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 template<input_range R, class Proj = identity, indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> constexpr range_value_t<R> - min(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + min(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 template<class T, class Proj = identity, indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> - constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 + constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 template<copyable T, class Proj = identity, indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> - constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 + constexpr T max(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 template<input_range R, class Proj = identity, indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> constexpr range_value_t<R> - max(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + max(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 template<class I, class O> - using unary_transform_result = in_out_result<I, O>; // since C++20 + using unary_transform_result = in_out_result<I, O>; // since C++20 template<class I1, class I2, class O> - using binary_transform_result = in_in_out_result<I1, I2, O>; // since C++20 + using binary_transform_result = in_in_out_result<I1, I2, O>; // since C++20 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, copy_constructible F, class Proj = identity> requires indirectly_writable<O, indirect_result_t<F&, projected<I, Proj>>> constexpr ranges::unary_transform_result<I, O> - transform(I first1, S last1, O result, F op, Proj proj = {}); // since C++20 + transform(I first1, S last1, O result, F op, Proj proj = {}); // since C++20 template<input_range R, weakly_incrementable O, copy_constructible F, class Proj = identity> requires indirectly_writable<O, indirect_result_t<F&, projected<iterator_t<R>, Proj>>> constexpr ranges::unary_transform_result<borrowed_iterator_t<R>, O> - transform(R&& r, O result, F op, Proj proj = {}); // since C++20 + transform(R&& r, O result, F op, Proj proj = {}); // since C++20 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, weakly_incrementable O, copy_constructible F, class Proj1 = identity, @@ -152,7 +152,7 @@ projected<I2, Proj2>>> constexpr ranges::binary_transform_result<I1, I2, O> transform(I1 first1, S1 last1, I2 first2, S2 last2, O result, - F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 template<input_range R1, input_range R2, weakly_incrementable O, copy_constructible F, class Proj1 = identity, class Proj2 = identity> @@ -160,27 +160,27 @@ projected<iterator_t<R2>, Proj2>>> constexpr ranges::binary_transform_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>, O> transform(R1&& r1, R2&& r2, O result, - F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 template<input_iterator I, sentinel_for<I> S, class T, class Proj = identity> requires indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> constexpr iter_difference_t<I> - count(I first, S last, const T& value, Proj proj = {}); // since C++20 + count(I first, S last, const T& value, Proj proj = {}); // since C++20 template<input_range R, class T, class Proj = identity> requires indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> constexpr range_difference_t<R> - count(R&& r, const T& value, Proj proj = {}); // since C++20 + count(R&& r, const T& value, Proj proj = {}); // since C++20 template<input_iterator I, sentinel_for<I> S, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> constexpr iter_difference_t<I> - count_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 + count_if(I first, S last, Pred pred, Proj proj = {}); // since C++20 template<input_range R, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> constexpr range_difference_t<R> - count_if(R&& r, Pred pred, Proj proj = {}); // since C++20 + count_if(R&& r, Pred pred, Proj proj = {}); // since C++20 template<class T> using minmax_result = min_max_result<T>; @@ -188,18 +188,18 @@ template<class T, class Proj = identity, indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> constexpr ranges::minmax_result<const T&> - minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 + minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); // since C++20 template<copyable T, class Proj = identity, indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less> constexpr ranges::minmax_result<T> - minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 + minmax(initializer_list<T> r, Comp comp = {}, Proj proj = {}); // since C++20 template<input_range R, class Proj = identity, indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> requires indirectly_copyable_storable<iterator_t<R>, range_value_t<R>*> constexpr ranges::minmax_result<range_value_t<R>> - minmax(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + minmax(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 template<class I> using minmax_element_result = min_max_result<I>; @@ -207,18 +207,18 @@ template<forward_iterator I, sentinel_for<I> S, class Proj = identity, indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> constexpr ranges::minmax_element_result<I> - minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 + minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 template<forward_range R, class Proj = identity, indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> constexpr ranges::minmax_element_result<borrowed_iterator_t<R>> - minmax_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 + minmax_element(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 template<class I, class O> - using copy_result = in_out_result<I, O>; // since C++20 + using copy_result = in_out_result<I, O>; // since C++20 template<class I, class O> - using copy_n_result = in_out_result<I, O>; // since C++20 + using copy_n_result = in_out_result<I, O>; // since C++20 template<class I, class O> using copy_if_result = in_out_result<I, O>; // since C++20 @@ -333,20 +333,20 @@ template<random_access_iterator I, sentinel_for<I> S, class Proj = identity, indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> - constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); // Since C++20 + constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 template<random_access_range R, class Proj = identity, indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> - constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {}); // Since C++20 + constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 template<random_access_iterator I, sentinel_for<I> S, class Proj = identity, indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> - constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); // Since C++20 + constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 template<random_access_range R, class Proj = identity, indirect_strict_weak_order<projected<iterator_t<R>, Proj>> Comp = ranges::less> constexpr borrowed_iterator_t<R> - is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); // Since C++20 + is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 template<bidirectional_iterator I, sentinel_for<I> S> requires permutable<I> @@ -399,15 +399,15 @@ template<input_or_output_iterator O, sentinel_for<O> S, copy_constructible F> requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>> - constexpr O generate(O first, S last, F gen); // Since C++20 + constexpr O generate(O first, S last, F gen); // since C++20 template<class R, copy_constructible F> requires invocable<F&> && output_range<R, invoke_result_t<F&>> - constexpr borrowed_iterator_t<R> generate(R&& r, F gen); // Since C++20 + constexpr borrowed_iterator_t<R> generate(R&& r, F gen); // since C++20 template<input_or_output_iterator O, copy_constructible F> requires invocable<F&> && indirectly_writable<O, invoke_result_t<F&>> - constexpr O generate_n(O first, iter_difference_t<O> n, F gen); // Since C++20 + constexpr O generate_n(O first, iter_difference_t<O> n, F gen); // since C++20 template<input_iterator I1, sentinel_for<I1> S1, input_iterator I2, sentinel_for<I2> S2, class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> @@ -424,27 +424,27 @@ template<input_iterator I, sentinel_for<I> S, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> - constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 + constexpr bool ranges::all_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 template<input_range R, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> - constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20 + constexpr bool ranges::all_of(R&& r, Pred pred, Proj proj = {}); // since C++20 template<input_iterator I, sentinel_for<I> S, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> - constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 + constexpr bool ranges::any_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 template<input_range R, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> - constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20 + constexpr bool ranges::any_of(R&& r, Pred pred, Proj proj = {}); // since C++20 template<input_iterator I, sentinel_for<I> S, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> - constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 + constexpr bool ranges::none_of(I first, S last, Pred pred, Proj proj = {}); // since C++20 template<input_range R, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> - constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20 + constexpr bool ranges::none_of(R&& r, Pred pred, Proj proj = {}); // since C++20 template<input_iterator I1, sentinel_for<I1> S1, random_access_iterator I2, sentinel_for<I2> S2, @@ -453,7 +453,7 @@ indirect_strict_weak_order<Comp, projected<I1, Proj1>, projected<I2, Proj2>> constexpr partial_sort_copy_result<I1, I2> partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last, - Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 template<input_range R1, random_access_range R2, class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> @@ -463,7 +463,7 @@ projected<iterator_t<R2>, Proj2>> constexpr partial_sort_copy_result<borrowed_iterator_t<R1>, borrowed_iterator_t<R2>> partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {}, - Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 template<forward_iterator I, sentinel_for<I> S, class Proj = identity, indirect_strict_weak_order<projected<I, Proj>> Comp = ranges::less> @@ -486,64 +486,64 @@ class Proj = identity> requires sortable<I, Comp, Proj> constexpr I - ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); // since C++20 + ranges::nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); // since C++20 template<random_access_range R, class Comp = ranges::less, class Proj = identity> requires sortable<iterator_t<R>, Comp, Proj> constexpr borrowed_iterator_t<R> - ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {}); // since C++20 + ranges::nth_element(R&& r, iterator_t<R> nth, Comp comp = {}, Proj proj = {}); // since C++20 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, - indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> - constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 + indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> // since C++20 + constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); template<forward_range R, class T, class Proj = identity, indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = ranges::less> constexpr borrowed_iterator_t<R> - upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 + upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> constexpr I lower_bound(I first, S last, const T& value, Comp comp = {}, - Proj proj = {}); // since C++20 + Proj proj = {}); // since C++20 template<forward_range R, class T, class Proj = identity, indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = ranges::less> constexpr borrowed_iterator_t<R> - lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 + lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); // since C++20 template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity, indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less> constexpr bool binary_search(I first, S last, const T& value, Comp comp = {}, - Proj proj = {}); // since C++20 + Proj proj = {}); // since C++20 template<forward_range R, class T, class Proj = identity, indirect_strict_weak_order<const T*, projected<iterator_t<R>, Proj>> Comp = ranges::less> constexpr bool binary_search(R&& r, const T& value, Comp comp = {}, - Proj proj = {}); // since C++20 + Proj proj = {}); // since C++20 template<permutable I, sentinel_for<I> S, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> constexpr subrange<I> - partition(I first, S last, Pred pred, Proj proj = {}); // Since C++20 + partition(I first, S last, Pred pred, Proj proj = {}); // since C++20 template<forward_range R, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> requires permutable<iterator_t<R>> constexpr borrowed_subrange_t<R> - partition(R&& r, Pred pred, Proj proj = {}); // Since C++20 + partition(R&& r, Pred pred, Proj proj = {}); // since C++20 template<bidirectional_iterator I, sentinel_for<I> S, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> requires permutable<I> - subrange<I> stable_partition(I first, S last, Pred pred, Proj proj = {}); // Since C++20 + subrange<I> stable_partition(I first, S last, Pred pred, Proj proj = {}); // since C++20 template<bidirectional_range R, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> requires permutable<iterator_t<R>> - borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, Proj proj = {}); // Since C++20 + borrowed_subrange_t<R> stable_partition(R&& r, Pred pred, Proj proj = {}); // since C++20 template<input_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2, class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> @@ -563,7 +563,7 @@ template<forward_iterator I, sentinel_for<I> S, class Proj = identity, indirect_binary_predicate<projected<I, Proj>, projected<I, Proj>> Pred = ranges::equal_to> - constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); // since C+20 + constexpr I ranges::adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); // since C++20 template<forward_range R, class Proj = identity, indirect_binary_predicate<projected<iterator_t<R>, Proj>, @@ -604,7 +604,7 @@ projected<I2, Proj2>> Comp = ranges::less> constexpr bool ranges::lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2, - Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 template<input_range R1, input_range R2, class Proj1 = identity, class Proj2 = identity, @@ -612,7 +612,7 @@ projected<iterator_t<R2>, Proj2>> Comp = ranges::less> constexpr bool ranges::lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {}, - Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 template<bidirectional_iterator I1, sentinel_for<I1> S1, bidirectional_iterator I2> requires indirectly_movable<I1, I2> @@ -643,7 +643,7 @@ requires indirectly_copyable<I, O1> && indirectly_copyable<I, O2> constexpr partition_copy_result<I, O1, O2> partition_copy(I first, S last, O1 out_true, O2 out_false, Pred pred, - Proj proj = {}); // Since C++20 + Proj proj = {}); // since C++20 template<input_range R, weakly_incrementable O1, weakly_incrementable O2, class Proj = identity, @@ -651,16 +651,16 @@ requires indirectly_copyable<iterator_t<R>, O1> && indirectly_copyable<iterator_t<R>, O2> constexpr partition_copy_result<borrowed_iterator_t<R>, O1, O2> - partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); // Since C++20 + partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); // since C++20 template<forward_iterator I, sentinel_for<I> S, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> - constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // Since C++20 + constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); // since C++20 template<forward_range R, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> constexpr borrowed_iterator_t<R> - partition_point(R&& r, Pred pred, Proj proj = {}); // Since C++20 + partition_point(R&& r, Pred pred, Proj proj = {}); // since C++20 template<class I1, class I2, class O> using merge_result = in_in_out_result<I1, I2, O>; // since C++20 @@ -755,7 +755,7 @@ template<forward_range R> requires permutable<iterator_t<R>> - constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle); // Since C++20 + constexpr borrowed_subrange_t<R> rotate(R&& r, iterator_t<R> middle); // since C++20 template <class _InIter, class _OutIter> using rotate_copy_result = in_out_result<_InIter, _OutIter>; // since C++20 @@ -774,23 +774,23 @@ requires (forward_iterator<I> || random_access_iterator<O>) && indirectly_copyable<I, O> && uniform_random_bit_generator<remove_reference_t<Gen>> - O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g); // Since C++20 + O sample(I first, S last, O out, iter_difference_t<I> n, Gen&& g); // since C++20 template<input_range R, weakly_incrementable O, class Gen> requires (forward_range<R> || random_access_iterator<O>) && indirectly_copyable<iterator_t<R>, O> && uniform_random_bit_generator<remove_reference_t<Gen>> - O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // Since C++20 + O sample(R&& r, O out, range_difference_t<R> n, Gen&& g); // since C++20 template<random_access_iterator I, sentinel_for<I> S, class Gen> requires permutable<I> && uniform_random_bit_generator<remove_reference_t<Gen>> - I shuffle(I first, S last, Gen&& g); // Since C++20 + I shuffle(I first, S last, Gen&& g); // since C++20 template<random_access_range R, class Gen> requires permutable<iterator_t<R>> && uniform_random_bit_generator<remove_reference_t<Gen>> - borrowed_iterator_t<R> shuffle(R&& r, Gen&& g); // Since C++20 + borrowed_iterator_t<R> shuffle(R&& r, Gen&& g); // since C++20 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2, class Proj1 = identity, class Proj2 = identity, @@ -798,14 +798,14 @@ projected<I2, Proj2>> Pred = ranges::equal_to> constexpr bool ranges::is_permutation(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, - Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 template<forward_range R1, forward_range R2, class Proj1 = identity, class Proj2 = identity, indirect_equivalence_relation<projected<iterator_t<R1>, Proj1>, projected<iterator_t<R2>, Proj2>> Pred = ranges::equal_to> constexpr bool ranges::is_permutation(R1&& r1, R2&& r2, Pred pred = {}, - Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 template<forward_iterator I1, sentinel_for<I1> S1, forward_iterator I2, sentinel_for<I2> S2, class Pred = ranges::equal_to, @@ -904,35 +904,35 @@ indirect_strict_weak_order<projected<I1, Proj1>, projected<I2, Proj2>> Comp = ranges::less> constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {}, - Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 template<input_range R1, input_range R2, class Proj1 = identity, class Proj2 = identity, indirect_strict_weak_order<projected<iterator_t<R1>, Proj1>, projected<iterator_t<R2>, Proj2>> Comp = ranges::less> constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {}, - Proj1 proj1 = {}, Proj2 proj2 = {}); // Since C++20 + Proj1 proj1 = {}, Proj2 proj2 = {}); // since C++20 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less, class Proj = identity> requires sortable<I, Comp, Proj> - I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // Since C++20 + I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); // since C++20 template<bidirectional_range R, class Comp = ranges::less, class Proj = identity> requires sortable<iterator_t<R>, Comp, Proj> borrowed_iterator_t<R> inplace_merge(R&& r, iterator_t<R> middle, Comp comp = {}, - Proj proj = {}); // Since C++20 + Proj proj = {}); // since C++20 template<permutable I, sentinel_for<I> S, class Proj = identity, indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to> - constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {}); // Since C++20 + constexpr subrange<I> unique(I first, S last, C comp = {}, Proj proj = {}); // since C++20 template<forward_range R, class Proj = identity, indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to> requires permutable<iterator_t<R>> constexpr borrowed_subrange_t<R> - unique(R&& r, C comp = {}, Proj proj = {}); // Since C++20 + unique(R&& r, C comp = {}, Proj proj = {}); // since C++20 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity, indirect_equivalence_relation<projected<I, Proj>> C = ranges::equal_to> @@ -941,7 +941,7 @@ (input_iterator<O> && same_as<iter_value_t<I>, iter_value_t<O>>) || indirectly_copyable_storable<I, O>) constexpr unique_copy_result<I, O> - unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); // Since C++20 + unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); // since C++20 template<input_range R, weakly_incrementable O, class Proj = identity, indirect_equivalence_relation<projected<iterator_t<R>, Proj>> C = ranges::equal_to> @@ -950,41 +950,41 @@ (input_iterator<O> && same_as<range_value_t<R>, iter_value_t<O>>) || indirectly_copyable_storable<iterator_t<R>, O>) constexpr unique_copy_result<borrowed_iterator_t<R>, O> - unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); // Since C++20 + unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); // since C++20 template<class I, class O> - using remove_copy_result = in_out_result<I, O>; // Since C++20 + using remove_copy_result = in_out_result<I, O>; // since C++20 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class T, class Proj = identity> indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T*> constexpr remove_copy_result<I, O> - remove_copy(I first, S last, O result, const T& value, Proj proj = {}); // Since C++20 + remove_copy(I first, S last, O result, const T& value, Proj proj = {}); // since C++20 template<input_range R, weakly_incrementable O, class T, class Proj = identity> requires indirectly_copyable<iterator_t<R>, O> && indirect_binary_predicate<ranges::equal_to, projected<iterator_t<R>, Proj>, const T*> constexpr remove_copy_result<borrowed_iterator_t<R>, O> - remove_copy(R&& r, O result, const T& value, Proj proj = {}); // Since C++20 + remove_copy(R&& r, O result, const T& value, Proj proj = {}); // since C++20 template<class I, class O> - using remove_copy_if_result = in_out_result<I, O>; // Since C++20 + using remove_copy_if_result = in_out_result<I, O>; // since C++20 template<input_iterator I, sentinel_for<I> S, weakly_incrementable O, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> requires indirectly_copyable<I, O> constexpr remove_copy_if_result<I, O> - remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // Since C++20 + remove_copy_if(I first, S last, O result, Pred pred, Proj proj = {}); // since C++20 template<input_range R, weakly_incrementable O, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> requires indirectly_copyable<iterator_t<R>, O> constexpr remove_copy_if_result<borrowed_iterator_t<R>, O> - remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); // Since C++20 + remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); // since C++20 template<class I, class O> - using replace_copy_result = in_out_result<I, O>; // Since C++20 + using replace_copy_result = in_out_result<I, O>; // since C++20 template<input_iterator I, sentinel_for<I> S, class T1, class T2, output_iterator<const T2&> O, class Proj = identity> @@ -992,7 +992,7 @@ indirect_binary_predicate<ranges::equal_to, projected<I, Proj>, const T1*> constexpr replace_copy_result<I, O> replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value, - Proj proj = {}); // Since C++20 + Proj proj = {}); // since C++20 template<input_range R, class T1, class T2, output_iterator<const T2&> O, class Proj = identity> @@ -1001,54 +1001,54 @@ projected<iterator_t<R>, Proj>, const T1*> constexpr replace_copy_result<borrowed_iterator_t<R>, O> replace_copy(R&& r, O result, const T1& old_value, const T2& new_value, - Proj proj = {}); // Since C++20 + Proj proj = {}); // since C++20 template<class I, class O> - using replace_copy_if_result = in_out_result<I, O>; // Since C++20 + using replace_copy_if_result = in_out_result<I, O>; // since C++20 template<input_iterator I, sentinel_for<I> S, class T, output_iterator<const T&> O, class Proj = identity, indirect_unary_predicate<projected<I, Proj>> Pred> requires indirectly_copyable<I, O> constexpr replace_copy_if_result<I, O> replace_copy_if(I first, S last, O result, Pred pred, const T& new_value, - Proj proj = {}); // Since C++20 + Proj proj = {}); // since C++20 template<input_range R, class T, output_iterator<const T&> O, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> requires indirectly_copyable<iterator_t<R>, O> constexpr replace_copy_if_result<borrowed_iterator_t<R>, O> replace_copy_if(R&& r, O result, Pred pred, const T& new_value, - Proj proj = {}); // Since C++20 + Proj proj = {}); // since C++20 template<class I> - using prev_permutation_result = in_found_result<I>; // Since C++20 + using prev_permutation_result = in_found_result<I>; // since C++20 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less, class Proj = identity> requires sortable<I, Comp, Proj> constexpr ranges::prev_permutation_result<I> - ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // Since C++20 + ranges::prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 template<bidirectional_range R, class Comp = ranges::less, class Proj = identity> requires sortable<iterator_t<R>, Comp, Proj> constexpr ranges::prev_permutation_result<borrowed_iterator_t<R>> - ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); // Since C++20 + ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 template<class I> - using next_permutation_result = in_found_result<I>; // Since C++20 + using next_permutation_result = in_found_result<I>; // since C++20 template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less, class Proj = identity> requires sortable<I, Comp, Proj> constexpr ranges::next_permutation_result<I> - ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // Since C++20 + ranges::next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); // since C++20 template<bidirectional_range R, class Comp = ranges::less, class Proj = identity> requires sortable<iterator_t<R>, Comp, Proj> constexpr ranges::next_permutation_result<borrowed_iterator_t<R>> - ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {}); // Since C++20 + ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {}); // since C++20 } @@ -1684,6 +1684,18 @@ lexicographical_compare(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, Compare comp); +template<class InputIterator1, class InputIterator2, class Cmp> + constexpr auto + lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2, + Cmp comp) + -> decltype(comp(*b1, *b2)); // since C++20 + +template<class InputIterator1, class InputIterator2> + constexpr auto + lexicographical_compare_three_way(InputIterator1 first1, InputIterator1 last1, + InputIterator2 first2, InputIterator2 last2); // since C++20 + template <class BidirectionalIterator> constexpr bool // constexpr in C++20 next_permutation(BidirectionalIterator first, BidirectionalIterator last); @@ -1707,7 +1719,6 @@ #include <__config> #include <__debug> #include <cstddef> -#include <type_traits> #include <version> #include <__algorithm/adjacent_find.h> @@ -1753,6 +1764,7 @@ #include <__algorithm/is_sorted_until.h> #include <__algorithm/iter_swap.h> #include <__algorithm/lexicographical_compare.h> +#include <__algorithm/lexicographical_compare_three_way.h> #include <__algorithm/lower_bound.h> #include <__algorithm/make_heap.h> #include <__algorithm/max.h> @@ -1915,11 +1927,14 @@ #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <atomic> +# include <bit> # include <concepts> +# include <cstdlib> # include <cstring> # include <iterator> # include <memory> # include <stdexcept> +# include <type_traits> # include <utility> #endif
diff --git a/third_party/llvm-project/libcxx/include/any b/third_party/llvm-project/libcxx/include/any index 92cbc9a..963e5e0 100644 --- a/third_party/llvm-project/libcxx/include/any +++ b/third_party/llvm-project/libcxx/include/any
@@ -87,13 +87,27 @@ #include <__memory/allocator_destructor.h> #include <__memory/allocator_traits.h> #include <__memory/unique_ptr.h> +#include <__type_traits/add_const.h> +#include <__type_traits/add_pointer.h> +#include <__type_traits/aligned_storage.h> +#include <__type_traits/alignment_of.h> +#include <__type_traits/conditional.h> +#include <__type_traits/decay.h> +#include <__type_traits/is_constructible.h> +#include <__type_traits/is_copy_constructible.h> +#include <__type_traits/is_function.h> +#include <__type_traits/is_nothrow_move_constructible.h> +#include <__type_traits/is_reference.h> +#include <__type_traits/is_same.h> +#include <__type_traits/remove_cv.h> +#include <__type_traits/remove_cvref.h> +#include <__type_traits/remove_reference.h> #include <__utility/forward.h> #include <__utility/in_place.h> #include <__utility/move.h> #include <__utility/unreachable.h> -#include <cstdlib> +#include <__verbose_abort> #include <initializer_list> -#include <type_traits> #include <typeinfo> #include <version> @@ -111,16 +125,16 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST void __throw_bad_any_cast() { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw bad_any_cast(); #else - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("bad_any_cast was thrown in -fno-exceptions mode"); #endif } @@ -175,7 +189,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool __compare_typeid(type_info const* __id, const void* __fallback_id) { -#if !defined(_LIBCPP_NO_RTTI) +#if !defined(_LIBCPP_HAS_NO_RTTI) if (__id && *__id == typeid(_Tp)) return true; #endif @@ -294,7 +308,7 @@ _LIBCPP_INLINE_VISIBILITY bool has_value() const _NOEXCEPT { return __h_ != nullptr; } -#if !defined(_LIBCPP_NO_RTTI) +#if !defined(_LIBCPP_HAS_NO_RTTI) _LIBCPP_INLINE_VISIBILITY const type_info & type() const _NOEXCEPT { if (__h_) { @@ -426,7 +440,7 @@ _LIBCPP_INLINE_VISIBILITY static void* __type_info() { -#if !defined(_LIBCPP_NO_RTTI) +#if !defined(_LIBCPP_HAS_NO_RTTI) return const_cast<void*>(static_cast<void const *>(&typeid(_Tp))); #else return nullptr; @@ -514,7 +528,7 @@ _LIBCPP_INLINE_VISIBILITY static void* __type_info() { -#if !defined(_LIBCPP_NO_RTTI) +#if !defined(_LIBCPP_HAS_NO_RTTI) return const_cast<void*>(static_cast<void const *>(&typeid(_Tp))); #else return nullptr; @@ -680,7 +694,7 @@ typedef add_pointer_t<_ValueType> _ReturnType; if (__any && __any->__h_) { void *__p = __any->__call(_Action::_Get, nullptr, -#if !defined(_LIBCPP_NO_RTTI) +#if !defined(_LIBCPP_HAS_NO_RTTI) &typeid(_ValueType), #else nullptr, @@ -692,7 +706,7 @@ return nullptr; } -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD @@ -703,9 +717,11 @@ #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <atomic> # include <concepts> +# include <cstdlib> # include <iosfwd> # include <iterator> # include <memory> +# include <type_traits> # include <variant> #endif
diff --git a/third_party/llvm-project/libcxx/include/array b/third_party/llvm-project/libcxx/include/array index 068a6bd..cdabc06 100644 --- a/third_party/llvm-project/libcxx/include/array +++ b/third_party/llvm-project/libcxx/include/array
@@ -115,12 +115,21 @@ #include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__iterator/reverse_iterator.h> -#include <__tuple_dir/sfinae_helpers.h> +#include <__tuple/sfinae_helpers.h> +#include <__type_traits/conditional.h> +#include <__type_traits/is_array.h> +#include <__type_traits/is_const.h> +#include <__type_traits/is_constructible.h> +#include <__type_traits/is_move_constructible.h> +#include <__type_traits/is_nothrow_constructible.h> +#include <__type_traits/is_nothrow_move_constructible.h> +#include <__type_traits/is_same.h> +#include <__type_traits/is_swappable.h> +#include <__type_traits/remove_cv.h> #include <__utility/integer_sequence.h> #include <__utility/move.h> #include <__utility/unreachable.h> #include <stdexcept> -#include <type_traits> #include <version> // standard-mandated includes @@ -137,8 +146,8 @@ #include <initializer_list> // [tuple.helper] -#include <__tuple_dir/tuple_element.h> -#include <__tuple_dir/tuple_size.h> +#include <__tuple/tuple_element.h> +#include <__tuple/tuple_size.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -376,7 +385,7 @@ }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template<class _Tp, class... _Args, class = enable_if_t<__all<_IsSame<_Tp, _Args>::value...>::value> > @@ -489,7 +498,7 @@ return _VSTD::move(__a.__elems_[_Ip]); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <typename _Tp, size_t _Size, size_t... _Index> _LIBCPP_INLINE_VISIBILITY constexpr array<remove_cv_t<_Tp>, _Size> @@ -528,14 +537,16 @@ make_index_sequence<_Size>()); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <algorithm> # include <concepts> +# include <cstdlib> # include <iterator> +# include <type_traits> # include <utility> #endif
diff --git a/third_party/llvm-project/libcxx/include/atomic b/third_party/llvm-project/libcxx/include/atomic index d0d682d..2f122a7 100644 --- a/third_party/llvm-project/libcxx/include/atomic +++ b/third_party/llvm-project/libcxx/include/atomic
@@ -519,2154 +519,39 @@ */ #include <__assert> // all public C++ headers provide the assertion handler -#include <__availability> -#include <__chrono/duration.h> +#include <__atomic/aliases.h> +#include <__atomic/atomic.h> +#include <__atomic/atomic_base.h> +#include <__atomic/atomic_flag.h> +#include <__atomic/atomic_init.h> +#include <__atomic/atomic_lock_free.h> +#include <__atomic/atomic_sync.h> +#include <__atomic/check_memory_order.h> +#include <__atomic/contention_t.h> +#include <__atomic/cxx_atomic_impl.h> +#include <__atomic/fence.h> +#include <__atomic/is_always_lock_free.h> +#include <__atomic/kill_dependency.h> +#include <__atomic/memory_order.h> #include <__config> -#include <__thread/poll_with_backoff.h> -#include <__thread/timed_backoff_policy.h> -#include <__type_traits/conditional.h> -#include <__type_traits/decay.h> -#include <__type_traits/is_assignable.h> -#include <__type_traits/is_function.h> -#include <__type_traits/is_nothrow_default_constructible.h> -#include <__type_traits/is_same.h> -#include <__type_traits/is_trivially_copyable.h> -#include <__type_traits/remove_const.h> -#include <__type_traits/remove_pointer.h> -#include <__type_traits/underlying_type.h> -#include <cstddef> -#include <cstdint> -#include <cstring> #include <version> -#ifndef _LIBCPP_HAS_NO_THREADS -# include <__threading_support> -#endif - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif #ifdef _LIBCPP_HAS_NO_ATOMIC_HEADER -# error <atomic> is not implemented +# error <atomic> is not implemented #endif + #ifdef kill_dependency -# error <atomic> is incompatible with <stdatomic.h> before C++23. Please compile with -std=c++23. +# error <atomic> is incompatible with <stdatomic.h> before C++23. Please compile with -std=c++23. #endif -#define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) \ - _LIBCPP_DIAGNOSE_WARNING(__m == memory_order_consume || \ - __m == memory_order_acquire || \ - __m == memory_order_acq_rel, \ - "memory order argument to atomic operation is invalid") - -#define _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) \ - _LIBCPP_DIAGNOSE_WARNING(__m == memory_order_release || \ - __m == memory_order_acq_rel, \ - "memory order argument to atomic operation is invalid") - -#define _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__m, __f) \ - _LIBCPP_DIAGNOSE_WARNING(__f == memory_order_release || \ - __f == memory_order_acq_rel, \ - "memory order argument to atomic operation is invalid") - -_LIBCPP_BEGIN_NAMESPACE_STD - -// Figure out what the underlying type for `memory_order` would be if it were -// declared as an unscoped enum (accounting for -fshort-enums). Use this result -// to pin the underlying type in C++20. -enum __legacy_memory_order { - __mo_relaxed, - __mo_consume, - __mo_acquire, - __mo_release, - __mo_acq_rel, - __mo_seq_cst -}; - -typedef underlying_type<__legacy_memory_order>::type __memory_order_underlying_t; - -#if _LIBCPP_STD_VER > 17 - -enum class memory_order : __memory_order_underlying_t { - relaxed = __mo_relaxed, - consume = __mo_consume, - acquire = __mo_acquire, - release = __mo_release, - acq_rel = __mo_acq_rel, - seq_cst = __mo_seq_cst -}; - -inline constexpr auto memory_order_relaxed = memory_order::relaxed; -inline constexpr auto memory_order_consume = memory_order::consume; -inline constexpr auto memory_order_acquire = memory_order::acquire; -inline constexpr auto memory_order_release = memory_order::release; -inline constexpr auto memory_order_acq_rel = memory_order::acq_rel; -inline constexpr auto memory_order_seq_cst = memory_order::seq_cst; - -#else - -typedef enum memory_order { - memory_order_relaxed = __mo_relaxed, - memory_order_consume = __mo_consume, - memory_order_acquire = __mo_acquire, - memory_order_release = __mo_release, - memory_order_acq_rel = __mo_acq_rel, - memory_order_seq_cst = __mo_seq_cst, -} memory_order; - -#endif // _LIBCPP_STD_VER > 17 - -template <typename _Tp> _LIBCPP_INLINE_VISIBILITY -bool __cxx_nonatomic_compare_equal(_Tp const& __lhs, _Tp const& __rhs) { - return _VSTD::memcmp(&__lhs, &__rhs, sizeof(_Tp)) == 0; -} - -static_assert((is_same<underlying_type<memory_order>::type, __memory_order_underlying_t>::value), - "unexpected underlying type for std::memory_order"); - -#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) || \ - defined(_LIBCPP_ATOMIC_ONLY_USE_BUILTINS) - -// [atomics.types.generic]p1 guarantees _Tp is trivially copyable. Because -// the default operator= in an object is not volatile, a byte-by-byte copy -// is required. -template <typename _Tp, typename _Tv> _LIBCPP_INLINE_VISIBILITY -typename enable_if<is_assignable<_Tp&, _Tv>::value>::type -__cxx_atomic_assign_volatile(_Tp& __a_value, _Tv const& __val) { - __a_value = __val; -} -template <typename _Tp, typename _Tv> _LIBCPP_INLINE_VISIBILITY -typename enable_if<is_assignable<_Tp&, _Tv>::value>::type -__cxx_atomic_assign_volatile(_Tp volatile& __a_value, _Tv volatile const& __val) { - volatile char* __to = reinterpret_cast<volatile char*>(&__a_value); - volatile char* __end = __to + sizeof(_Tp); - volatile const char* __from = reinterpret_cast<volatile const char*>(&__val); - while (__to != __end) - *__to++ = *__from++; -} - -#endif - -#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) - -template <typename _Tp> -struct __cxx_atomic_base_impl { - - _LIBCPP_INLINE_VISIBILITY -#ifndef _LIBCPP_CXX03_LANG - __cxx_atomic_base_impl() _NOEXCEPT = default; -#else - __cxx_atomic_base_impl() _NOEXCEPT : __a_value() {} -#endif // _LIBCPP_CXX03_LANG - _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp value) _NOEXCEPT - : __a_value(value) {} - _Tp __a_value; -}; - -_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_CONSTEXPR int __to_gcc_order(memory_order __order) { - // Avoid switch statement to make this a constexpr. - return __order == memory_order_relaxed ? __ATOMIC_RELAXED: - (__order == memory_order_acquire ? __ATOMIC_ACQUIRE: - (__order == memory_order_release ? __ATOMIC_RELEASE: - (__order == memory_order_seq_cst ? __ATOMIC_SEQ_CST: - (__order == memory_order_acq_rel ? __ATOMIC_ACQ_REL: - __ATOMIC_CONSUME)))); -} - -_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_CONSTEXPR int __to_gcc_failure_order(memory_order __order) { - // Avoid switch statement to make this a constexpr. - return __order == memory_order_relaxed ? __ATOMIC_RELAXED: - (__order == memory_order_acquire ? __ATOMIC_ACQUIRE: - (__order == memory_order_release ? __ATOMIC_RELAXED: - (__order == memory_order_seq_cst ? __ATOMIC_SEQ_CST: - (__order == memory_order_acq_rel ? __ATOMIC_ACQUIRE: - __ATOMIC_CONSUME)))); -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -void __cxx_atomic_init(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __val) { - __cxx_atomic_assign_volatile(__a->__a_value, __val); -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp>* __a, _Tp __val) { - __a->__a_value = __val; -} - -_LIBCPP_INLINE_VISIBILITY inline -void __cxx_atomic_thread_fence(memory_order __order) { - __atomic_thread_fence(__to_gcc_order(__order)); -} - -_LIBCPP_INLINE_VISIBILITY inline -void __cxx_atomic_signal_fence(memory_order __order) { - __atomic_signal_fence(__to_gcc_order(__order)); -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -void __cxx_atomic_store(volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp __val, - memory_order __order) { - __atomic_store(&__a->__a_value, &__val, - __to_gcc_order(__order)); -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp>* __a, _Tp __val, - memory_order __order) { - __atomic_store(&__a->__a_value, &__val, - __to_gcc_order(__order)); -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_load(const volatile __cxx_atomic_base_impl<_Tp>* __a, - memory_order __order) { - _Tp __ret; - __atomic_load(&__a->__a_value, &__ret, - __to_gcc_order(__order)); - return __ret; -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_load(const __cxx_atomic_base_impl<_Tp>* __a, memory_order __order) { - _Tp __ret; - __atomic_load(&__a->__a_value, &__ret, - __to_gcc_order(__order)); - return __ret; -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_exchange(volatile __cxx_atomic_base_impl<_Tp>* __a, - _Tp __value, memory_order __order) { - _Tp __ret; - __atomic_exchange(&__a->__a_value, &__value, &__ret, - __to_gcc_order(__order)); - return __ret; -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp>* __a, _Tp __value, - memory_order __order) { - _Tp __ret; - __atomic_exchange(&__a->__a_value, &__value, &__ret, - __to_gcc_order(__order)); - return __ret; -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -bool __cxx_atomic_compare_exchange_strong( - volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, - memory_order __success, memory_order __failure) { - return __atomic_compare_exchange(&__a->__a_value, __expected, &__value, - false, - __to_gcc_order(__success), - __to_gcc_failure_order(__failure)); -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -bool __cxx_atomic_compare_exchange_strong( - __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order __success, - memory_order __failure) { - return __atomic_compare_exchange(&__a->__a_value, __expected, &__value, - false, - __to_gcc_order(__success), - __to_gcc_failure_order(__failure)); -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -bool __cxx_atomic_compare_exchange_weak( - volatile __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, - memory_order __success, memory_order __failure) { - return __atomic_compare_exchange(&__a->__a_value, __expected, &__value, - true, - __to_gcc_order(__success), - __to_gcc_failure_order(__failure)); -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -bool __cxx_atomic_compare_exchange_weak( - __cxx_atomic_base_impl<_Tp>* __a, _Tp* __expected, _Tp __value, memory_order __success, - memory_order __failure) { - return __atomic_compare_exchange(&__a->__a_value, __expected, &__value, - true, - __to_gcc_order(__success), - __to_gcc_failure_order(__failure)); -} - -template <typename _Tp> -struct __skip_amt { enum {value = 1}; }; - -template <typename _Tp> -struct __skip_amt<_Tp*> { enum {value = sizeof(_Tp)}; }; - -// FIXME: Haven't figured out what the spec says about using arrays with -// atomic_fetch_add. Force a failure rather than creating bad behavior. -template <typename _Tp> -struct __skip_amt<_Tp[]> { }; -template <typename _Tp, int n> -struct __skip_amt<_Tp[n]> { }; - -template <typename _Tp, typename _Td> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_add(volatile __cxx_atomic_base_impl<_Tp>* __a, - _Td __delta, memory_order __order) { - return __atomic_fetch_add(&__a->__a_value, __delta * __skip_amt<_Tp>::value, - __to_gcc_order(__order)); -} - -template <typename _Tp, typename _Td> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp>* __a, _Td __delta, - memory_order __order) { - return __atomic_fetch_add(&__a->__a_value, __delta * __skip_amt<_Tp>::value, - __to_gcc_order(__order)); -} - -template <typename _Tp, typename _Td> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_sub(volatile __cxx_atomic_base_impl<_Tp>* __a, - _Td __delta, memory_order __order) { - return __atomic_fetch_sub(&__a->__a_value, __delta * __skip_amt<_Tp>::value, - __to_gcc_order(__order)); -} - -template <typename _Tp, typename _Td> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp>* __a, _Td __delta, - memory_order __order) { - return __atomic_fetch_sub(&__a->__a_value, __delta * __skip_amt<_Tp>::value, - __to_gcc_order(__order)); -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_and(volatile __cxx_atomic_base_impl<_Tp>* __a, - _Tp __pattern, memory_order __order) { - return __atomic_fetch_and(&__a->__a_value, __pattern, - __to_gcc_order(__order)); -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp>* __a, - _Tp __pattern, memory_order __order) { - return __atomic_fetch_and(&__a->__a_value, __pattern, - __to_gcc_order(__order)); -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_or(volatile __cxx_atomic_base_impl<_Tp>* __a, - _Tp __pattern, memory_order __order) { - return __atomic_fetch_or(&__a->__a_value, __pattern, - __to_gcc_order(__order)); -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, - memory_order __order) { - return __atomic_fetch_or(&__a->__a_value, __pattern, - __to_gcc_order(__order)); -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_xor(volatile __cxx_atomic_base_impl<_Tp>* __a, - _Tp __pattern, memory_order __order) { - return __atomic_fetch_xor(&__a->__a_value, __pattern, - __to_gcc_order(__order)); -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp>* __a, _Tp __pattern, - memory_order __order) { - return __atomic_fetch_xor(&__a->__a_value, __pattern, - __to_gcc_order(__order)); -} - -#define __cxx_atomic_is_lock_free(__s) __atomic_is_lock_free(__s, 0) - -#elif defined(_LIBCPP_HAS_C_ATOMIC_IMP) - -template <typename _Tp> -struct __cxx_atomic_base_impl { - - _LIBCPP_INLINE_VISIBILITY -#ifndef _LIBCPP_CXX03_LANG - __cxx_atomic_base_impl() _NOEXCEPT = default; -#else - __cxx_atomic_base_impl() _NOEXCEPT : __a_value() {} -#endif // _LIBCPP_CXX03_LANG - _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp __value) _NOEXCEPT - : __a_value(__value) {} - _LIBCPP_DISABLE_EXTENSION_WARNING _Atomic(_Tp) __a_value; -}; - -#define __cxx_atomic_is_lock_free(__s) __c11_atomic_is_lock_free(__s) - -_LIBCPP_INLINE_VISIBILITY inline -void __cxx_atomic_thread_fence(memory_order __order) _NOEXCEPT { - __c11_atomic_thread_fence(static_cast<__memory_order_underlying_t>(__order)); -} - -_LIBCPP_INLINE_VISIBILITY inline -void __cxx_atomic_signal_fence(memory_order __order) _NOEXCEPT { - __c11_atomic_signal_fence(static_cast<__memory_order_underlying_t>(__order)); -} - -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __val) _NOEXCEPT { - __c11_atomic_init(&__a->__a_value, __val); -} -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -void __cxx_atomic_init(__cxx_atomic_base_impl<_Tp> * __a, _Tp __val) _NOEXCEPT { - __c11_atomic_init(&__a->__a_value, __val); -} - -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __val, memory_order __order) _NOEXCEPT { - __c11_atomic_store(&__a->__a_value, __val, static_cast<__memory_order_underlying_t>(__order)); -} -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -void __cxx_atomic_store(__cxx_atomic_base_impl<_Tp> * __a, _Tp __val, memory_order __order) _NOEXCEPT { - __c11_atomic_store(&__a->__a_value, __val, static_cast<__memory_order_underlying_t>(__order)); -} - -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const volatile* __a, memory_order __order) _NOEXCEPT { - using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*; - return __c11_atomic_load(const_cast<__ptr_type>(&__a->__a_value), static_cast<__memory_order_underlying_t>(__order)); -} -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_load(__cxx_atomic_base_impl<_Tp> const* __a, memory_order __order) _NOEXCEPT { - using __ptr_type = __remove_const_t<decltype(__a->__a_value)>*; - return __c11_atomic_load(const_cast<__ptr_type>(&__a->__a_value), static_cast<__memory_order_underlying_t>(__order)); -} - -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __value, memory_order __order) _NOEXCEPT { - return __c11_atomic_exchange(&__a->__a_value, __value, static_cast<__memory_order_underlying_t>(__order)); -} -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_exchange(__cxx_atomic_base_impl<_Tp> * __a, _Tp __value, memory_order __order) _NOEXCEPT { - return __c11_atomic_exchange(&__a->__a_value, __value, static_cast<__memory_order_underlying_t>(__order)); -} - -_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_CONSTEXPR memory_order __to_failure_order(memory_order __order) { - // Avoid switch statement to make this a constexpr. - return __order == memory_order_release ? memory_order_relaxed: - (__order == memory_order_acq_rel ? memory_order_acquire: - __order); -} - -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT { - return __c11_atomic_compare_exchange_strong(&__a->__a_value, __expected, __value, static_cast<__memory_order_underlying_t>(__success), static_cast<__memory_order_underlying_t>(__to_failure_order(__failure))); -} -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_base_impl<_Tp> * __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT { - return __c11_atomic_compare_exchange_strong(&__a->__a_value, __expected, __value, static_cast<__memory_order_underlying_t>(__success), static_cast<__memory_order_underlying_t>(__to_failure_order(__failure))); -} - -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT { - return __c11_atomic_compare_exchange_weak(&__a->__a_value, __expected, __value, static_cast<__memory_order_underlying_t>(__success), static_cast<__memory_order_underlying_t>(__to_failure_order(__failure))); -} -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_base_impl<_Tp> * __a, _Tp* __expected, _Tp __value, memory_order __success, memory_order __failure) _NOEXCEPT { - return __c11_atomic_compare_exchange_weak(&__a->__a_value, __expected, __value, static_cast<__memory_order_underlying_t>(__success), static_cast<__memory_order_underlying_t>(__to_failure_order(__failure))); -} - -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __delta, memory_order __order) _NOEXCEPT { - return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order)); -} -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp> * __a, _Tp __delta, memory_order __order) _NOEXCEPT { - return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order)); -} - -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp* __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT { - return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order)); -} -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp* __cxx_atomic_fetch_add(__cxx_atomic_base_impl<_Tp*> * __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT { - return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order)); -} - -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __delta, memory_order __order) _NOEXCEPT { - return __c11_atomic_fetch_sub(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order)); -} -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp> * __a, _Tp __delta, memory_order __order) _NOEXCEPT { - return __c11_atomic_fetch_sub(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order)); -} -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp* __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> volatile* __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT { - return __c11_atomic_fetch_sub(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order)); -} -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp* __cxx_atomic_fetch_sub(__cxx_atomic_base_impl<_Tp*> * __a, ptrdiff_t __delta, memory_order __order) _NOEXCEPT { - return __c11_atomic_fetch_sub(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order)); -} - -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT { - return __c11_atomic_fetch_and(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order)); -} -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_and(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) _NOEXCEPT { - return __c11_atomic_fetch_and(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order)); -} - -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT { - return __c11_atomic_fetch_or(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order)); -} -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_or(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) _NOEXCEPT { - return __c11_atomic_fetch_or(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order)); -} - -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp> volatile* __a, _Tp __pattern, memory_order __order) _NOEXCEPT { - return __c11_atomic_fetch_xor(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order)); -} -template<class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_xor(__cxx_atomic_base_impl<_Tp> * __a, _Tp __pattern, memory_order __order) _NOEXCEPT { - return __c11_atomic_fetch_xor(&__a->__a_value, __pattern, static_cast<__memory_order_underlying_t>(__order)); -} - -#endif // _LIBCPP_HAS_GCC_ATOMIC_IMP, _LIBCPP_HAS_C_ATOMIC_IMP - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp kill_dependency(_Tp __y) _NOEXCEPT -{ - return __y; -} - -#if defined(__CLANG_ATOMIC_BOOL_LOCK_FREE) -# define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE -# define ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE -#ifndef _LIBCPP_HAS_NO_CHAR8_T -# define ATOMIC_CHAR8_T_LOCK_FREE __CLANG_ATOMIC_CHAR8_T_LOCK_FREE -#endif -# define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE -# define ATOMIC_CHAR32_T_LOCK_FREE __CLANG_ATOMIC_CHAR32_T_LOCK_FREE -# define ATOMIC_WCHAR_T_LOCK_FREE __CLANG_ATOMIC_WCHAR_T_LOCK_FREE -# define ATOMIC_SHORT_LOCK_FREE __CLANG_ATOMIC_SHORT_LOCK_FREE -# define ATOMIC_INT_LOCK_FREE __CLANG_ATOMIC_INT_LOCK_FREE -# define ATOMIC_LONG_LOCK_FREE __CLANG_ATOMIC_LONG_LOCK_FREE -# define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE -# define ATOMIC_POINTER_LOCK_FREE __CLANG_ATOMIC_POINTER_LOCK_FREE -#elif defined(__GCC_ATOMIC_BOOL_LOCK_FREE) -# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE -# define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE -#ifndef _LIBCPP_HAS_NO_CHAR8_T -# define ATOMIC_CHAR8_T_LOCK_FREE __GCC_ATOMIC_CHAR8_T_LOCK_FREE -#endif -# define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE -# define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE -# define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE -# define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE -# define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE -# define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE -# define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE -# define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE -#endif - -template <class _Tp> -struct __libcpp_is_always_lock_free { - // __atomic_always_lock_free is available in all Standard modes - static const bool __value = __atomic_always_lock_free(sizeof(_Tp), 0); -}; - -#ifdef _LIBCPP_ATOMIC_ONLY_USE_BUILTINS - -template<typename _Tp> -struct __cxx_atomic_lock_impl { - - _LIBCPP_INLINE_VISIBILITY - __cxx_atomic_lock_impl() _NOEXCEPT - : __a_value(), __a_lock(0) {} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR explicit - __cxx_atomic_lock_impl(_Tp value) _NOEXCEPT - : __a_value(value), __a_lock(0) {} - - _Tp __a_value; - mutable __cxx_atomic_base_impl<_LIBCPP_ATOMIC_FLAG_TYPE> __a_lock; - - _LIBCPP_INLINE_VISIBILITY void __lock() const volatile { - while(1 == __cxx_atomic_exchange(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(true), memory_order_acquire)) - /*spin*/; - } - _LIBCPP_INLINE_VISIBILITY void __lock() const { - while(1 == __cxx_atomic_exchange(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(true), memory_order_acquire)) - /*spin*/; - } - _LIBCPP_INLINE_VISIBILITY void __unlock() const volatile { - __cxx_atomic_store(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(false), memory_order_release); - } - _LIBCPP_INLINE_VISIBILITY void __unlock() const { - __cxx_atomic_store(&__a_lock, _LIBCPP_ATOMIC_FLAG_TYPE(false), memory_order_release); - } - _LIBCPP_INLINE_VISIBILITY _Tp __read() const volatile { - __lock(); - _Tp __old; - __cxx_atomic_assign_volatile(__old, __a_value); - __unlock(); - return __old; - } - _LIBCPP_INLINE_VISIBILITY _Tp __read() const { - __lock(); - _Tp __old = __a_value; - __unlock(); - return __old; - } -}; - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -void __cxx_atomic_init(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __val) { - __cxx_atomic_assign_volatile(__a->__a_value, __val); -} -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -void __cxx_atomic_init(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __val) { - __a->__a_value = __val; -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -void __cxx_atomic_store(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __val, memory_order) { - __a->__lock(); - __cxx_atomic_assign_volatile(__a->__a_value, __val); - __a->__unlock(); -} -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -void __cxx_atomic_store(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __val, memory_order) { - __a->__lock(); - __a->__a_value = __val; - __a->__unlock(); -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_load(const volatile __cxx_atomic_lock_impl<_Tp>* __a, memory_order) { - return __a->__read(); -} -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_load(const __cxx_atomic_lock_impl<_Tp>* __a, memory_order) { - return __a->__read(); -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_exchange(volatile __cxx_atomic_lock_impl<_Tp>* __a, _Tp __value, memory_order) { - __a->__lock(); - _Tp __old; - __cxx_atomic_assign_volatile(__old, __a->__a_value); - __cxx_atomic_assign_volatile(__a->__a_value, __value); - __a->__unlock(); - return __old; -} -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_exchange(__cxx_atomic_lock_impl<_Tp>* __a, _Tp __value, memory_order) { - __a->__lock(); - _Tp __old = __a->__a_value; - __a->__a_value = __value; - __a->__unlock(); - return __old; -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -bool __cxx_atomic_compare_exchange_strong(volatile __cxx_atomic_lock_impl<_Tp>* __a, - _Tp* __expected, _Tp __value, memory_order, memory_order) { - _Tp __temp; - __a->__lock(); - __cxx_atomic_assign_volatile(__temp, __a->__a_value); - bool __ret = (_VSTD::memcmp(&__temp, __expected, sizeof(_Tp)) == 0); - if(__ret) - __cxx_atomic_assign_volatile(__a->__a_value, __value); - else - __cxx_atomic_assign_volatile(*__expected, __a->__a_value); - __a->__unlock(); - return __ret; -} -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_lock_impl<_Tp>* __a, - _Tp* __expected, _Tp __value, memory_order, memory_order) { - __a->__lock(); - bool __ret = (_VSTD::memcmp(&__a->__a_value, __expected, sizeof(_Tp)) == 0); - if(__ret) - _VSTD::memcpy(&__a->__a_value, &__value, sizeof(_Tp)); - else - _VSTD::memcpy(__expected, &__a->__a_value, sizeof(_Tp)); - __a->__unlock(); - return __ret; -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -bool __cxx_atomic_compare_exchange_weak(volatile __cxx_atomic_lock_impl<_Tp>* __a, - _Tp* __expected, _Tp __value, memory_order, memory_order) { - _Tp __temp; - __a->__lock(); - __cxx_atomic_assign_volatile(__temp, __a->__a_value); - bool __ret = (_VSTD::memcmp(&__temp, __expected, sizeof(_Tp)) == 0); - if(__ret) - __cxx_atomic_assign_volatile(__a->__a_value, __value); - else - __cxx_atomic_assign_volatile(*__expected, __a->__a_value); - __a->__unlock(); - return __ret; -} -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_lock_impl<_Tp>* __a, - _Tp* __expected, _Tp __value, memory_order, memory_order) { - __a->__lock(); - bool __ret = (_VSTD::memcmp(&__a->__a_value, __expected, sizeof(_Tp)) == 0); - if(__ret) - _VSTD::memcpy(&__a->__a_value, &__value, sizeof(_Tp)); - else - _VSTD::memcpy(__expected, &__a->__a_value, sizeof(_Tp)); - __a->__unlock(); - return __ret; -} - -template <typename _Tp, typename _Td> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp>* __a, - _Td __delta, memory_order) { - __a->__lock(); - _Tp __old; - __cxx_atomic_assign_volatile(__old, __a->__a_value); - __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old + __delta)); - __a->__unlock(); - return __old; -} -template <typename _Tp, typename _Td> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp>* __a, - _Td __delta, memory_order) { - __a->__lock(); - _Tp __old = __a->__a_value; - __a->__a_value += __delta; - __a->__unlock(); - return __old; -} - -template <typename _Tp, typename _Td> -_LIBCPP_INLINE_VISIBILITY -_Tp* __cxx_atomic_fetch_add(volatile __cxx_atomic_lock_impl<_Tp*>* __a, - ptrdiff_t __delta, memory_order) { - __a->__lock(); - _Tp* __old; - __cxx_atomic_assign_volatile(__old, __a->__a_value); - __cxx_atomic_assign_volatile(__a->__a_value, __old + __delta); - __a->__unlock(); - return __old; -} -template <typename _Tp, typename _Td> -_LIBCPP_INLINE_VISIBILITY -_Tp* __cxx_atomic_fetch_add(__cxx_atomic_lock_impl<_Tp*>* __a, - ptrdiff_t __delta, memory_order) { - __a->__lock(); - _Tp* __old = __a->__a_value; - __a->__a_value += __delta; - __a->__unlock(); - return __old; -} - -template <typename _Tp, typename _Td> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_sub(volatile __cxx_atomic_lock_impl<_Tp>* __a, - _Td __delta, memory_order) { - __a->__lock(); - _Tp __old; - __cxx_atomic_assign_volatile(__old, __a->__a_value); - __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old - __delta)); - __a->__unlock(); - return __old; -} -template <typename _Tp, typename _Td> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_sub(__cxx_atomic_lock_impl<_Tp>* __a, - _Td __delta, memory_order) { - __a->__lock(); - _Tp __old = __a->__a_value; - __a->__a_value -= __delta; - __a->__unlock(); - return __old; -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_and(volatile __cxx_atomic_lock_impl<_Tp>* __a, - _Tp __pattern, memory_order) { - __a->__lock(); - _Tp __old; - __cxx_atomic_assign_volatile(__old, __a->__a_value); - __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old & __pattern)); - __a->__unlock(); - return __old; -} -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_and(__cxx_atomic_lock_impl<_Tp>* __a, - _Tp __pattern, memory_order) { - __a->__lock(); - _Tp __old = __a->__a_value; - __a->__a_value &= __pattern; - __a->__unlock(); - return __old; -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_or(volatile __cxx_atomic_lock_impl<_Tp>* __a, - _Tp __pattern, memory_order) { - __a->__lock(); - _Tp __old; - __cxx_atomic_assign_volatile(__old, __a->__a_value); - __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old | __pattern)); - __a->__unlock(); - return __old; -} -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_or(__cxx_atomic_lock_impl<_Tp>* __a, - _Tp __pattern, memory_order) { - __a->__lock(); - _Tp __old = __a->__a_value; - __a->__a_value |= __pattern; - __a->__unlock(); - return __old; -} - -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_xor(volatile __cxx_atomic_lock_impl<_Tp>* __a, - _Tp __pattern, memory_order) { - __a->__lock(); - _Tp __old; - __cxx_atomic_assign_volatile(__old, __a->__a_value); - __cxx_atomic_assign_volatile(__a->__a_value, _Tp(__old ^ __pattern)); - __a->__unlock(); - return __old; -} -template <typename _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp __cxx_atomic_fetch_xor(__cxx_atomic_lock_impl<_Tp>* __a, - _Tp __pattern, memory_order) { - __a->__lock(); - _Tp __old = __a->__a_value; - __a->__a_value ^= __pattern; - __a->__unlock(); - return __old; -} - -template <typename _Tp, - typename _Base = typename conditional<__libcpp_is_always_lock_free<_Tp>::__value, - __cxx_atomic_base_impl<_Tp>, - __cxx_atomic_lock_impl<_Tp> >::type> -#else -template <typename _Tp, - typename _Base = __cxx_atomic_base_impl<_Tp> > -#endif //_LIBCPP_ATOMIC_ONLY_USE_BUILTINS -struct __cxx_atomic_impl : public _Base { - static_assert(is_trivially_copyable<_Tp>::value, - "std::atomic<T> requires that 'T' be a trivially copyable type"); - - _LIBCPP_INLINE_VISIBILITY __cxx_atomic_impl() _NOEXCEPT = default; - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR explicit __cxx_atomic_impl(_Tp __value) _NOEXCEPT - : _Base(__value) {} -}; - -#if defined(__linux__) || (defined(_AIX) && !defined(__64BIT__)) - using __cxx_contention_t = int32_t; -#else - using __cxx_contention_t = int64_t; -#endif // __linux__ || (_AIX && !__64BIT__) - -using __cxx_atomic_contention_t = __cxx_atomic_impl<__cxx_contention_t>; - -#ifndef _LIBCPP_HAS_NO_THREADS - -_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(void const volatile*); -_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(void const volatile*); -_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_atomic_monitor(void const volatile*); -_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __libcpp_atomic_wait(void const volatile*, __cxx_contention_t); - -_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_one(__cxx_atomic_contention_t const volatile*); -_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __cxx_atomic_notify_all(__cxx_atomic_contention_t const volatile*); -_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI __cxx_contention_t __libcpp_atomic_monitor(__cxx_atomic_contention_t const volatile*); -_LIBCPP_AVAILABILITY_SYNC _LIBCPP_EXPORTED_FROM_ABI void __libcpp_atomic_wait(__cxx_atomic_contention_t const volatile*, __cxx_contention_t); - -template <class _Atp, class _Fn> -struct __libcpp_atomic_wait_backoff_impl { - _Atp* __a; - _Fn __test_fn; - _LIBCPP_AVAILABILITY_SYNC - _LIBCPP_INLINE_VISIBILITY bool operator()(chrono::nanoseconds __elapsed) const - { - if(__elapsed > chrono::microseconds(64)) - { - auto const __monitor = std::__libcpp_atomic_monitor(__a); - if(__test_fn()) - return true; - std::__libcpp_atomic_wait(__a, __monitor); - } - else if(__elapsed > chrono::microseconds(4)) - __libcpp_thread_yield(); - else - {} // poll - return false; - } -}; - -template <class _Atp, class _Fn> -_LIBCPP_AVAILABILITY_SYNC -_LIBCPP_INLINE_VISIBILITY bool __cxx_atomic_wait(_Atp* __a, _Fn && __test_fn) -{ - __libcpp_atomic_wait_backoff_impl<_Atp, typename decay<_Fn>::type> __backoff_fn = {__a, __test_fn}; - return std::__libcpp_thread_poll_with_backoff(__test_fn, __backoff_fn); -} - -#else // _LIBCPP_HAS_NO_THREADS - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY void __cxx_atomic_notify_all(__cxx_atomic_impl<_Tp> const volatile*) { } -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY void __cxx_atomic_notify_one(__cxx_atomic_impl<_Tp> const volatile*) { } -template <class _Atp, class _Fn> -_LIBCPP_INLINE_VISIBILITY bool __cxx_atomic_wait(_Atp*, _Fn && __test_fn) -{ - return __libcpp_thread_poll_with_backoff(__test_fn, __spinning_backoff_policy()); -} - -#endif // _LIBCPP_HAS_NO_THREADS - -template <class _Atp, class _Tp> -struct __cxx_atomic_wait_test_fn_impl { - _Atp* __a; - _Tp __val; - memory_order __order; - _LIBCPP_INLINE_VISIBILITY bool operator()() const - { - return !std::__cxx_nonatomic_compare_equal(std::__cxx_atomic_load(__a, __order), __val); - } -}; - -template <class _Atp, class _Tp> -_LIBCPP_AVAILABILITY_SYNC -_LIBCPP_INLINE_VISIBILITY bool __cxx_atomic_wait(_Atp* __a, _Tp const __val, memory_order __order) -{ - __cxx_atomic_wait_test_fn_impl<_Atp, _Tp> __test_fn = {__a, __val, __order}; - return std::__cxx_atomic_wait(__a, __test_fn); -} - -// general atomic<T> - -template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::value> -struct __atomic_base // false -{ - mutable __cxx_atomic_impl<_Tp> __a_; - -#if defined(__cpp_lib_atomic_is_always_lock_free) - static _LIBCPP_CONSTEXPR bool is_always_lock_free = __libcpp_is_always_lock_free<__cxx_atomic_impl<_Tp> >::__value; -#endif - - _LIBCPP_INLINE_VISIBILITY - bool is_lock_free() const volatile _NOEXCEPT - {return __cxx_atomic_is_lock_free(sizeof(_Tp));} - _LIBCPP_INLINE_VISIBILITY - bool is_lock_free() const _NOEXCEPT - {return static_cast<__atomic_base const volatile*>(this)->is_lock_free();} - _LIBCPP_INLINE_VISIBILITY - void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT - _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) - {std::__cxx_atomic_store(&__a_, __d, __m);} - _LIBCPP_INLINE_VISIBILITY - void store(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT - _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) - {std::__cxx_atomic_store(&__a_, __d, __m);} - _LIBCPP_INLINE_VISIBILITY - _Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT - _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) - {return std::__cxx_atomic_load(&__a_, __m);} - _LIBCPP_INLINE_VISIBILITY - _Tp load(memory_order __m = memory_order_seq_cst) const _NOEXCEPT - _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) - {return std::__cxx_atomic_load(&__a_, __m);} - _LIBCPP_INLINE_VISIBILITY - operator _Tp() const volatile _NOEXCEPT {return load();} - _LIBCPP_INLINE_VISIBILITY - operator _Tp() const _NOEXCEPT {return load();} - _LIBCPP_INLINE_VISIBILITY - _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT - {return std::__cxx_atomic_exchange(&__a_, __d, __m);} - _LIBCPP_INLINE_VISIBILITY - _Tp exchange(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT - {return std::__cxx_atomic_exchange(&__a_, __d, __m);} - _LIBCPP_INLINE_VISIBILITY - bool compare_exchange_weak(_Tp& __e, _Tp __d, - memory_order __s, memory_order __f) volatile _NOEXCEPT - _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) - {return std::__cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);} - _LIBCPP_INLINE_VISIBILITY - bool compare_exchange_weak(_Tp& __e, _Tp __d, - memory_order __s, memory_order __f) _NOEXCEPT - _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) - {return std::__cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);} - _LIBCPP_INLINE_VISIBILITY - bool compare_exchange_strong(_Tp& __e, _Tp __d, - memory_order __s, memory_order __f) volatile _NOEXCEPT - _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) - {return std::__cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);} - _LIBCPP_INLINE_VISIBILITY - bool compare_exchange_strong(_Tp& __e, _Tp __d, - memory_order __s, memory_order __f) _NOEXCEPT - _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) - {return std::__cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);} - _LIBCPP_INLINE_VISIBILITY - bool compare_exchange_weak(_Tp& __e, _Tp __d, - memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT - {return std::__cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);} - _LIBCPP_INLINE_VISIBILITY - bool compare_exchange_weak(_Tp& __e, _Tp __d, - memory_order __m = memory_order_seq_cst) _NOEXCEPT - {return std::__cxx_atomic_compare_exchange_weak(&__a_, &__e, __d, __m, __m);} - _LIBCPP_INLINE_VISIBILITY - bool compare_exchange_strong(_Tp& __e, _Tp __d, - memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT - {return std::__cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);} - _LIBCPP_INLINE_VISIBILITY - bool compare_exchange_strong(_Tp& __e, _Tp __d, - memory_order __m = memory_order_seq_cst) _NOEXCEPT - {return std::__cxx_atomic_compare_exchange_strong(&__a_, &__e, __d, __m, __m);} - - _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void wait(_Tp __v, memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT - {std::__cxx_atomic_wait(&__a_, __v, __m);} - _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void wait(_Tp __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT - {std::__cxx_atomic_wait(&__a_, __v, __m);} - _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void notify_one() volatile _NOEXCEPT - {std::__cxx_atomic_notify_one(&__a_);} - _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void notify_one() _NOEXCEPT - {std::__cxx_atomic_notify_one(&__a_);} - _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void notify_all() volatile _NOEXCEPT - {std::__cxx_atomic_notify_all(&__a_);} - _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY void notify_all() _NOEXCEPT - {std::__cxx_atomic_notify_all(&__a_);} - -#if _LIBCPP_STD_VER > 17 - _LIBCPP_INLINE_VISIBILITY constexpr - __atomic_base() noexcept(is_nothrow_default_constructible_v<_Tp>) : __a_(_Tp()) {} -#else - _LIBCPP_INLINE_VISIBILITY - __atomic_base() _NOEXCEPT = default; -#endif - - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR - __atomic_base(_Tp __d) _NOEXCEPT : __a_(__d) {} - - __atomic_base(const __atomic_base&) = delete; -}; - -#if defined(__cpp_lib_atomic_is_always_lock_free) -template <class _Tp, bool __b> -_LIBCPP_CONSTEXPR bool __atomic_base<_Tp, __b>::is_always_lock_free; -#endif - -// atomic<Integral> - -template <class _Tp> -struct __atomic_base<_Tp, true> - : public __atomic_base<_Tp, false> -{ - typedef __atomic_base<_Tp, false> __base; - - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 - __atomic_base() _NOEXCEPT = default; - - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR __atomic_base(_Tp __d) _NOEXCEPT : __base(__d) {} - - _LIBCPP_INLINE_VISIBILITY - _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT - {return std::__cxx_atomic_fetch_add(&this->__a_, __op, __m);} - _LIBCPP_INLINE_VISIBILITY - _Tp fetch_add(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT - {return std::__cxx_atomic_fetch_add(&this->__a_, __op, __m);} - _LIBCPP_INLINE_VISIBILITY - _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT - {return std::__cxx_atomic_fetch_sub(&this->__a_, __op, __m);} - _LIBCPP_INLINE_VISIBILITY - _Tp fetch_sub(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT - {return std::__cxx_atomic_fetch_sub(&this->__a_, __op, __m);} - _LIBCPP_INLINE_VISIBILITY - _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT - {return std::__cxx_atomic_fetch_and(&this->__a_, __op, __m);} - _LIBCPP_INLINE_VISIBILITY - _Tp fetch_and(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT - {return std::__cxx_atomic_fetch_and(&this->__a_, __op, __m);} - _LIBCPP_INLINE_VISIBILITY - _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT - {return std::__cxx_atomic_fetch_or(&this->__a_, __op, __m);} - _LIBCPP_INLINE_VISIBILITY - _Tp fetch_or(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT - {return std::__cxx_atomic_fetch_or(&this->__a_, __op, __m);} - _LIBCPP_INLINE_VISIBILITY - _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT - {return std::__cxx_atomic_fetch_xor(&this->__a_, __op, __m);} - _LIBCPP_INLINE_VISIBILITY - _Tp fetch_xor(_Tp __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT - {return std::__cxx_atomic_fetch_xor(&this->__a_, __op, __m);} - - _LIBCPP_INLINE_VISIBILITY - _Tp operator++(int) volatile _NOEXCEPT {return fetch_add(_Tp(1));} - _LIBCPP_INLINE_VISIBILITY - _Tp operator++(int) _NOEXCEPT {return fetch_add(_Tp(1));} - _LIBCPP_INLINE_VISIBILITY - _Tp operator--(int) volatile _NOEXCEPT {return fetch_sub(_Tp(1));} - _LIBCPP_INLINE_VISIBILITY - _Tp operator--(int) _NOEXCEPT {return fetch_sub(_Tp(1));} - _LIBCPP_INLINE_VISIBILITY - _Tp operator++() volatile _NOEXCEPT {return fetch_add(_Tp(1)) + _Tp(1);} - _LIBCPP_INLINE_VISIBILITY - _Tp operator++() _NOEXCEPT {return fetch_add(_Tp(1)) + _Tp(1);} - _LIBCPP_INLINE_VISIBILITY - _Tp operator--() volatile _NOEXCEPT {return fetch_sub(_Tp(1)) - _Tp(1);} - _LIBCPP_INLINE_VISIBILITY - _Tp operator--() _NOEXCEPT {return fetch_sub(_Tp(1)) - _Tp(1);} - _LIBCPP_INLINE_VISIBILITY - _Tp operator+=(_Tp __op) volatile _NOEXCEPT {return fetch_add(__op) + __op;} - _LIBCPP_INLINE_VISIBILITY - _Tp operator+=(_Tp __op) _NOEXCEPT {return fetch_add(__op) + __op;} - _LIBCPP_INLINE_VISIBILITY - _Tp operator-=(_Tp __op) volatile _NOEXCEPT {return fetch_sub(__op) - __op;} - _LIBCPP_INLINE_VISIBILITY - _Tp operator-=(_Tp __op) _NOEXCEPT {return fetch_sub(__op) - __op;} - _LIBCPP_INLINE_VISIBILITY - _Tp operator&=(_Tp __op) volatile _NOEXCEPT {return fetch_and(__op) & __op;} - _LIBCPP_INLINE_VISIBILITY - _Tp operator&=(_Tp __op) _NOEXCEPT {return fetch_and(__op) & __op;} - _LIBCPP_INLINE_VISIBILITY - _Tp operator|=(_Tp __op) volatile _NOEXCEPT {return fetch_or(__op) | __op;} - _LIBCPP_INLINE_VISIBILITY - _Tp operator|=(_Tp __op) _NOEXCEPT {return fetch_or(__op) | __op;} - _LIBCPP_INLINE_VISIBILITY - _Tp operator^=(_Tp __op) volatile _NOEXCEPT {return fetch_xor(__op) ^ __op;} - _LIBCPP_INLINE_VISIBILITY - _Tp operator^=(_Tp __op) _NOEXCEPT {return fetch_xor(__op) ^ __op;} -}; - -// atomic<T> - -template <class _Tp> -struct atomic - : public __atomic_base<_Tp> -{ - typedef __atomic_base<_Tp> __base; - typedef _Tp value_type; - typedef value_type difference_type; - -#if _LIBCPP_STD_VER > 17 - _LIBCPP_INLINE_VISIBILITY - atomic() = default; -#else - _LIBCPP_INLINE_VISIBILITY - atomic() _NOEXCEPT = default; -#endif - - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR atomic(_Tp __d) _NOEXCEPT : __base(__d) {} - - _LIBCPP_INLINE_VISIBILITY - _Tp operator=(_Tp __d) volatile _NOEXCEPT - {__base::store(__d); return __d;} - _LIBCPP_INLINE_VISIBILITY - _Tp operator=(_Tp __d) _NOEXCEPT - {__base::store(__d); return __d;} - - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; -}; - -// atomic<T*> - -template <class _Tp> -struct atomic<_Tp*> - : public __atomic_base<_Tp*> -{ - typedef __atomic_base<_Tp*> __base; - typedef _Tp* value_type; - typedef ptrdiff_t difference_type; - - _LIBCPP_INLINE_VISIBILITY - atomic() _NOEXCEPT = default; - - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR atomic(_Tp* __d) _NOEXCEPT : __base(__d) {} - - _LIBCPP_INLINE_VISIBILITY - _Tp* operator=(_Tp* __d) volatile _NOEXCEPT - {__base::store(__d); return __d;} - _LIBCPP_INLINE_VISIBILITY - _Tp* operator=(_Tp* __d) _NOEXCEPT - {__base::store(__d); return __d;} - - _LIBCPP_INLINE_VISIBILITY - _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT { - // __atomic_fetch_add accepts function pointers, guard against them. - static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed"); - return std::__cxx_atomic_fetch_add(&this->__a_, __op, __m); - } - - _LIBCPP_INLINE_VISIBILITY - _Tp* fetch_add(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT { - // __atomic_fetch_add accepts function pointers, guard against them. - static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed"); - return std::__cxx_atomic_fetch_add(&this->__a_, __op, __m); - } - - _LIBCPP_INLINE_VISIBILITY - _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT { - // __atomic_fetch_add accepts function pointers, guard against them. - static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed"); - return std::__cxx_atomic_fetch_sub(&this->__a_, __op, __m); - } - - _LIBCPP_INLINE_VISIBILITY - _Tp* fetch_sub(ptrdiff_t __op, memory_order __m = memory_order_seq_cst) _NOEXCEPT { - // __atomic_fetch_add accepts function pointers, guard against them. - static_assert(!is_function<__remove_pointer_t<_Tp> >::value, "Pointer to function isn't allowed"); - return std::__cxx_atomic_fetch_sub(&this->__a_, __op, __m); - } - - _LIBCPP_INLINE_VISIBILITY - _Tp* operator++(int) volatile _NOEXCEPT {return fetch_add(1);} - _LIBCPP_INLINE_VISIBILITY - _Tp* operator++(int) _NOEXCEPT {return fetch_add(1);} - _LIBCPP_INLINE_VISIBILITY - _Tp* operator--(int) volatile _NOEXCEPT {return fetch_sub(1);} - _LIBCPP_INLINE_VISIBILITY - _Tp* operator--(int) _NOEXCEPT {return fetch_sub(1);} - _LIBCPP_INLINE_VISIBILITY - _Tp* operator++() volatile _NOEXCEPT {return fetch_add(1) + 1;} - _LIBCPP_INLINE_VISIBILITY - _Tp* operator++() _NOEXCEPT {return fetch_add(1) + 1;} - _LIBCPP_INLINE_VISIBILITY - _Tp* operator--() volatile _NOEXCEPT {return fetch_sub(1) - 1;} - _LIBCPP_INLINE_VISIBILITY - _Tp* operator--() _NOEXCEPT {return fetch_sub(1) - 1;} - _LIBCPP_INLINE_VISIBILITY - _Tp* operator+=(ptrdiff_t __op) volatile _NOEXCEPT {return fetch_add(__op) + __op;} - _LIBCPP_INLINE_VISIBILITY - _Tp* operator+=(ptrdiff_t __op) _NOEXCEPT {return fetch_add(__op) + __op;} - _LIBCPP_INLINE_VISIBILITY - _Tp* operator-=(ptrdiff_t __op) volatile _NOEXCEPT {return fetch_sub(__op) - __op;} - _LIBCPP_INLINE_VISIBILITY - _Tp* operator-=(ptrdiff_t __op) _NOEXCEPT {return fetch_sub(__op) - __op;} - - atomic& operator=(const atomic&) = delete; - atomic& operator=(const atomic&) volatile = delete; -}; - -// atomic_is_lock_free - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -bool -atomic_is_lock_free(const volatile atomic<_Tp>* __o) _NOEXCEPT -{ - return __o->is_lock_free(); -} - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -bool -atomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT -{ - return __o->is_lock_free(); -} - -// atomic_init - -template <class _Tp> -_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_INLINE_VISIBILITY -void -atomic_init(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT -{ - std::__cxx_atomic_init(&__o->__a_, __d); -} - -template <class _Tp> -_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_INLINE_VISIBILITY -void -atomic_init(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT -{ - std::__cxx_atomic_init(&__o->__a_, __d); -} - -// atomic_store - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -void -atomic_store(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT -{ - __o->store(__d); -} - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -void -atomic_store(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT -{ - __o->store(__d); -} - -// atomic_store_explicit - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -void -atomic_store_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT - _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) -{ - __o->store(__d, __m); -} - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -void -atomic_store_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT - _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) -{ - __o->store(__d, __m); -} - -// atomic_load - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp -atomic_load(const volatile atomic<_Tp>* __o) _NOEXCEPT -{ - return __o->load(); -} - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp -atomic_load(const atomic<_Tp>* __o) _NOEXCEPT -{ - return __o->load(); -} - -// atomic_load_explicit - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp -atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) _NOEXCEPT - _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) -{ - return __o->load(__m); -} - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp -atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT - _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) -{ - return __o->load(__m); -} - -// atomic_exchange - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp -atomic_exchange(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT -{ - return __o->exchange(__d); -} - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp -atomic_exchange(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT -{ - return __o->exchange(__d); -} - -// atomic_exchange_explicit - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp -atomic_exchange_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT -{ - return __o->exchange(__d, __m); -} - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp -atomic_exchange_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT -{ - return __o->exchange(__d, __m); -} - -// atomic_compare_exchange_weak - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -bool -atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT -{ - return __o->compare_exchange_weak(*__e, __d); -} - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -bool -atomic_compare_exchange_weak(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT -{ - return __o->compare_exchange_weak(*__e, __d); -} - -// atomic_compare_exchange_strong - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -bool -atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT -{ - return __o->compare_exchange_strong(*__e, __d); -} - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -bool -atomic_compare_exchange_strong(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT -{ - return __o->compare_exchange_strong(*__e, __d); -} - -// atomic_compare_exchange_weak_explicit - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -bool -atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, - typename atomic<_Tp>::value_type __d, - memory_order __s, memory_order __f) _NOEXCEPT - _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) -{ - return __o->compare_exchange_weak(*__e, __d, __s, __f); -} - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -bool -atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d, - memory_order __s, memory_order __f) _NOEXCEPT - _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) -{ - return __o->compare_exchange_weak(*__e, __d, __s, __f); -} - -// atomic_compare_exchange_strong_explicit - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -bool -atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o, - typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d, - memory_order __s, memory_order __f) _NOEXCEPT - _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) -{ - return __o->compare_exchange_strong(*__e, __d, __s, __f); -} - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -bool -atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, - typename atomic<_Tp>::value_type __d, - memory_order __s, memory_order __f) _NOEXCEPT - _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f) -{ - return __o->compare_exchange_strong(*__e, __d, __s, __f); -} - -// atomic_wait - -template <class _Tp> -_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY -void atomic_wait(const volatile atomic<_Tp>* __o, - typename atomic<_Tp>::value_type __v) _NOEXCEPT -{ - return __o->wait(__v); -} - -template <class _Tp> -_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY -void atomic_wait(const atomic<_Tp>* __o, - typename atomic<_Tp>::value_type __v) _NOEXCEPT -{ - return __o->wait(__v); -} - -// atomic_wait_explicit - -template <class _Tp> -_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY -void atomic_wait_explicit(const volatile atomic<_Tp>* __o, - typename atomic<_Tp>::value_type __v, - memory_order __m) _NOEXCEPT - _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) -{ - return __o->wait(__v, __m); -} - -template <class _Tp> -_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY -void atomic_wait_explicit(const atomic<_Tp>* __o, - typename atomic<_Tp>::value_type __v, - memory_order __m) _NOEXCEPT - _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) -{ - return __o->wait(__v, __m); -} - -// atomic_notify_one - -template <class _Tp> -_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY -void atomic_notify_one(volatile atomic<_Tp>* __o) _NOEXCEPT -{ - __o->notify_one(); -} -template <class _Tp> -_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY -void atomic_notify_one(atomic<_Tp>* __o) _NOEXCEPT -{ - __o->notify_one(); -} - -// atomic_notify_all - -template <class _Tp> -_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY -void atomic_notify_all(volatile atomic<_Tp>* __o) _NOEXCEPT -{ - __o->notify_all(); -} -template <class _Tp> -_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY -void atomic_notify_all(atomic<_Tp>* __o) _NOEXCEPT -{ - __o->notify_all(); -} - -// atomic_fetch_add - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp -atomic_fetch_add(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT -{ - return __o->fetch_add(__op); -} - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp -atomic_fetch_add(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT -{ - return __o->fetch_add(__op); -} - -// atomic_fetch_add_explicit - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp atomic_fetch_add_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT -{ - return __o->fetch_add(__op, __m); -} - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp atomic_fetch_add_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT -{ - return __o->fetch_add(__op, __m); -} - -// atomic_fetch_sub - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp atomic_fetch_sub(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT -{ - return __o->fetch_sub(__op); -} - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp atomic_fetch_sub(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT -{ - return __o->fetch_sub(__op); -} - -// atomic_fetch_sub_explicit - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp atomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT -{ - return __o->fetch_sub(__op, __m); -} - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -_Tp atomic_fetch_sub_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT -{ - return __o->fetch_sub(__op, __m); -} - -// atomic_fetch_and - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -typename enable_if -< - is_integral<_Tp>::value && !is_same<_Tp, bool>::value, - _Tp ->::type -atomic_fetch_and(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT -{ - return __o->fetch_and(__op); -} - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -typename enable_if -< - is_integral<_Tp>::value && !is_same<_Tp, bool>::value, - _Tp ->::type -atomic_fetch_and(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT -{ - return __o->fetch_and(__op); -} - -// atomic_fetch_and_explicit - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -typename enable_if -< - is_integral<_Tp>::value && !is_same<_Tp, bool>::value, - _Tp ->::type -atomic_fetch_and_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT -{ - return __o->fetch_and(__op, __m); -} - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -typename enable_if -< - is_integral<_Tp>::value && !is_same<_Tp, bool>::value, - _Tp ->::type -atomic_fetch_and_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT -{ - return __o->fetch_and(__op, __m); -} - -// atomic_fetch_or - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -typename enable_if -< - is_integral<_Tp>::value && !is_same<_Tp, bool>::value, - _Tp ->::type -atomic_fetch_or(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT -{ - return __o->fetch_or(__op); -} - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -typename enable_if -< - is_integral<_Tp>::value && !is_same<_Tp, bool>::value, - _Tp ->::type -atomic_fetch_or(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT -{ - return __o->fetch_or(__op); -} - -// atomic_fetch_or_explicit - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -typename enable_if -< - is_integral<_Tp>::value && !is_same<_Tp, bool>::value, - _Tp ->::type -atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT -{ - return __o->fetch_or(__op, __m); -} - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -typename enable_if -< - is_integral<_Tp>::value && !is_same<_Tp, bool>::value, - _Tp ->::type -atomic_fetch_or_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT -{ - return __o->fetch_or(__op, __m); -} - -// atomic_fetch_xor - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -typename enable_if -< - is_integral<_Tp>::value && !is_same<_Tp, bool>::value, - _Tp ->::type -atomic_fetch_xor(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT -{ - return __o->fetch_xor(__op); -} - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -typename enable_if -< - is_integral<_Tp>::value && !is_same<_Tp, bool>::value, - _Tp ->::type -atomic_fetch_xor(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT -{ - return __o->fetch_xor(__op); -} - -// atomic_fetch_xor_explicit - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -typename enable_if -< - is_integral<_Tp>::value && !is_same<_Tp, bool>::value, - _Tp ->::type -atomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT -{ - return __o->fetch_xor(__op, __m); -} - -template <class _Tp> -_LIBCPP_INLINE_VISIBILITY -typename enable_if -< - is_integral<_Tp>::value && !is_same<_Tp, bool>::value, - _Tp ->::type -atomic_fetch_xor_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT -{ - return __o->fetch_xor(__op, __m); -} - -// flag type and operations - -typedef struct atomic_flag -{ - __cxx_atomic_impl<_LIBCPP_ATOMIC_FLAG_TYPE> __a_; - - _LIBCPP_INLINE_VISIBILITY - bool test(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT - {return _LIBCPP_ATOMIC_FLAG_TYPE(true) == __cxx_atomic_load(&__a_, __m);} - _LIBCPP_INLINE_VISIBILITY - bool test(memory_order __m = memory_order_seq_cst) const _NOEXCEPT - {return _LIBCPP_ATOMIC_FLAG_TYPE(true) == __cxx_atomic_load(&__a_, __m);} - - _LIBCPP_INLINE_VISIBILITY - bool test_and_set(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT - {return __cxx_atomic_exchange(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(true), __m);} - _LIBCPP_INLINE_VISIBILITY - bool test_and_set(memory_order __m = memory_order_seq_cst) _NOEXCEPT - {return __cxx_atomic_exchange(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(true), __m);} - _LIBCPP_INLINE_VISIBILITY - void clear(memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT - {__cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m);} - _LIBCPP_INLINE_VISIBILITY - void clear(memory_order __m = memory_order_seq_cst) _NOEXCEPT - {__cxx_atomic_store(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(false), __m);} - - _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY - void wait(bool __v, memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT - {__cxx_atomic_wait(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m);} - _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY - void wait(bool __v, memory_order __m = memory_order_seq_cst) const _NOEXCEPT - {__cxx_atomic_wait(&__a_, _LIBCPP_ATOMIC_FLAG_TYPE(__v), __m);} - _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY - void notify_one() volatile _NOEXCEPT - {__cxx_atomic_notify_one(&__a_);} - _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY - void notify_one() _NOEXCEPT - {__cxx_atomic_notify_one(&__a_);} - _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY - void notify_all() volatile _NOEXCEPT - {__cxx_atomic_notify_all(&__a_);} - _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY - void notify_all() _NOEXCEPT - {__cxx_atomic_notify_all(&__a_);} - -#if _LIBCPP_STD_VER > 17 - _LIBCPP_INLINE_VISIBILITY constexpr - atomic_flag() _NOEXCEPT : __a_(false) {} -#else - _LIBCPP_INLINE_VISIBILITY - atomic_flag() _NOEXCEPT = default; -#endif - - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR - atomic_flag(bool __b) _NOEXCEPT : __a_(__b) {} // EXTENSION - - atomic_flag(const atomic_flag&) = delete; - atomic_flag& operator=(const atomic_flag&) = delete; - atomic_flag& operator=(const atomic_flag&) volatile = delete; - -} atomic_flag; - - -inline _LIBCPP_INLINE_VISIBILITY -bool -atomic_flag_test(const volatile atomic_flag* __o) _NOEXCEPT -{ - return __o->test(); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool -atomic_flag_test(const atomic_flag* __o) _NOEXCEPT -{ - return __o->test(); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool -atomic_flag_test_explicit(const volatile atomic_flag* __o, memory_order __m) _NOEXCEPT -{ - return __o->test(__m); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool -atomic_flag_test_explicit(const atomic_flag* __o, memory_order __m) _NOEXCEPT -{ - return __o->test(__m); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool -atomic_flag_test_and_set(volatile atomic_flag* __o) _NOEXCEPT -{ - return __o->test_and_set(); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool -atomic_flag_test_and_set(atomic_flag* __o) _NOEXCEPT -{ - return __o->test_and_set(); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool -atomic_flag_test_and_set_explicit(volatile atomic_flag* __o, memory_order __m) _NOEXCEPT -{ - return __o->test_and_set(__m); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool -atomic_flag_test_and_set_explicit(atomic_flag* __o, memory_order __m) _NOEXCEPT -{ - return __o->test_and_set(__m); -} - -inline _LIBCPP_INLINE_VISIBILITY -void -atomic_flag_clear(volatile atomic_flag* __o) _NOEXCEPT -{ - __o->clear(); -} - -inline _LIBCPP_INLINE_VISIBILITY -void -atomic_flag_clear(atomic_flag* __o) _NOEXCEPT -{ - __o->clear(); -} - -inline _LIBCPP_INLINE_VISIBILITY -void -atomic_flag_clear_explicit(volatile atomic_flag* __o, memory_order __m) _NOEXCEPT -{ - __o->clear(__m); -} - -inline _LIBCPP_INLINE_VISIBILITY -void -atomic_flag_clear_explicit(atomic_flag* __o, memory_order __m) _NOEXCEPT -{ - __o->clear(__m); -} - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_SYNC -void -atomic_flag_wait(const volatile atomic_flag* __o, bool __v) _NOEXCEPT -{ - __o->wait(__v); -} - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_SYNC -void -atomic_flag_wait(const atomic_flag* __o, bool __v) _NOEXCEPT -{ - __o->wait(__v); -} - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_SYNC -void -atomic_flag_wait_explicit(const volatile atomic_flag* __o, - bool __v, memory_order __m) _NOEXCEPT -{ - __o->wait(__v, __m); -} - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_SYNC -void -atomic_flag_wait_explicit(const atomic_flag* __o, - bool __v, memory_order __m) _NOEXCEPT -{ - __o->wait(__v, __m); -} - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_SYNC -void -atomic_flag_notify_one(volatile atomic_flag* __o) _NOEXCEPT -{ - __o->notify_one(); -} - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_SYNC -void -atomic_flag_notify_one(atomic_flag* __o) _NOEXCEPT -{ - __o->notify_one(); -} - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_SYNC -void -atomic_flag_notify_all(volatile atomic_flag* __o) _NOEXCEPT -{ - __o->notify_all(); -} - -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_SYNC -void -atomic_flag_notify_all(atomic_flag* __o) _NOEXCEPT -{ - __o->notify_all(); -} - -// fences - -inline _LIBCPP_INLINE_VISIBILITY -void -atomic_thread_fence(memory_order __m) _NOEXCEPT -{ - __cxx_atomic_thread_fence(__m); -} - -inline _LIBCPP_INLINE_VISIBILITY -void -atomic_signal_fence(memory_order __m) _NOEXCEPT -{ - __cxx_atomic_signal_fence(__m); -} - -// Atomics for standard typedef types - -typedef atomic<bool> atomic_bool; -typedef atomic<char> atomic_char; -typedef atomic<signed char> atomic_schar; -typedef atomic<unsigned char> atomic_uchar; -typedef atomic<short> atomic_short; -typedef atomic<unsigned short> atomic_ushort; -typedef atomic<int> atomic_int; -typedef atomic<unsigned int> atomic_uint; -typedef atomic<long> atomic_long; -typedef atomic<unsigned long> atomic_ulong; -typedef atomic<long long> atomic_llong; -typedef atomic<unsigned long long> atomic_ullong; -#ifndef _LIBCPP_HAS_NO_CHAR8_T -typedef atomic<char8_t> atomic_char8_t; -#endif -typedef atomic<char16_t> atomic_char16_t; -typedef atomic<char32_t> atomic_char32_t; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -typedef atomic<wchar_t> atomic_wchar_t; -#endif - -typedef atomic<int_least8_t> atomic_int_least8_t; -typedef atomic<uint_least8_t> atomic_uint_least8_t; -typedef atomic<int_least16_t> atomic_int_least16_t; -typedef atomic<uint_least16_t> atomic_uint_least16_t; -typedef atomic<int_least32_t> atomic_int_least32_t; -typedef atomic<uint_least32_t> atomic_uint_least32_t; -typedef atomic<int_least64_t> atomic_int_least64_t; -typedef atomic<uint_least64_t> atomic_uint_least64_t; - -typedef atomic<int_fast8_t> atomic_int_fast8_t; -typedef atomic<uint_fast8_t> atomic_uint_fast8_t; -typedef atomic<int_fast16_t> atomic_int_fast16_t; -typedef atomic<uint_fast16_t> atomic_uint_fast16_t; -typedef atomic<int_fast32_t> atomic_int_fast32_t; -typedef atomic<uint_fast32_t> atomic_uint_fast32_t; -typedef atomic<int_fast64_t> atomic_int_fast64_t; -typedef atomic<uint_fast64_t> atomic_uint_fast64_t; - -typedef atomic< int8_t> atomic_int8_t; -typedef atomic<uint8_t> atomic_uint8_t; -typedef atomic< int16_t> atomic_int16_t; -typedef atomic<uint16_t> atomic_uint16_t; -typedef atomic< int32_t> atomic_int32_t; -typedef atomic<uint32_t> atomic_uint32_t; -typedef atomic< int64_t> atomic_int64_t; -typedef atomic<uint64_t> atomic_uint64_t; - -typedef atomic<intptr_t> atomic_intptr_t; -typedef atomic<uintptr_t> atomic_uintptr_t; -typedef atomic<size_t> atomic_size_t; -typedef atomic<ptrdiff_t> atomic_ptrdiff_t; -typedef atomic<intmax_t> atomic_intmax_t; -typedef atomic<uintmax_t> atomic_uintmax_t; - -// atomic_*_lock_free : prefer the contention type most highly, then the largest lock-free type - -#ifdef __cpp_lib_atomic_is_always_lock_free -# define _LIBCPP_CONTENTION_LOCK_FREE ::std::__libcpp_is_always_lock_free<__cxx_contention_t>::__value -#else -# define _LIBCPP_CONTENTION_LOCK_FREE false -#endif - -#if ATOMIC_LLONG_LOCK_FREE == 2 -typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, long long> __libcpp_signed_lock_free; -typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned long long> __libcpp_unsigned_lock_free; -#elif ATOMIC_INT_LOCK_FREE == 2 -typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, int> __libcpp_signed_lock_free; -typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned int> __libcpp_unsigned_lock_free; -#elif ATOMIC_SHORT_LOCK_FREE == 2 -typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, short> __libcpp_signed_lock_free; -typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned short> __libcpp_unsigned_lock_free; -#elif ATOMIC_CHAR_LOCK_FREE == 2 -typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, char> __libcpp_signed_lock_free; -typedef __conditional_t<_LIBCPP_CONTENTION_LOCK_FREE, __cxx_contention_t, unsigned char> __libcpp_unsigned_lock_free; -#else - // No signed/unsigned lock-free types -#define _LIBCPP_NO_LOCK_FREE_TYPES -#endif - -#if !defined(_LIBCPP_NO_LOCK_FREE_TYPES) -typedef atomic<__libcpp_signed_lock_free> atomic_signed_lock_free; -typedef atomic<__libcpp_unsigned_lock_free> atomic_unsigned_lock_free; -#endif - -#define ATOMIC_FLAG_INIT {false} -#define ATOMIC_VAR_INIT(__v) {__v} - -#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) -# if defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 1400 -# pragma clang deprecated(ATOMIC_VAR_INIT) -# endif -#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) - -_LIBCPP_END_NAMESPACE_STD - #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <cmath> # include <compare> +# include <cstring> # include <type_traits> #endif
diff --git a/third_party/llvm-project/libcxx/include/barrier b/third_party/llvm-project/libcxx/include/barrier index 2e8906b..ebaff8b 100644 --- a/third_party/llvm-project/libcxx/include/barrier +++ b/third_party/llvm-project/libcxx/include/barrier
@@ -46,13 +46,18 @@ */ #include <__assert> // all public C++ headers provide the assertion handler +#include <__atomic/atomic_base.h> +#include <__atomic/memory_order.h> #include <__availability> #include <__config> #include <__memory/unique_ptr.h> +#include <__thread/poll_with_backoff.h> #include <__thread/timed_backoff_policy.h> #include <__utility/move.h> -#include <atomic> +#include <cstddef> +#include <cstdint> #include <limits> +#include <version> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -130,7 +135,7 @@ __expected_adjustment_(0), __completion_(std::move(__completion)), __phase_(0) { } - [[nodiscard]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY + [[__nodiscard__]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY arrival_token arrive(ptrdiff_t __update) { auto const __old_phase = __phase_.load(memory_order_relaxed); @@ -300,7 +305,7 @@ barrier(barrier const&) = delete; barrier& operator=(barrier const&) = delete; - [[nodiscard]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY + [[__nodiscard__]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY arrival_token arrive(ptrdiff_t __update = 1) { return __b_.arrive(__update); @@ -329,6 +334,7 @@ _LIBCPP_POP_MACROS #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <atomic> # include <concepts> # include <iterator> # include <memory>
diff --git a/third_party/llvm-project/libcxx/include/bit b/third_party/llvm-project/libcxx/include/bit index d17a6e4..6b35bb2 100644 --- a/third_party/llvm-project/libcxx/include/bit +++ b/third_party/llvm-project/libcxx/include/bit
@@ -83,6 +83,7 @@ #endif #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <cstdlib> # include <iosfwd> # include <limits> # include <type_traits>
diff --git a/third_party/llvm-project/libcxx/include/bitset b/third_party/llvm-project/libcxx/include/bitset index c260f9f..fc8ffb8 100644 --- a/third_party/llvm-project/libcxx/include/bitset +++ b/third_party/llvm-project/libcxx/include/bitset
@@ -795,11 +795,11 @@ if (__str[__i] != __zero && __str[__i] != __one) __throw_invalid_argument("bitset string ctor has invalid argument"); - size_t _Mp = _VSTD::min(__rlen, _Size); + size_t __mp = _VSTD::min(__rlen, _Size); size_t __i = 0; - for (; __i < _Mp; ++__i) + for (; __i < __mp; ++__i) { - _CharT __c = __str[_Mp - 1 - __i]; + _CharT __c = __str[__mp - 1 - __i]; (*this)[__i] = (__c == __one); } _VSTD::fill(base::__make_iter(__i), base::__make_iter(_Size), false); @@ -821,11 +821,11 @@ if (!_Traits::eq(__str[__i], __zero) && !_Traits::eq(__str[__i], __one)) __throw_invalid_argument("bitset string ctor has invalid argument"); - size_t _Mp = _VSTD::min(__rlen, _Size); + size_t __mp = _VSTD::min(__rlen, _Size); size_t __i = 0; - for (; __i < _Mp; ++__i) + for (; __i < __mp; ++__i) { - _CharT __c = __str[__pos + _Mp - 1 - __i]; + _CharT __c = __str[__pos + __mp - 1 - __i]; (*this)[__i] = _Traits::eq(__c, __one); } _VSTD::fill(base::__make_iter(__i), base::__make_iter(_Size), false); @@ -956,8 +956,8 @@ if (__pos >= _Size) __throw_out_of_range("bitset flip argument out of range"); - reference r = base::__make_ref(__pos); - r = ~r; + reference __r = base::__make_ref(__pos); + __r = ~__r; return *this; } @@ -1154,6 +1154,8 @@ #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <concepts> +# include <cstdlib> +# include <type_traits> #endif #endif // _LIBCPP_BITSET
diff --git a/third_party/llvm-project/libcxx/include/charconv b/third_party/llvm-project/libcxx/include/charconv index 9c74ce3..3b14237 100644 --- a/third_party/llvm-project/libcxx/include/charconv +++ b/third_party/llvm-project/libcxx/include/charconv
@@ -63,785 +63,42 @@ constexpr from_chars_result from_chars(const char* first, const char* last, see below& value, int base = 10); // constexpr since C++23 - from_chars_result from_chars(const char* first, const char* last, - float& value, - chars_format fmt = chars_format::general); - from_chars_result from_chars(const char* first, const char* last, - double& value, - chars_format fmt = chars_format::general); - from_chars_result from_chars(const char* first, const char* last, - long double& value, - chars_format fmt = chars_format::general); - } // namespace std */ -#include <__algorithm/copy_n.h> #include <__assert> // all public C++ headers provide the assertion handler -#include <__availability> -#include <__bit/countl.h> #include <__charconv/chars_format.h> +#include <__charconv/from_chars_integral.h> #include <__charconv/from_chars_result.h> #include <__charconv/tables.h> +#include <__charconv/to_chars.h> #include <__charconv/to_chars_base_10.h> +#include <__charconv/to_chars_floating_point.h> +#include <__charconv/to_chars_integral.h> #include <__charconv/to_chars_result.h> +#include <__charconv/traits.h> #include <__config> #include <__debug> -#include <__errc> -#include <__memory/addressof.h> -#include <__type_traits/make_32_64_or_128_bit.h> -#include <__utility/unreachable.h> +#include <__system_error/errc.h> #include <cmath> // for log2f #include <cstdint> -#include <cstdlib> -#include <cstring> #include <limits> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 - -to_chars_result to_chars(char*, char*, bool, int = 10) = delete; -from_chars_result from_chars(const char*, const char*, bool, int = 10) = delete; - -namespace __itoa -{ - -template <typename _Tp, typename = void> -struct _LIBCPP_HIDDEN __traits_base; - -template <typename _Tp> -struct _LIBCPP_HIDDEN __traits_base<_Tp, __enable_if_t<sizeof(_Tp) <= sizeof(uint32_t)>> -{ - using type = uint32_t; - - /// The width estimation using a log10 algorithm. - /// - /// The algorithm is based on - /// http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10 - /// Instead of using IntegerLogBase2 it uses __libcpp_clz. Since that - /// function requires its input to have at least one bit set the value of - /// zero is set to one. This means the first element of the lookup table is - /// zero. - static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width(_Tp __v) - { - auto __t = (32 - std::__libcpp_clz(static_cast<type>(__v | 1))) * 1233 >> 12; - return __t - (__v < __itoa::__pow10_32[__t]) + 1; - } - - static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char* __convert(char* __p, _Tp __v) - { - return __itoa::__base_10_u32(__p, __v); - } - - static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI decltype(__pow10_32)& __pow() { return __itoa::__pow10_32; } -}; - -template <typename _Tp> -struct _LIBCPP_HIDDEN - __traits_base<_Tp, __enable_if_t<sizeof(_Tp) == sizeof(uint64_t)>> { - using type = uint64_t; - - /// The width estimation using a log10 algorithm. - /// - /// The algorithm is based on - /// http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10 - /// Instead of using IntegerLogBase2 it uses __libcpp_clz. Since that - /// function requires its input to have at least one bit set the value of - /// zero is set to one. This means the first element of the lookup table is - /// zero. - static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width(_Tp __v) { - auto __t = (64 - std::__libcpp_clz(static_cast<type>(__v | 1))) * 1233 >> 12; - return __t - (__v < __itoa::__pow10_64[__t]) + 1; - } - - static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char* __convert(char* __p, _Tp __v) { return __itoa::__base_10_u64(__p, __v); } - - static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI decltype(__pow10_64)& __pow() { return __itoa::__pow10_64; } -}; - - -# ifndef _LIBCPP_HAS_NO_INT128 -template <typename _Tp> -struct _LIBCPP_HIDDEN - __traits_base<_Tp, __enable_if_t<sizeof(_Tp) == sizeof(__uint128_t)> > { - using type = __uint128_t; - - /// The width estimation using a log10 algorithm. - /// - /// The algorithm is based on - /// http://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10 - /// Instead of using IntegerLogBase2 it uses __libcpp_clz. Since that - /// function requires its input to have at least one bit set the value of - /// zero is set to one. This means the first element of the lookup table is - /// zero. - static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int __width(_Tp __v) { - _LIBCPP_ASSERT(__v > numeric_limits<uint64_t>::max(), "The optimizations for this algorithm fail when this isn't true."); - // There's always a bit set in the upper 64-bits. - auto __t = (128 - std::__libcpp_clz(static_cast<uint64_t>(__v >> 64))) * 1233 >> 12; - _LIBCPP_ASSERT(__t >= __itoa::__pow10_128_offset, "Index out of bounds"); - // __t is adjusted since the lookup table misses the lower entries. - return __t - (__v < __itoa::__pow10_128[__t - __itoa::__pow10_128_offset]) + 1; - } - - static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char* __convert(char* __p, _Tp __v) { return __itoa::__base_10_u128(__p, __v); } - - // TODO FMT This pow function should get an index. - // By moving this to its own header it can be reused by the pow function in to_chars_base_10. - static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI decltype(__pow10_128)& __pow() { return __itoa::__pow10_128; } -}; -#endif - -template <typename _Tp> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool -__mul_overflowed(unsigned char __a, _Tp __b, unsigned char& __r) -{ - auto __c = __a * __b; - __r = __c; - return __c > numeric_limits<unsigned char>::max(); -} - -template <typename _Tp> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool -__mul_overflowed(unsigned short __a, _Tp __b, unsigned short& __r) -{ - auto __c = __a * __b; - __r = __c; - return __c > numeric_limits<unsigned short>::max(); -} - -template <typename _Tp> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool -__mul_overflowed(_Tp __a, _Tp __b, _Tp& __r) -{ - static_assert(is_unsigned<_Tp>::value, ""); - return __builtin_mul_overflow(__a, __b, &__r); -} - -template <typename _Tp, typename _Up> -inline _LIBCPP_HIDE_FROM_ABI bool -_LIBCPP_CONSTEXPR_SINCE_CXX23 __mul_overflowed(_Tp __a, _Up __b, _Tp& __r) -{ - return __itoa::__mul_overflowed(__a, static_cast<_Tp>(__b), __r); -} - -template <typename _Tp> -struct _LIBCPP_HIDDEN __traits : __traits_base<_Tp> -{ - static constexpr int digits = numeric_limits<_Tp>::digits10 + 1; - using __traits_base<_Tp>::__pow; - using typename __traits_base<_Tp>::type; - - // precondition: at least one non-zero character available - static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI char const* - __read(char const* __p, char const* __ep, type& __a, type& __b) - { - type __cprod[digits]; - int __j = digits - 1; - int __i = digits; - do - { - if (*__p < '0' || *__p > '9') - break; - __cprod[--__i] = *__p++ - '0'; - } while (__p != __ep && __i != 0); - - __a = __inner_product(__cprod + __i + 1, __cprod + __j, __pow() + 1, - __cprod[__i]); - if (__itoa::__mul_overflowed(__cprod[__j], __pow()[__j - __i], __b)) - --__p; - return __p; - } - - template <typename _It1, typename _It2, class _Up> - static _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI _Up - __inner_product(_It1 __first1, _It1 __last1, _It2 __first2, _Up __init) - { - for (; __first1 < __last1; ++__first1, ++__first2) - __init = __init + *__first1 * *__first2; - return __init; - } -}; - -} // namespace __itoa - -template <typename _Tp> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI _Tp -__complement(_Tp __x) -{ - static_assert(is_unsigned<_Tp>::value, "cast to unsigned first"); - return _Tp(~__x + 1); -} - -template <typename _Tp> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result -__to_chars_itoa(char* __first, char* __last, _Tp __value, false_type); - -template <typename _Tp> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result -__to_chars_itoa(char* __first, char* __last, _Tp __value, true_type) -{ - auto __x = std::__to_unsigned_like(__value); - if (__value < 0 && __first != __last) - { - *__first++ = '-'; - __x = std::__complement(__x); - } - - return std::__to_chars_itoa(__first, __last, __x, false_type()); -} - -template <typename _Tp> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result -__to_chars_itoa(char* __first, char* __last, _Tp __value, false_type) -{ - using __tx = __itoa::__traits<_Tp>; - auto __diff = __last - __first; - - if (__tx::digits <= __diff || __tx::__width(__value) <= __diff) - return {__tx::__convert(__first, __value), errc(0)}; - else - return {__last, errc::value_too_large}; -} - -# ifndef _LIBCPP_HAS_NO_INT128 -template <> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result -__to_chars_itoa(char* __first, char* __last, __uint128_t __value, false_type) -{ - // When the value fits in 64-bits use the 64-bit code path. This reduces - // the number of expensive calculations on 128-bit values. - // - // NOTE the 128-bit code path requires this optimization. - if(__value <= numeric_limits<uint64_t>::max()) - return __to_chars_itoa(__first, __last, static_cast<uint64_t>(__value), false_type()); - - using __tx = __itoa::__traits<__uint128_t>; - auto __diff = __last - __first; - - if (__tx::digits <= __diff || __tx::__width(__value) <= __diff) - return {__tx::__convert(__first, __value), errc(0)}; - else - return {__last, errc::value_too_large}; -} -#endif - -template <class _Tp> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result -__to_chars_integral(char* __first, char* __last, _Tp __value, int __base, false_type); - -template <typename _Tp> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result -__to_chars_integral(char* __first, char* __last, _Tp __value, int __base, - true_type) -{ - auto __x = std::__to_unsigned_like(__value); - if (__value < 0 && __first != __last) - { - *__first++ = '-'; - __x = std::__complement(__x); - } - - return std::__to_chars_integral(__first, __last, __x, __base, false_type()); -} - -namespace __itoa { - -template <unsigned _Base> -struct _LIBCPP_HIDDEN __integral; - -template <> -struct _LIBCPP_HIDDEN __integral<2> { - template <typename _Tp> - _LIBCPP_HIDE_FROM_ABI static constexpr int __width(_Tp __value) noexcept { - // If value == 0 still need one digit. If the value != this has no - // effect since the code scans for the most significant bit set. (Note - // that __libcpp_clz doesn't work for 0.) - return numeric_limits<_Tp>::digits - std::__libcpp_clz(__value | 1); - } - - template <typename _Tp> - _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI static to_chars_result __to_chars(char* __first, char* __last, _Tp __value) { - ptrdiff_t __cap = __last - __first; - int __n = __width(__value); - if (__n > __cap) - return {__last, errc::value_too_large}; - - __last = __first + __n; - char* __p = __last; - const unsigned __divisor = 16; - while (__value > __divisor) { - unsigned __c = __value % __divisor; - __value /= __divisor; - __p -= 4; - std::copy_n(&__base_2_lut[4 * __c], 4, __p); - } - do { - unsigned __c = __value % 2; - __value /= 2; - *--__p = "01"[__c]; - } while (__value != 0); - return {__last, errc(0)}; - } -}; - -template <> -struct _LIBCPP_HIDDEN __integral<8> { - template <typename _Tp> - _LIBCPP_HIDE_FROM_ABI static constexpr int __width(_Tp __value) noexcept { - // If value == 0 still need one digit. If the value != this has no - // effect since the code scans for the most significat bit set. (Note - // that __libcpp_clz doesn't work for 0.) - return ((numeric_limits<_Tp>::digits - std::__libcpp_clz(__value | 1)) + 2) / 3; - } - - template <typename _Tp> - _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI static to_chars_result __to_chars(char* __first, char* __last, _Tp __value) { - ptrdiff_t __cap = __last - __first; - int __n = __width(__value); - if (__n > __cap) - return {__last, errc::value_too_large}; - - __last = __first + __n; - char* __p = __last; - unsigned __divisor = 64; - while (__value > __divisor) { - unsigned __c = __value % __divisor; - __value /= __divisor; - __p -= 2; - std::copy_n(&__base_8_lut[2 * __c], 2, __p); - } - do { - unsigned __c = __value % 8; - __value /= 8; - *--__p = "01234567"[__c]; - } while (__value != 0); - return {__last, errc(0)}; - } - -}; - -template <> -struct _LIBCPP_HIDDEN __integral<16> { - template <typename _Tp> - _LIBCPP_HIDE_FROM_ABI static constexpr int __width(_Tp __value) noexcept { - // If value == 0 still need one digit. If the value != this has no - // effect since the code scans for the most significat bit set. (Note - // that __libcpp_clz doesn't work for 0.) - return (numeric_limits<_Tp>::digits - std::__libcpp_clz(__value | 1) + 3) / 4; - } - - template <typename _Tp> - _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI static to_chars_result __to_chars(char* __first, char* __last, _Tp __value) { - ptrdiff_t __cap = __last - __first; - int __n = __width(__value); - if (__n > __cap) - return {__last, errc::value_too_large}; - - __last = __first + __n; - char* __p = __last; - unsigned __divisor = 256; - while (__value > __divisor) { - unsigned __c = __value % __divisor; - __value /= __divisor; - __p -= 2; - std::copy_n(&__base_16_lut[2 * __c], 2, __p); - } - if (__first != __last) - do { - unsigned __c = __value % 16; - __value /= 16; - *--__p = "0123456789abcdef"[__c]; - } while (__value != 0); - return {__last, errc(0)}; - } -}; - -} // namespace __itoa - -template <unsigned _Base, typename _Tp, - typename enable_if<(sizeof(_Tp) >= sizeof(unsigned)), int>::type = 0> -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int -__to_chars_integral_width(_Tp __value) { - return __itoa::__integral<_Base>::__width(__value); -} - -template <unsigned _Base, typename _Tp, - typename enable_if<(sizeof(_Tp) < sizeof(unsigned)), int>::type = 0> -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int -__to_chars_integral_width(_Tp __value) { - return std::__to_chars_integral_width<_Base>(static_cast<unsigned>(__value)); -} - -template <unsigned _Base, typename _Tp, - typename enable_if<(sizeof(_Tp) >= sizeof(unsigned)), int>::type = 0> -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result -__to_chars_integral(char* __first, char* __last, _Tp __value) { - return __itoa::__integral<_Base>::__to_chars(__first, __last, __value); -} - -template <unsigned _Base, typename _Tp, - typename enable_if<(sizeof(_Tp) < sizeof(unsigned)), int>::type = 0> -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result -__to_chars_integral(char* __first, char* __last, _Tp __value) { - return std::__to_chars_integral<_Base>(__first, __last, static_cast<unsigned>(__value)); -} - -template <typename _Tp> -_LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI int -__to_chars_integral_width(_Tp __value, unsigned __base) { - _LIBCPP_ASSERT(__value >= 0, "The function requires a non-negative value."); - - unsigned __base_2 = __base * __base; - unsigned __base_3 = __base_2 * __base; - unsigned __base_4 = __base_2 * __base_2; - - int __r = 0; - while (true) { - if (__value < __base) - return __r + 1; - if (__value < __base_2) - return __r + 2; - if (__value < __base_3) - return __r + 3; - if (__value < __base_4) - return __r + 4; - - __value /= __base_4; - __r += 4; - } - - __libcpp_unreachable(); -} - -template <typename _Tp> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result -__to_chars_integral(char* __first, char* __last, _Tp __value, int __base, - false_type) -{ - if (__base == 10) [[likely]] - return std::__to_chars_itoa(__first, __last, __value, false_type()); - - switch (__base) { - case 2: - return std::__to_chars_integral<2>(__first, __last, __value); - case 8: - return std::__to_chars_integral<8>(__first, __last, __value); - case 16: - return std::__to_chars_integral<16>(__first, __last, __value); - } - - ptrdiff_t __cap = __last - __first; - int __n = std::__to_chars_integral_width(__value, __base); - if (__n > __cap) - return {__last, errc::value_too_large}; - - __last = __first + __n; - char* __p = __last; - do { - unsigned __c = __value % __base; - __value /= __base; - *--__p = "0123456789abcdefghijklmnopqrstuvwxyz"[__c]; - } while (__value != 0); - return {__last, errc(0)}; -} - -template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result -to_chars(char* __first, char* __last, _Tp __value) -{ - using _Type = __make_32_64_or_128_bit_t<_Tp>; - static_assert(!is_same<_Type, void>::value, "unsupported integral type used in to_chars"); - return std::__to_chars_itoa(__first, __last, static_cast<_Type>(__value), is_signed<_Tp>()); -} - -template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI to_chars_result -to_chars(char* __first, char* __last, _Tp __value, int __base) -{ - _LIBCPP_ASSERT(2 <= __base && __base <= 36, "base not in [2, 36]"); - - using _Type = __make_32_64_or_128_bit_t<_Tp>; - return std::__to_chars_integral(__first, __last, static_cast<_Type>(__value), __base, is_signed<_Tp>()); -} - -template <typename _It, typename _Tp, typename _Fn, typename... _Ts> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result -__sign_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args) -{ - using __tl = numeric_limits<_Tp>; - decltype(std::__to_unsigned_like(__value)) __x; - - bool __neg = (__first != __last && *__first == '-'); - auto __r = __f(__neg ? __first + 1 : __first, __last, __x, __args...); - switch (__r.ec) - { - case errc::invalid_argument: - return {__first, __r.ec}; - case errc::result_out_of_range: - return __r; - default: - break; - } - - if (__neg) - { - if (__x <= std::__complement(std::__to_unsigned_like(__tl::min()))) - { - __x = std::__complement(__x); - std::copy_n(std::addressof(__x), 1, std::addressof(__value)); - return __r; - } - } - else - { - if (__x <= std::__to_unsigned_like(__tl::max())) - { - __value = __x; - return __r; - } - } - - return {__r.ptr, errc::result_out_of_range}; -} - -template <typename _Tp> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI bool -__in_pattern(_Tp __c) -{ - return '0' <= __c && __c <= '9'; -} - -struct _LIBCPP_HIDDEN __in_pattern_result -{ - bool __ok; - int __val; - - explicit _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI operator bool() const { return __ok; } -}; - -template <typename _Tp> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI __in_pattern_result -__in_pattern(_Tp __c, int __base) -{ - if (__base <= 10) - return {'0' <= __c && __c < '0' + __base, __c - '0'}; - else if (std::__in_pattern(__c)) - return {true, __c - '0'}; - else if ('a' <= __c && __c < 'a' + __base - 10) - return {true, __c - 'a' + 10}; - else - return {'A' <= __c && __c < 'A' + __base - 10, __c - 'A' + 10}; -} - -template <typename _It, typename _Tp, typename _Fn, typename... _Ts> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result -__subject_seq_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, - _Ts... __args) -{ - auto __find_non_zero = [](_It __firstit, _It __lastit) { - for (; __firstit != __lastit; ++__firstit) - if (*__firstit != '0') - break; - return __firstit; - }; - - auto __p = __find_non_zero(__first, __last); - if (__p == __last || !std::__in_pattern(*__p, __args...)) - { - if (__p == __first) - return {__first, errc::invalid_argument}; - else - { - __value = 0; - return {__p, {}}; - } - } - - auto __r = __f(__p, __last, __value, __args...); - if (__r.ec == errc::result_out_of_range) - { - for (; __r.ptr != __last; ++__r.ptr) - { - if (!std::__in_pattern(*__r.ptr, __args...)) - break; - } - } - - return __r; -} - -template <typename _Tp, typename enable_if<is_unsigned<_Tp>::value, int>::type = 0> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result -__from_chars_atoi(const char* __first, const char* __last, _Tp& __value) -{ - using __tx = __itoa::__traits<_Tp>; - using __output_type = typename __tx::type; - - return std::__subject_seq_combinator( - __first, __last, __value, - [](const char* __f, const char* __l, - _Tp& __val) -> from_chars_result { - __output_type __a, __b; - auto __p = __tx::__read(__f, __l, __a, __b); - if (__p == __l || !std::__in_pattern(*__p)) - { - __output_type __m = numeric_limits<_Tp>::max(); - if (__m >= __a && __m - __a >= __b) - { - __val = __a + __b; - return {__p, {}}; - } - } - return {__p, errc::result_out_of_range}; - }); -} - -template <typename _Tp, typename enable_if<is_signed<_Tp>::value, int>::type = 0> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result -__from_chars_atoi(const char* __first, const char* __last, _Tp& __value) -{ - using __t = decltype(std::__to_unsigned_like(__value)); - return std::__sign_combinator(__first, __last, __value, __from_chars_atoi<__t>); -} - - -/* -// Code used to generate __from_chars_log2f_lut. -#include <cmath> -#include <iostream> -#include <format> - -int main() { - for (int i = 2; i <= 36; ++i) - std::cout << std::format("{},\n", log2f(i)); -} -*/ -/// log2f table for bases [2, 36]. -inline constexpr float __from_chars_log2f_lut[35] = { - 1, 1.5849625, 2, 2.321928, 2.5849626, 2.807355, 3, 3.169925, 3.321928, - 3.4594316, 3.5849626, 3.7004397, 3.807355, 3.9068906, 4, 4.087463, 4.169925, 4.2479277, - 4.321928, 4.3923173, 4.4594316, 4.523562, 4.5849624, 4.643856, 4.70044, 4.7548876, 4.807355, - 4.857981, 4.9068904, 4.9541965, 5, 5.044394, 5.087463, 5.129283, 5.169925}; - -template <typename _Tp, typename enable_if<is_unsigned<_Tp>::value, int>::type = 0> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result -__from_chars_integral(const char* __first, const char* __last, _Tp& __value, - int __base) -{ - if (__base == 10) - return std::__from_chars_atoi(__first, __last, __value); - - return std::__subject_seq_combinator( - __first, __last, __value, - [](const char* __p, const char* __lastp, _Tp& __val, - int __b) -> from_chars_result { - using __tl = numeric_limits<_Tp>; - // __base is always between 2 and 36 inclusive. - auto __digits = __tl::digits / __from_chars_log2f_lut[__b - 2]; - _Tp __x = __in_pattern(*__p++, __b).__val, __y = 0; - - for (int __i = 1; __p != __lastp; ++__i, ++__p) - { - if (auto __c = __in_pattern(*__p, __b)) - { - if (__i < __digits - 1) - __x = __x * __b + __c.__val; - else - { - if (!__itoa::__mul_overflowed(__x, __b, __x)) - ++__p; - __y = __c.__val; - break; - } - } - else - break; - } - - if (__p == __lastp || !__in_pattern(*__p, __b)) - { - if (__tl::max() - __x >= __y) - { - __val = __x + __y; - return {__p, {}}; - } - } - return {__p, errc::result_out_of_range}; - }, - __base); -} - -template <typename _Tp, typename enable_if<is_signed<_Tp>::value, int>::type = 0> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result -__from_chars_integral(const char* __first, const char* __last, _Tp& __value, - int __base) -{ - using __t = decltype(std::__to_unsigned_like(__value)); - return std::__sign_combinator(__first, __last, __value, - __from_chars_integral<__t>, __base); -} - -template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result -from_chars(const char* __first, const char* __last, _Tp& __value) -{ - return std::__from_chars_atoi(__first, __last, __value); -} - -template <typename _Tp, typename enable_if<is_integral<_Tp>::value, int>::type = 0> -inline _LIBCPP_CONSTEXPR_SINCE_CXX23 _LIBCPP_HIDE_FROM_ABI from_chars_result -from_chars(const char* __first, const char* __last, _Tp& __value, int __base) -{ - _LIBCPP_ASSERT(2 <= __base && __base <= 36, "base not in [2, 36]"); - return std::__from_chars_integral(__first, __last, __value, __base); -} - -_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS -to_chars_result to_chars(char* __first, char* __last, float __value); - -_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS -to_chars_result to_chars(char* __first, char* __last, double __value); - -_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS -to_chars_result to_chars(char* __first, char* __last, long double __value); - -_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS -to_chars_result to_chars(char* __first, char* __last, float __value, chars_format __fmt); - -_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS -to_chars_result to_chars(char* __first, char* __last, double __value, chars_format __fmt); - -_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS -to_chars_result to_chars(char* __first, char* __last, long double __value, chars_format __fmt); - -_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS -to_chars_result to_chars(char* __first, char* __last, float __value, chars_format __fmt, int __precision); - -_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS -to_chars_result to_chars(char* __first, char* __last, double __value, chars_format __fmt, int __precision); - -_LIBCPP_AVAILABILITY_TO_CHARS_FLOATING_POINT _LIBCPP_FUNC_VIS -to_chars_result to_chars(char* __first, char* __last, long double __value, chars_format __fmt, int __precision); - -#endif // _LIBCPP_STD_VER > 14 - _LIBCPP_END_NAMESPACE_STD -_LIBCPP_POP_MACROS - #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <concepts> +# include <cstdlib> +# include <cstring> # include <iosfwd> +# include <type_traits> #endif #endif // _LIBCPP_CHARCONV
diff --git a/third_party/llvm-project/libcxx/include/chrono b/third_party/llvm-project/libcxx/include/chrono index 44073b5..b5d3b03 100644 --- a/third_party/llvm-project/libcxx/include/chrono +++ b/third_party/llvm-project/libcxx/include/chrono
@@ -182,7 +182,7 @@ bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); template <class Rep1, class Period1, class Rep2, class Period2> constexpr - bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); + bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); // removed in C++20 template <class Rep1, class Period1, class Rep2, class Period2> constexpr bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); @@ -195,6 +195,10 @@ template <class Rep1, class Period1, class Rep2, class Period2> constexpr bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); +template<class Rep1, class Period1, class Rep2, class Period2> + requires three_way_comparable<typename CT::rep> + constexpr auto operator<=>(const duration<Rep1, Period1>& lhs, + const duration<Rep2, Period2>& rhs); // since C++20 // duration_cast template <class ToDuration, class Rep, class Period> @@ -231,7 +235,7 @@ template <class Clock, class Duration1, class Duration2> bool operator==(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs); template <class Clock, class Duration1, class Duration2> - bool operator!=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs); + bool operator!=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs); // removed in C++20 template <class Clock, class Duration1, class Duration2> bool operator< (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs); template <class Clock, class Duration1, class Duration2> @@ -240,6 +244,10 @@ bool operator> (const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs); template <class Clock, class Duration1, class Duration2> bool operator>=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs); +template<class Clock, class Duration1, + three_way_comparable_with<Duration1> Duration2> + constexpr auto operator<=>(const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs); // since C++20 // time_point_cast (constexpr in C++14) @@ -282,6 +290,10 @@ using sys_seconds = sys_time<seconds>; // C++20 using sys_days = sys_time<days>; // C++20 +template<class charT, class traits, class Duration> // C++20 + basic_ostream<charT, traits>& + operator<<(basic_ostream<charT, traits>& os, const sys_time<Duration>& tp); + class file_clock // C++20 { public: @@ -656,6 +668,10 @@ constexpr precision to_duration() const noexcept; }; +template<class charT, class traits, class Duration> + basic_ostream<charT, traits>& + operator<<(basic_ostream<charT, traits>& os, const hh_mm_ss<Duration>& hms); // C++20 + // 26.10, 12/24 hour functions constexpr bool is_am(hours const& h) noexcept; constexpr bool is_pm(hours const& h) noexcept; @@ -674,6 +690,8 @@ } // chrono namespace std { + template<class Duration, class charT> + struct formatter<chrono::sys_time<Duration>, charT>; // C++20 template<class Rep, class Period, class charT> struct formatter<chrono::duration<Rep, Period>, charT>; // C++20 template<class charT> struct formatter<chrono::day, charT>; // C++20 @@ -691,6 +709,8 @@ template<class charT> struct formatter<chrono::year_month_day_last, charT>; // C++20 template<class charT> struct formatter<chrono::year_month_weekday, charT>; // C++20 template<class charT> struct formatter<chrono::year_month_weekday_last, charT>; // C++20 + template<class Rep, class Period, class charT> + struct formatter<chrono::hh_mm_ss<duration<Rep, Period>>, charT>; // C++20 } // namespace std namespace chrono { @@ -769,7 +789,7 @@ // [time.syn] #include <compare> -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) && _LIBCPP_STD_VER > 17 +#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) && _LIBCPP_STD_VER >= 20 # include <__chrono/formatter.h> # include <__chrono/ostream.h> # include <__chrono/parser_std_format_spec.h> @@ -782,7 +802,13 @@ #endif #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <bit> # include <concepts> +# include <cstring> +#endif + +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER == 20 +# include <charconv> #endif #endif // _LIBCPP_CHRONO
diff --git a/third_party/llvm-project/libcxx/include/cmath b/third_party/llvm-project/libcxx/include/cmath index a27d0eb..e815b3a 100644 --- a/third_party/llvm-project/libcxx/include/cmath +++ b/third_party/llvm-project/libcxx/include/cmath
@@ -311,6 +311,7 @@ #include <__type_traits/is_constant_evaluated.h> #include <__type_traits/is_floating_point.h> #include <__type_traits/is_same.h> +#include <__type_traits/promote.h> #include <__type_traits/remove_cv.h> #include <version> @@ -543,7 +544,7 @@ using ::tgammal _LIBCPP_USING_IF_EXISTS; using ::truncl _LIBCPP_USING_IF_EXISTS; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 inline _LIBCPP_INLINE_VISIBILITY float hypot( float __x, float __y, float __z ) { return sqrt(__x*__x + __y*__y + __z*__z); } inline _LIBCPP_INLINE_VISIBILITY double hypot( double __x, double __y, double __z ) { return sqrt(__x*__x + __y*__y + __z*__z); } inline _LIBCPP_INLINE_VISIBILITY long double hypot( long double __x, long double __y, long double __z ) { return sqrt(__x*__x + __y*__y + __z*__z); } @@ -782,7 +783,7 @@ return __builtin_scalbn(__x, __exp); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <typename _Fp> _LIBCPP_HIDE_FROM_ABI constexpr _Fp __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept { @@ -823,7 +824,7 @@ _IsSame<_A3, __result_type>::value)); return std::__lerp((__result_type)__a, (__result_type)__b, (__result_type)__t); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/compare b/third_party/llvm-project/libcxx/include/compare index 9272dbf..626c743 100644 --- a/third_party/llvm-project/libcxx/include/compare +++ b/third_party/llvm-project/libcxx/include/compare
@@ -151,6 +151,7 @@ #include <__compare/ordering.h> #include <__compare/partial_order.h> #include <__compare/strong_order.h> +#include <__compare/synth_three_way.h> #include <__compare/three_way_comparable.h> #include <__compare/weak_order.h> #include <__config>
diff --git a/third_party/llvm-project/libcxx/include/complex b/third_party/llvm-project/libcxx/include/complex index 760fbaa..26f189d 100644 --- a/third_party/llvm-project/libcxx/include/complex +++ b/third_party/llvm-project/libcxx/include/complex
@@ -236,7 +236,6 @@ #include <cmath> #include <iosfwd> #include <stdexcept> -#include <type_traits> #include <version> #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) @@ -1522,7 +1521,7 @@ } #endif // !_LIBCPP_HAS_NO_LOCALIZATION -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 // Literal suffix for complex number literals [complex.literals] inline namespace literals { @@ -1565,4 +1564,8 @@ _LIBCPP_END_NAMESPACE_STD +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <type_traits> +#endif + #endif // _LIBCPP_COMPLEX
diff --git a/third_party/llvm-project/libcxx/include/condition_variable b/third_party/llvm-project/libcxx/include/condition_variable index f13df1c..4135a20 100644 --- a/third_party/llvm-project/libcxx/include/condition_variable +++ b/third_party/llvm-project/libcxx/include/condition_variable
@@ -107,10 +107,18 @@ */ #include <__assert> // all public C++ headers provide the assertion handler +#include <__chrono/duration.h> +#include <__chrono/steady_clock.h> +#include <__chrono/time_point.h> +#include <__condition_variable/condition_variable.h> #include <__config> #include <__memory/shared_ptr.h> #include <__memory/unique_ptr.h> -#include <__mutex_base> +#include <__mutex/lock_guard.h> +#include <__mutex/mutex.h> +#include <__mutex/tag_types.h> +#include <__mutex/unique_lock.h> +#include <__utility/move.h> #include <version> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -202,7 +210,7 @@ unique_lock<mutex> __lk(*__mut); __lock.unlock(); unique_ptr<_Lock, __lock_external> __lxx(&__lock); - lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock); + lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock_t()); __cv_.wait(__lk); } // __mut_.unlock(), __lock.lock() @@ -224,7 +232,7 @@ unique_lock<mutex> __lk(*__mut); __lock.unlock(); unique_ptr<_Lock, __lock_external> __lxx(&__lock); - lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock); + lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock_t()); return __cv_.wait_until(__lk, __t); } // __mut_.unlock(), __lock.lock() @@ -269,8 +277,17 @@ #endif // !_LIBCPP_HAS_NO_THREADS #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <atomic> # include <concepts> +# include <cstdint> +# include <cstdlib> +# include <cstring> +# include <initializer_list> +# include <new> +# include <stdexcept> +# include <system_error> # include <type_traits> +# include <typeinfo> #endif #endif // _LIBCPP_CONDITION_VARIABLE
diff --git a/third_party/llvm-project/libcxx/include/cstddef b/third_party/llvm-project/libcxx/include/cstddef index e3c0669..a364e6e 100644 --- a/third_party/llvm-project/libcxx/include/cstddef +++ b/third_party/llvm-project/libcxx/include/cstddef
@@ -66,7 +66,7 @@ _LIBCPP_END_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 namespace std // purposefully not versioned { enum class byte : unsigned char {};
diff --git a/third_party/llvm-project/libcxx/include/cstdlib b/third_party/llvm-project/libcxx/include/cstdlib index 25c9de5..ab2c159 100644 --- a/third_party/llvm-project/libcxx/include/cstdlib +++ b/third_party/llvm-project/libcxx/include/cstdlib
@@ -144,7 +144,7 @@ using ::at_quick_exit _LIBCPP_USING_IF_EXISTS; using ::quick_exit _LIBCPP_USING_IF_EXISTS; #endif -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 using ::aligned_alloc _LIBCPP_USING_IF_EXISTS; #endif
diff --git a/third_party/llvm-project/libcxx/include/cstring b/third_party/llvm-project/libcxx/include/cstring index c88d977..a9bdf4f 100644 --- a/third_party/llvm-project/libcxx/include/cstring +++ b/third_party/llvm-project/libcxx/include/cstring
@@ -100,53 +100,6 @@ using ::strerror _LIBCPP_USING_IF_EXISTS; using ::strlen _LIBCPP_USING_IF_EXISTS; -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 size_t __constexpr_strlen(const char* __str) { - // GCC currently doesn't support __builtin_strlen for heap-allocated memory during constant evaluation. - // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70816 -#ifdef _LIBCPP_COMPILER_GCC - if (__libcpp_is_constant_evaluated()) { - size_t __i = 0; - for (; __str[__i] != '\0'; ++__i) - ; - return __i; - } -#endif - return __builtin_strlen(__str); -} - -template <class _Tp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int -__constexpr_memcmp(const _Tp* __lhs, const _Tp* __rhs, size_t __count) { -#ifdef _LIBCPP_COMPILER_GCC - if (__libcpp_is_constant_evaluated()) { - for (; __count; --__count, ++__lhs, ++__rhs) { - if (*__lhs < *__rhs) - return -1; - if (*__rhs < *__lhs) - return 1; - } - return 0; - } -#endif - return __builtin_memcmp(__lhs, __rhs, __count); -} - -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 const char* -__constexpr_char_memchr(const char* __str, int __char, size_t __count) { -#if __has_builtin(__builtin_char_memchr) - return __builtin_char_memchr(__str, __char, __count); -#else - if (!__libcpp_is_constant_evaluated()) - return static_cast<const char*>(std::memchr(__str, __char, __count)); - for (; __count; --__count) { - if (*__str == __char) - return __str; - ++__str; - } - return nullptr; -#endif -} - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_CSTRING
diff --git a/third_party/llvm-project/libcxx/include/ctime b/third_party/llvm-project/libcxx/include/ctime index 2293675..b61e19d 100644 --- a/third_party/llvm-project/libcxx/include/ctime +++ b/third_party/llvm-project/libcxx/include/ctime
@@ -66,7 +66,7 @@ using ::size_t _LIBCPP_USING_IF_EXISTS; using ::time_t _LIBCPP_USING_IF_EXISTS; using ::tm _LIBCPP_USING_IF_EXISTS; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 using ::timespec _LIBCPP_USING_IF_EXISTS; #endif using ::clock _LIBCPP_USING_IF_EXISTS; @@ -78,7 +78,7 @@ using ::gmtime _LIBCPP_USING_IF_EXISTS; using ::localtime _LIBCPP_USING_IF_EXISTS; using ::strftime _LIBCPP_USING_IF_EXISTS; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 using ::timespec_get _LIBCPP_USING_IF_EXISTS; #endif
diff --git a/third_party/llvm-project/libcxx/include/deque b/third_party/llvm-project/libcxx/include/deque index f2b8076..515c960 100644 --- a/third_party/llvm-project/libcxx/include/deque +++ b/third_party/llvm-project/libcxx/include/deque
@@ -134,15 +134,18 @@ template <class T, class Allocator> bool operator==(const deque<T,Allocator>& x, const deque<T,Allocator>& y); template <class T, class Allocator> - bool operator< (const deque<T,Allocator>& x, const deque<T,Allocator>& y); + bool operator< (const deque<T,Allocator>& x, const deque<T,Allocator>& y); // removed in C++20 template <class T, class Allocator> - bool operator!=(const deque<T,Allocator>& x, const deque<T,Allocator>& y); + bool operator!=(const deque<T,Allocator>& x, const deque<T,Allocator>& y); // removed in C++20 template <class T, class Allocator> - bool operator> (const deque<T,Allocator>& x, const deque<T,Allocator>& y); + bool operator> (const deque<T,Allocator>& x, const deque<T,Allocator>& y); // removed in C++20 template <class T, class Allocator> - bool operator>=(const deque<T,Allocator>& x, const deque<T,Allocator>& y); + bool operator>=(const deque<T,Allocator>& x, const deque<T,Allocator>& y); // removed in C++20 template <class T, class Allocator> - bool operator<=(const deque<T,Allocator>& x, const deque<T,Allocator>& y); + bool operator<=(const deque<T,Allocator>& x, const deque<T,Allocator>& y); // removed in C++20 +template<class T, class Allocator> + synth-three-way-result<T> operator<=>(const deque<T, Allocator>& x, + const deque<T, Allocator>& y); // since C++20 // specialized algorithms: template <class T, class Allocator> @@ -165,6 +168,7 @@ #include <__algorithm/equal.h> #include <__algorithm/fill_n.h> #include <__algorithm/lexicographical_compare.h> +#include <__algorithm/lexicographical_compare_three_way.h> #include <__algorithm/min.h> #include <__algorithm/remove.h> #include <__algorithm/remove_if.h> @@ -177,6 +181,7 @@ #include <__iterator/prev.h> #include <__iterator/reverse_iterator.h> #include <__iterator/segmented_iterator.h> +#include <__memory/addressof.h> #include <__memory/allocator_destructor.h> #include <__memory/pointer_traits.h> #include <__memory/temp_value.h> @@ -184,12 +189,14 @@ #include <__memory_resource/polymorphic_allocator.h> #include <__split_buffer> #include <__type_traits/is_allocator.h> +#include <__type_traits/is_convertible.h> +#include <__type_traits/is_same.h> +#include <__type_traits/type_identity.h> #include <__utility/forward.h> #include <__utility/move.h> #include <__utility/swap.h> #include <limits> #include <stdexcept> -#include <type_traits> #include <version> // standard-mandated includes @@ -249,7 +256,7 @@ typedef _Reference reference; _LIBCPP_HIDE_FROM_ABI __deque_iterator() _NOEXCEPT -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 : __m_iter_(nullptr), __ptr_(nullptr) #endif {} @@ -564,7 +571,7 @@ : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {} explicit _LIBCPP_HIDE_FROM_ABI deque(size_type __n); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 explicit _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const _Allocator& __a); #endif _LIBCPP_HIDE_FROM_ABI deque(size_type __n, const value_type& __v); @@ -713,7 +720,7 @@ _LIBCPP_HIDE_FROM_ABI void push_front(const value_type& __v); _LIBCPP_HIDE_FROM_ABI void push_back(const value_type& __v); #ifndef _LIBCPP_CXX03_LANG -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class... _Args> _LIBCPP_HIDE_FROM_ABI reference emplace_front(_Args&&... __args); template <class... _Args> _LIBCPP_HIDE_FROM_ABI reference emplace_back (_Args&&... __args); #else @@ -952,7 +959,7 @@ __append(__n); } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp, class _Allocator> deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a) : __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) @@ -1314,7 +1321,7 @@ template <class _Tp, class _Allocator> template <class... _Args> -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 typename deque<_Tp, _Allocator>::reference #else void @@ -1328,7 +1335,7 @@ __alloc_traits::construct(__a, _VSTD::addressof(*end()), _VSTD::forward<_Args>(__args)...); ++__size(); -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 return *--end(); #endif } @@ -1349,7 +1356,7 @@ template <class _Tp, class _Allocator> template <class... _Args> -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 typename deque<_Tp, _Allocator>::reference #else void @@ -1363,7 +1370,7 @@ __alloc_traits::construct(__a, _VSTD::addressof(*--begin()), _VSTD::forward<_Args>(__args)...); --__start_; ++__size(); -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 return *begin(); #endif } @@ -1879,13 +1886,13 @@ __buf(std::max<size_type>(2* __map_.capacity(), __nb + __map_.size()), 0, __map_.__alloc()); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS for (; __nb > 0; --__nb) __buf.push_back(__alloc_traits::allocate(__a, __block_size)); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -1894,7 +1901,7 @@ __alloc_traits::deallocate(__a, *__i, __block_size); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS for (; __back_capacity > 0; --__back_capacity) { __buf.push_back(__map_.back()); @@ -2021,13 +2028,13 @@ __nb + __map_.size()), __map_.size() - __front_capacity, __map_.__alloc()); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS for (; __nb > 0; --__nb) __buf.push_back(__alloc_traits::allocate(__a, __block_size)); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -2036,7 +2043,7 @@ __alloc_traits::deallocate(__a, *__i, __block_size); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS for (; __front_capacity > 0; --__front_capacity) { __buf.push_back(__map_.front()); @@ -2342,6 +2349,8 @@ return __sz == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin()); } +#if _LIBCPP_STD_VER <= 17 + template <class _Tp, class _Allocator> inline _LIBCPP_HIDE_FROM_ABI bool @@ -2382,6 +2391,19 @@ return !(__y < __x); } +#else // _LIBCPP_STD_VER <= 17 + +template<class _Tp, class _Allocator> +inline _LIBCPP_HIDE_FROM_ABI +__synth_three_way_result<_Tp> +operator<=>(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y) +{ + return std::lexicographical_compare_three_way( + __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>); +} + +#endif // _LIBCPP_STD_VER <= 17 + template <class _Tp, class _Allocator> inline _LIBCPP_HIDE_FROM_ABI void @@ -2391,7 +2413,7 @@ __x.swap(__y); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Tp, class _Allocator, class _Up> inline _LIBCPP_HIDE_FROM_ABI typename deque<_Tp, _Allocator>::size_type erase(deque<_Tp, _Allocator>& __c, const _Up& __v) { @@ -2415,11 +2437,11 @@ inline constexpr bool __format::__enable_insertable<std::deque<wchar_t>> = true; #endif -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD namespace pmr { template <class _ValueT> @@ -2434,9 +2456,11 @@ # include <algorithm> # include <atomic> # include <concepts> +# include <cstdlib> # include <functional> # include <iosfwd> # include <iterator> +# include <type_traits> # include <typeinfo> #endif
diff --git a/third_party/llvm-project/libcxx/include/exception b/third_party/llvm-project/libcxx/include/exception index e0f4268..97fee97 100644 --- a/third_party/llvm-project/libcxx/include/exception +++ b/third_party/llvm-project/libcxx/include/exception
@@ -77,307 +77,20 @@ */ #include <__assert> // all public C++ headers provide the assertion handler -#include <__availability> #include <__config> -#include <__memory/addressof.h> -#include <__type_traits/decay.h> -#include <__type_traits/is_base_of.h> -#include <__type_traits/is_class.h> -#include <__type_traits/is_convertible.h> -#include <__type_traits/is_copy_constructible.h> -#include <__type_traits/is_final.h> -#include <__type_traits/is_polymorphic.h> -#include <cstddef> -#include <cstdlib> +#include <__exception/exception.h> +#include <__exception/exception_ptr.h> +#include <__exception/nested_exception.h> +#include <__exception/operations.h> +#include <__exception/terminate.h> #include <version> -// <vcruntime_exception.h> defines its own std::exception and std::bad_exception types, -// which we use in order to be ABI-compatible with other STLs on Windows. -#if defined(_LIBCPP_ABI_VCRUNTIME) -# include <vcruntime_exception.h> -#endif - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -namespace std // purposefully not using versioning namespace -{ - -#if defined(_LIBCPP_ABI_VCRUNTIME) && (!defined(_HAS_EXCEPTIONS) || _HAS_EXCEPTIONS != 0) -// The std::exception class was already included above, but we're explicit about this condition here for clarity. - -#elif defined(_LIBCPP_ABI_VCRUNTIME) && _HAS_EXCEPTIONS == 0 -// However, <vcruntime_exception.h> does not define std::exception and std::bad_exception -// when _HAS_EXCEPTIONS == 0. -// -// Since libc++ still wants to provide the std::exception hierarchy even when _HAS_EXCEPTIONS == 0 -// (after all those are simply types like any other), we define an ABI-compatible version -// of the VCRuntime std::exception and std::bad_exception types in that mode. - -struct __std_exception_data { - char const* _What; - bool _DoFree; -}; - -class exception { // base of all library exceptions -public: - exception() _NOEXCEPT : __data_() {} - - explicit exception(char const* __message) _NOEXCEPT : __data_() { - __data_._What = __message; - __data_._DoFree = true; - } - - exception(exception const&) _NOEXCEPT {} - - exception& operator=(exception const&) _NOEXCEPT { return *this; } - - virtual ~exception() _NOEXCEPT {} - - virtual char const* what() const _NOEXCEPT { return __data_._What ? __data_._What : "Unknown exception"; } - -private: - __std_exception_data __data_; -}; - -class bad_exception : public exception { -public: - bad_exception() _NOEXCEPT : exception("bad exception") {} -}; - -#else // !defined(_LIBCPP_ABI_VCRUNTIME) -// On all other platforms, we define our own std::exception and std::bad_exception types -// regardless of whether exceptions are turned on as a language feature. - -class _LIBCPP_EXCEPTION_ABI exception { -public: - _LIBCPP_INLINE_VISIBILITY exception() _NOEXCEPT {} - _LIBCPP_INLINE_VISIBILITY exception(const exception&) _NOEXCEPT = default; - - virtual ~exception() _NOEXCEPT; - virtual const char* what() const _NOEXCEPT; -}; - -class _LIBCPP_EXCEPTION_ABI bad_exception : public exception { -public: - _LIBCPP_INLINE_VISIBILITY bad_exception() _NOEXCEPT {} - ~bad_exception() _NOEXCEPT override; - const char* what() const _NOEXCEPT override; -}; -#endif // !_LIBCPP_ABI_VCRUNTIME - -#if _LIBCPP_STD_VER <= 14 \ - || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS) \ - || defined(_LIBCPP_BUILDING_LIBRARY) -typedef void (*unexpected_handler)(); -_LIBCPP_FUNC_VIS unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT; -_LIBCPP_FUNC_VIS unexpected_handler get_unexpected() _NOEXCEPT; -_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void unexpected(); -#endif - -typedef void (*terminate_handler)(); -_LIBCPP_FUNC_VIS terminate_handler set_terminate(terminate_handler) _NOEXCEPT; -_LIBCPP_FUNC_VIS terminate_handler get_terminate() _NOEXCEPT; -_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void terminate() _NOEXCEPT; - -_LIBCPP_FUNC_VIS bool uncaught_exception() _NOEXCEPT; -_LIBCPP_FUNC_VIS _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS int uncaught_exceptions() _NOEXCEPT; - -class _LIBCPP_TYPE_VIS exception_ptr; - -_LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT; -_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr); - -#ifndef _LIBCPP_ABI_MICROSOFT - -class _LIBCPP_TYPE_VIS exception_ptr -{ - void* __ptr_; -public: - _LIBCPP_INLINE_VISIBILITY exception_ptr() _NOEXCEPT : __ptr_() {} - _LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {} - - exception_ptr(const exception_ptr&) _NOEXCEPT; - exception_ptr& operator=(const exception_ptr&) _NOEXCEPT; - ~exception_ptr() _NOEXCEPT; - - _LIBCPP_INLINE_VISIBILITY explicit operator bool() const _NOEXCEPT - {return __ptr_ != nullptr;} - - friend _LIBCPP_INLINE_VISIBILITY - bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT - {return __x.__ptr_ == __y.__ptr_;} - - friend _LIBCPP_INLINE_VISIBILITY - bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT - {return !(__x == __y);} - - friend _LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT; - friend _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr); -}; - -template<class _Ep> -_LIBCPP_INLINE_VISIBILITY exception_ptr -make_exception_ptr(_Ep __e) _NOEXCEPT -{ -#ifndef _LIBCPP_NO_EXCEPTIONS - try - { - throw __e; - } - catch (...) - { - return current_exception(); - } -#else - ((void)__e); - _VSTD::abort(); -#endif -} - -#else // _LIBCPP_ABI_MICROSOFT - -class _LIBCPP_TYPE_VIS exception_ptr -{ -_LIBCPP_DIAGNOSTIC_PUSH -_LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wunused-private-field") - void* __ptr1_; - void* __ptr2_; -_LIBCPP_DIAGNOSTIC_POP -public: - exception_ptr() _NOEXCEPT; - exception_ptr(nullptr_t) _NOEXCEPT; - exception_ptr(const exception_ptr& __other) _NOEXCEPT; - exception_ptr& operator=(const exception_ptr& __other) _NOEXCEPT; - exception_ptr& operator=(nullptr_t) _NOEXCEPT; - ~exception_ptr() _NOEXCEPT; - explicit operator bool() const _NOEXCEPT; -}; - -_LIBCPP_FUNC_VIS -bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT; - -inline _LIBCPP_INLINE_VISIBILITY -bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT - {return !(__x == __y);} - -_LIBCPP_FUNC_VIS void swap(exception_ptr&, exception_ptr&) _NOEXCEPT; - -_LIBCPP_FUNC_VIS exception_ptr __copy_exception_ptr(void *__except, const void* __ptr); -_LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT; -_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr); - -// This is a built-in template function which automagically extracts the required -// information. -template <class _E> void *__GetExceptionInfo(_E); - -template<class _Ep> -_LIBCPP_INLINE_VISIBILITY exception_ptr -make_exception_ptr(_Ep __e) _NOEXCEPT -{ - return __copy_exception_ptr(_VSTD::addressof(__e), __GetExceptionInfo(__e)); -} - -#endif // _LIBCPP_ABI_MICROSOFT -// nested_exception - -class _LIBCPP_EXCEPTION_ABI nested_exception -{ - exception_ptr __ptr_; -public: - nested_exception() _NOEXCEPT; -// nested_exception(const nested_exception&) noexcept = default; -// nested_exception& operator=(const nested_exception&) noexcept = default; - virtual ~nested_exception() _NOEXCEPT; - - // access functions - _LIBCPP_NORETURN void rethrow_nested() const; - _LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const _NOEXCEPT {return __ptr_;} -}; - -template <class _Tp> -struct __nested - : public _Tp, - public nested_exception -{ - _LIBCPP_INLINE_VISIBILITY explicit __nested(const _Tp& __t) : _Tp(__t) {} -}; - -#ifndef _LIBCPP_NO_EXCEPTIONS -template <class _Tp, class _Up, bool> -struct __throw_with_nested; - -template <class _Tp, class _Up> -struct __throw_with_nested<_Tp, _Up, true> { - _LIBCPP_NORETURN static inline _LIBCPP_INLINE_VISIBILITY void - __do_throw(_Tp&& __t) - { - throw __nested<_Up>(static_cast<_Tp&&>(__t)); - } -}; - -template <class _Tp, class _Up> -struct __throw_with_nested<_Tp, _Up, false> { - _LIBCPP_NORETURN static inline _LIBCPP_INLINE_VISIBILITY void -#ifndef _LIBCPP_CXX03_LANG - __do_throw(_Tp&& __t) -#else - __do_throw (_Tp& __t) -#endif // _LIBCPP_CXX03_LANG - { - throw static_cast<_Tp&&>(__t); - } -}; -#endif - -template <class _Tp> -_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI -void -throw_with_nested(_Tp&& __t) -{ -#ifndef _LIBCPP_NO_EXCEPTIONS - typedef typename decay<_Tp>::type _Up; - static_assert( is_copy_constructible<_Up>::value, "type thrown must be CopyConstructible"); - __throw_with_nested<_Tp, _Up, - is_class<_Up>::value && - !is_base_of<nested_exception, _Up>::value && - !__libcpp_is_final<_Up>::value>:: - __do_throw(static_cast<_Tp&&>(__t)); -#else - ((void)__t); - // FIXME: Make this abort -#endif -} - -template <class _From, class _To> -struct __can_dynamic_cast : _BoolConstant< - is_polymorphic<_From>::value && - (!is_base_of<_To, _From>::value || - is_convertible<const _From*, const _To*>::value)> {}; - -template <class _Ep> -inline _LIBCPP_INLINE_VISIBILITY -void -rethrow_if_nested(const _Ep& __e, - __enable_if_t< __can_dynamic_cast<_Ep, nested_exception>::value>* = 0) -{ - const nested_exception* __nep = dynamic_cast<const nested_exception*>(_VSTD::addressof(__e)); - if (__nep) - __nep->rethrow_nested(); -} - -template <class _Ep> -inline _LIBCPP_INLINE_VISIBILITY -void -rethrow_if_nested(const _Ep&, - __enable_if_t<!__can_dynamic_cast<_Ep, nested_exception>::value>* = 0) -{ -} - -} // namespace std - #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <cstdlib> # include <type_traits> #endif
diff --git a/third_party/llvm-project/libcxx/include/experimental/__config b/third_party/llvm-project/libcxx/include/experimental/__config index a71b348c..839b80a 100644 --- a/third_party/llvm-project/libcxx/include/experimental/__config +++ b/third_party/llvm-project/libcxx/include/experimental/__config
@@ -32,18 +32,6 @@ #define _LIBCPP_END_NAMESPACE_LFTS_PMR _LIBCPP_END_NAMESPACE_LFTS } #define _VSTD_LFTS_PMR _VSTD_LFTS::pmr -#if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L -#define _LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES -#endif - -#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_COROUTINES \ - _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace coroutines_v1 { - -#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_COROUTINES \ - } _LIBCPP_END_NAMESPACE_EXPERIMENTAL - -#define _VSTD_CORO _VSTD_EXPERIMENTAL::coroutines_v1 - #define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_SIMD \ _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace parallelism_v2 {
diff --git a/third_party/llvm-project/libcxx/include/experimental/__memory b/third_party/llvm-project/libcxx/include/experimental/__memory index b36f31e..b113696 100644 --- a/third_party/llvm-project/libcxx/include/experimental/__memory +++ b/third_party/llvm-project/libcxx/include/experimental/__memory
@@ -12,9 +12,12 @@ #include <__memory/allocator_arg_t.h> #include <__memory/uses_allocator.h> +#include <__type_traits/conditional.h> +#include <__type_traits/is_constructible.h> +#include <__type_traits/is_convertible.h> +#include <__type_traits/is_same.h> #include <experimental/__config> #include <experimental/utility> // for erased_type -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -90,7 +93,7 @@ inline _LIBCPP_INLINE_VISIBILITY void __user_alloc_construct_impl (integral_constant<int, 1>, _Tp *__storage, const _Allocator &__a, _Args &&... __args ) { - new (__storage) _Tp (allocator_arg, __a, _VSTD::forward<_Args>(__args)...); + new (__storage) _Tp (allocator_arg_t(), __a, _VSTD::forward<_Args>(__args)...); } // FIXME: This should have a version which takes a non-const alloc.
diff --git a/third_party/llvm-project/libcxx/include/experimental/algorithm b/third_party/llvm-project/libcxx/include/experimental/algorithm deleted file mode 100644 index e0ca3c7..0000000 --- a/third_party/llvm-project/libcxx/include/experimental/algorithm +++ /dev/null
@@ -1,53 +0,0 @@ -// -*- 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_EXPERIMENTAL_ALGORITHM -#define _LIBCPP_EXPERIMENTAL_ALGORITHM - -/* - experimental/algorithm synopsis - -#include <algorithm> - -namespace std { -namespace experimental { -inline namespace fundamentals_v1 { - -template <class ForwardIterator, class Searcher> -ForwardIterator search(ForwardIterator first, ForwardIterator last, - const Searcher &searcher); - -// sample removed because it's now part of C++17 - -} // namespace fundamentals_v1 -} // namespace experimental -} // namespace std - -*/ - -#include <__assert> // all public C++ headers provide the assertion handler -#include <__debug> -#include <algorithm> -#include <experimental/__config> -#include <type_traits> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_LFTS - -template <class _ForwardIterator, class _Searcher> -_LIBCPP_INLINE_VISIBILITY -_ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher &__s) -{ return __s(__f, __l).first; } - -_LIBCPP_END_NAMESPACE_LFTS - -#endif /* _LIBCPP_EXPERIMENTAL_ALGORITHM */
diff --git a/third_party/llvm-project/libcxx/include/experimental/coroutine b/third_party/llvm-project/libcxx/include/experimental/coroutine deleted file mode 100644 index d9f3685..0000000 --- a/third_party/llvm-project/libcxx/include/experimental/coroutine +++ /dev/null
@@ -1,344 +0,0 @@ -// -*- 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_EXPERIMENTAL_COROUTINE -#define _LIBCPP_EXPERIMENTAL_COROUTINE - -/** - experimental/coroutine synopsis - -// C++next - -namespace std { -namespace experimental { -inline namespace coroutines_v1 { - - // 18.11.1 coroutine traits -template <typename R, typename... ArgTypes> -class coroutine_traits; -// 18.11.2 coroutine handle -template <typename Promise = void> -class coroutine_handle; -// 18.11.2.7 comparison operators: -bool operator==(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT; -bool operator!=(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT; -bool operator<(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT; -bool operator<=(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT; -bool operator>=(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT; -bool operator>(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT; -// 18.11.3 trivial awaitables -struct suspend_never; -struct suspend_always; -// 18.11.2.8 hash support: -template <class T> struct hash; -template <class P> struct hash<coroutine_handle<P>>; - -} // namespace coroutines_v1 -} // namespace experimental -} // namespace std - - */ - -#include <__assert> // all public C++ headers provide the assertion handler -#include <__functional/hash.h> -#include <__functional/operations.h> -#include <cstddef> -#include <experimental/__config> -#include <new> -#include <type_traits> - -#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 -# include <atomic> -# include <climits> -# include <cmath> -# include <compare> -# include <concepts> -# include <ctime> -# include <initializer_list> -# include <iosfwd> -# include <iterator> -# include <memory> -# include <ratio> -# include <stdexcept> -# include <tuple> -# include <typeinfo> -# include <utility> -# include <variant> -#endif - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -#ifndef _LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES - -_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_COROUTINES - -template <class _Tp, class = void> -struct __coroutine_traits_sfinae {}; - -template <class _Tp> -struct __coroutine_traits_sfinae<_Tp, __void_t<typename _Tp::promise_type> > -{ - using promise_type = typename _Tp::promise_type; -}; - -template <typename _Ret, typename... _Args> -struct coroutine_traits - : public __coroutine_traits_sfinae<_Ret> -{ -}; - -template <typename _Promise = void> -class _LIBCPP_TEMPLATE_VIS coroutine_handle; - -template <> -class _LIBCPP_TEMPLATE_VIS coroutine_handle<void> { -public: - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR coroutine_handle() _NOEXCEPT : __handle_(nullptr) {} - - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR coroutine_handle(nullptr_t) _NOEXCEPT : __handle_(nullptr) {} - - _LIBCPP_INLINE_VISIBILITY - coroutine_handle& operator=(nullptr_t) _NOEXCEPT { - __handle_ = nullptr; - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR void* address() const _NOEXCEPT { return __handle_; } - - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR explicit operator bool() const _NOEXCEPT { return __handle_; } - - _LIBCPP_INLINE_VISIBILITY - void operator()() { resume(); } - - _LIBCPP_INLINE_VISIBILITY - void resume() { - _LIBCPP_ASSERT(__is_suspended(), - "resume() can only be called on suspended coroutines"); - _LIBCPP_ASSERT(!done(), - "resume() has undefined behavior when the coroutine is done"); - __builtin_coro_resume(__handle_); - } - - _LIBCPP_INLINE_VISIBILITY - void destroy() { - _LIBCPP_ASSERT(__is_suspended(), - "destroy() can only be called on suspended coroutines"); - __builtin_coro_destroy(__handle_); - } - - _LIBCPP_INLINE_VISIBILITY - bool done() const { - _LIBCPP_ASSERT(__is_suspended(), - "done() can only be called on suspended coroutines"); - return __builtin_coro_done(__handle_); - } - -public: - _LIBCPP_INLINE_VISIBILITY - static coroutine_handle from_address(void* __addr) _NOEXCEPT { - coroutine_handle __tmp; - __tmp.__handle_ = __addr; - return __tmp; - } - - // FIXME: Should from_address(nullptr) be allowed? - _LIBCPP_INLINE_VISIBILITY - static coroutine_handle from_address(nullptr_t) _NOEXCEPT { - return coroutine_handle(nullptr); - } - - template <class _Tp, bool _CallIsValid = false> - static coroutine_handle from_address(_Tp*) { - static_assert(_CallIsValid, - "coroutine_handle<void>::from_address cannot be called with " - "non-void pointers"); - } - -private: - bool __is_suspended() const _NOEXCEPT { - // FIXME actually implement a check for if the coro is suspended. - return __handle_; - } - - template <class _PromiseT> friend class coroutine_handle; - void* __handle_; -}; - -// 18.11.2.7 comparison operators: -inline _LIBCPP_INLINE_VISIBILITY -bool operator==(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT { - return __x.address() == __y.address(); -} -inline _LIBCPP_INLINE_VISIBILITY -bool operator!=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT { - return !(__x == __y); -} -inline _LIBCPP_INLINE_VISIBILITY -bool operator<(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT { - return less<void*>()(__x.address(), __y.address()); -} -inline _LIBCPP_INLINE_VISIBILITY -bool operator>(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT { - return __y < __x; -} -inline _LIBCPP_INLINE_VISIBILITY -bool operator<=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT { - return !(__x > __y); -} -inline _LIBCPP_INLINE_VISIBILITY -bool operator>=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT { - return !(__x < __y); -} - -template <typename _Promise> -class _LIBCPP_TEMPLATE_VIS coroutine_handle : public coroutine_handle<> { - using _Base = coroutine_handle<>; -public: -#ifndef _LIBCPP_CXX03_LANG - // 18.11.2.1 construct/reset - using coroutine_handle<>::coroutine_handle; -#else - _LIBCPP_INLINE_VISIBILITY coroutine_handle() _NOEXCEPT : _Base() {} - _LIBCPP_INLINE_VISIBILITY coroutine_handle(nullptr_t) _NOEXCEPT : _Base(nullptr) {} -#endif - _LIBCPP_INLINE_VISIBILITY - coroutine_handle& operator=(nullptr_t) _NOEXCEPT { - _Base::operator=(nullptr); - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - _Promise& promise() const { - return *static_cast<_Promise*>( - __builtin_coro_promise(this->__handle_, _LIBCPP_ALIGNOF(_Promise), false)); - } - -public: - _LIBCPP_INLINE_VISIBILITY - static coroutine_handle from_address(void* __addr) _NOEXCEPT { - coroutine_handle __tmp; - __tmp.__handle_ = __addr; - return __tmp; - } - - // NOTE: this overload isn't required by the standard but is needed so - // the deleted _Promise* overload doesn't make from_address(nullptr) - // ambiguous. - // FIXME: should from_address work with nullptr? - _LIBCPP_INLINE_VISIBILITY - static coroutine_handle from_address(nullptr_t) _NOEXCEPT { - return coroutine_handle(nullptr); - } - - template <class _Tp, bool _CallIsValid = false> - static coroutine_handle from_address(_Tp*) { - static_assert(_CallIsValid, - "coroutine_handle<promise_type>::from_address cannot be called with " - "non-void pointers"); - } - - template <bool _CallIsValid = false> - static coroutine_handle from_address(_Promise*) { - static_assert(_CallIsValid, - "coroutine_handle<promise_type>::from_address cannot be used with " - "pointers to the coroutine's promise type; use 'from_promise' instead"); - } - - _LIBCPP_INLINE_VISIBILITY - static coroutine_handle from_promise(_Promise& __promise) _NOEXCEPT { - typedef __remove_cv_t<_Promise> _RawPromise; - coroutine_handle __tmp; - __tmp.__handle_ = __builtin_coro_promise( - _VSTD::addressof(const_cast<_RawPromise&>(__promise)), - _LIBCPP_ALIGNOF(_Promise), true); - return __tmp; - } -}; - -#if __has_builtin(__builtin_coro_noop) -struct noop_coroutine_promise {}; - -template <> -class _LIBCPP_TEMPLATE_VIS coroutine_handle<noop_coroutine_promise> - : public coroutine_handle<> { - using _Base = coroutine_handle<>; - using _Promise = noop_coroutine_promise; -public: - - _LIBCPP_INLINE_VISIBILITY - _Promise& promise() const { - return *static_cast<_Promise*>( - __builtin_coro_promise(this->__handle_, _LIBCPP_ALIGNOF(_Promise), false)); - } - - _LIBCPP_CONSTEXPR explicit operator bool() const _NOEXCEPT { return true; } - _LIBCPP_CONSTEXPR bool done() const _NOEXCEPT { return false; } - - _LIBCPP_CONSTEXPR_SINCE_CXX20 void operator()() const _NOEXCEPT {} - _LIBCPP_CONSTEXPR_SINCE_CXX20 void resume() const _NOEXCEPT {} - _LIBCPP_CONSTEXPR_SINCE_CXX20 void destroy() const _NOEXCEPT {} - -private: - _LIBCPP_INLINE_VISIBILITY - friend coroutine_handle<noop_coroutine_promise> noop_coroutine() _NOEXCEPT; - - _LIBCPP_INLINE_VISIBILITY coroutine_handle() _NOEXCEPT { - this->__handle_ = __builtin_coro_noop(); - } -}; - -using noop_coroutine_handle = coroutine_handle<noop_coroutine_promise>; - -inline _LIBCPP_INLINE_VISIBILITY -noop_coroutine_handle noop_coroutine() _NOEXCEPT { - return noop_coroutine_handle(); -} -#endif // __has_builtin(__builtin_coro_noop) - -struct suspend_never { - _LIBCPP_INLINE_VISIBILITY - bool await_ready() const _NOEXCEPT { return true; } - _LIBCPP_INLINE_VISIBILITY - void await_suspend(coroutine_handle<>) const _NOEXCEPT {} - _LIBCPP_INLINE_VISIBILITY - void await_resume() const _NOEXCEPT {} -}; - -struct suspend_always { - _LIBCPP_INLINE_VISIBILITY - bool await_ready() const _NOEXCEPT { return false; } - _LIBCPP_INLINE_VISIBILITY - void await_suspend(coroutine_handle<>) const _NOEXCEPT {} - _LIBCPP_INLINE_VISIBILITY - void await_resume() const _NOEXCEPT {} -}; - -_LIBCPP_END_NAMESPACE_EXPERIMENTAL_COROUTINES - -_LIBCPP_BEGIN_NAMESPACE_STD - -template <class _Tp> -struct hash<_VSTD_CORO::coroutine_handle<_Tp> > { - using __arg_type = _VSTD_CORO::coroutine_handle<_Tp>; - _LIBCPP_INLINE_VISIBILITY - size_t operator()(__arg_type const& __v) const _NOEXCEPT - {return hash<void*>()(__v.address());} -}; - -_LIBCPP_END_NAMESPACE_STD - -#endif // !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_COROUTINES) - -#endif /* _LIBCPP_EXPERIMENTAL_COROUTINE */
diff --git a/third_party/llvm-project/libcxx/include/experimental/functional b/third_party/llvm-project/libcxx/include/experimental/functional deleted file mode 100644 index cb9a5ef..0000000 --- a/third_party/llvm-project/libcxx/include/experimental/functional +++ /dev/null
@@ -1,436 +0,0 @@ -// -*- 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_EXPERIMENTAL_FUNCTIONAL -#define _LIBCPP_EXPERIMENTAL_FUNCTIONAL - -/* - experimental/functional synopsis - -#include <algorithm> - -namespace std { -namespace experimental { -inline namespace fundamentals_v1 { - // 4.3, Searchers - template<class ForwardIterator, class BinaryPredicate = equal_to<>> - class default_searcher; - - template<class RandomAccessIterator, - class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>, - class BinaryPredicate = equal_to<>> - class boyer_moore_searcher; - - template<class RandomAccessIterator, - class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>, - class BinaryPredicate = equal_to<>> - class boyer_moore_horspool_searcher; - - template<class ForwardIterator, class BinaryPredicate = equal_to<>> - default_searcher<ForwardIterator, BinaryPredicate> - make_default_searcher(ForwardIterator pat_first, ForwardIterator pat_last, - BinaryPredicate pred = BinaryPredicate()); - - template<class RandomAccessIterator, - class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>, - class BinaryPredicate = equal_to<>> - boyer_moore_searcher<RandomAccessIterator, Hash, BinaryPredicate> - make_boyer_moore_searcher( - RandomAccessIterator pat_first, RandomAccessIterator pat_last, - Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate()); - - template<class RandomAccessIterator, - class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>, - class BinaryPredicate = equal_to<>> - boyer_moore_horspool_searcher<RandomAccessIterator, Hash, BinaryPredicate> - make_boyer_moore_horspool_searcher( - RandomAccessIterator pat_first, RandomAccessIterator pat_last, - Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate()); - - } // namespace fundamentals_v1 - } // namespace experimental - -} // namespace std - -*/ - -#include <__assert> // all public C++ headers provide the assertion handler -#include <__debug> -#include <__functional/identity.h> -#include <__memory/uses_allocator.h> -#include <array> -#include <experimental/__config> -#include <functional> -#include <type_traits> -#include <unordered_map> -#include <vector> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_LFTS - -#ifdef _LIBCPP_NO_EXPERIMENTAL_DEPRECATION_WARNING_SEARCHERS -# define _LIBCPP_DEPRECATED_DEFAULT_SEARCHER -# define _LIBCPP_DEPRECATED_BOYER_MOORE_SEARCHER -# define _LIBCPP_DEPRECATED_BOYER_MOORE_HORSPOOL_SEARCHER -#else -# define _LIBCPP_DEPRECATED_DEFAULT_SEARCHER _LIBCPP_DEPRECATED_("std::experimental::default_searcher will be removed in LLVM 17. Use std::default_searcher instead") -# define _LIBCPP_DEPRECATED_BOYER_MOORE_SEARCHER _LIBCPP_DEPRECATED_("std::experimental::boyer_moore_searcher will be removed in LLVM 17. Use std::boyer_moore_searcher instead") -# define _LIBCPP_DEPRECATED_BOYER_MOORE_HORSPOOL_SEARCHER _LIBCPP_DEPRECATED_("std::experimental::boyer_moore_horspool_searcher will be removed in LLVM 17. Use std::boyer_moore_horspool_searcher instead") -#endif - -#if _LIBCPP_STD_VER > 11 -// default searcher -template<class _ForwardIterator, class _BinaryPredicate = equal_to<>> -class _LIBCPP_DEPRECATED_DEFAULT_SEARCHER _LIBCPP_TEMPLATE_VIS default_searcher { -public: - _LIBCPP_INLINE_VISIBILITY - default_searcher(_ForwardIterator __f, _ForwardIterator __l, - _BinaryPredicate __p = _BinaryPredicate()) - : __first_(__f), __last_(__l), __pred_(__p) {} - - template <typename _ForwardIterator2> - _LIBCPP_INLINE_VISIBILITY - pair<_ForwardIterator2, _ForwardIterator2> - operator () (_ForwardIterator2 __f, _ForwardIterator2 __l) const - { - auto __proj = __identity(); - return std::__search_impl(__f, __l, __first_, __last_, __pred_, __proj, __proj); - } - -private: - _ForwardIterator __first_; - _ForwardIterator __last_; - _BinaryPredicate __pred_; - }; - -template<class _ForwardIterator, class _BinaryPredicate = equal_to<>> -_LIBCPP_DEPRECATED_DEFAULT_SEARCHER _LIBCPP_INLINE_VISIBILITY -default_searcher<_ForwardIterator, _BinaryPredicate> -make_default_searcher( _ForwardIterator __f, _ForwardIterator __l, _BinaryPredicate __p = _BinaryPredicate ()) -{ - return default_searcher<_ForwardIterator, _BinaryPredicate>(__f, __l, __p); -} - -template<class _Key, class _Value, class _Hash, class _BinaryPredicate, bool /*useArray*/> class _BMSkipTable; - -// General case for BM data searching; use a map -template<class _Key, typename _Value, class _Hash, class _BinaryPredicate> -class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, false> { - typedef _Value value_type; - typedef _Key key_type; - - const _Value __default_value_; - std::unordered_map<_Key, _Value, _Hash, _BinaryPredicate> __table_; - -public: - _LIBCPP_INLINE_VISIBILITY - _BMSkipTable(size_t __sz, _Value __default, _Hash __hf, _BinaryPredicate __pred) - : __default_value_(__default), __table_(__sz, __hf, __pred) {} - - _LIBCPP_INLINE_VISIBILITY - void insert(const key_type &__key, value_type __val) - { - __table_ [__key] = __val; // Would skip_.insert (val) be better here? - } - - _LIBCPP_INLINE_VISIBILITY - value_type operator [](const key_type & __key) const - { - auto __it = __table_.find (__key); - return __it == __table_.end() ? __default_value_ : __it->second; - } -}; - - -// Special case small numeric values; use an array -template<class _Key, typename _Value, class _Hash, class _BinaryPredicate> -class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, true> { -private: - typedef _Value value_type; - typedef _Key key_type; - - typedef __make_unsigned_t<key_type> unsigned_key_type; - typedef std::array<value_type, 256> skip_map; - skip_map __table_; - -public: - _LIBCPP_INLINE_VISIBILITY - _BMSkipTable(size_t /*__sz*/, _Value __default, _Hash /*__hf*/, _BinaryPredicate /*__pred*/) - { - std::fill_n(__table_.begin(), __table_.size(), __default); - } - - _LIBCPP_INLINE_VISIBILITY - void insert(key_type __key, value_type __val) - { - __table_[static_cast<unsigned_key_type>(__key)] = __val; - } - - _LIBCPP_INLINE_VISIBILITY - value_type operator [](key_type __key) const - { - return __table_[static_cast<unsigned_key_type>(__key)]; - } -}; - - -template <class _RandomAccessIterator1, - class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>, - class _BinaryPredicate = equal_to<>> -class _LIBCPP_DEPRECATED_BOYER_MOORE_SEARCHER _LIBCPP_TEMPLATE_VIS boyer_moore_searcher { -private: - typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type difference_type; - typedef typename std::iterator_traits<_RandomAccessIterator1>::value_type value_type; - typedef _BMSkipTable<value_type, difference_type, _Hash, _BinaryPredicate, - is_integral<value_type>::value && // what about enums? - sizeof(value_type) == 1 && - is_same<_Hash, hash<value_type>>::value && - is_same<_BinaryPredicate, equal_to<>>::value - > skip_table_type; - -public: - boyer_moore_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l, - _Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate()) - : __first_(__f), __last_(__l), __pred_(__pred), - __pattern_length_(_VSTD::distance(__first_, __last_)), - __skip_{std::make_shared<skip_table_type>(__pattern_length_, -1, __hf, __pred_)}, - __suffix_{std::make_shared<vector<difference_type>>(__pattern_length_ + 1)} - { - // build the skip table - for ( difference_type __i = 0; __f != __l; ++__f, (void) ++__i ) - __skip_->insert(*__f, __i); - - this->__build_suffix_table ( __first_, __last_, __pred_ ); - } - - template <typename _RandomAccessIterator2> - pair<_RandomAccessIterator2, _RandomAccessIterator2> - operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const - { - static_assert(__is_same_uncvref<typename iterator_traits<_RandomAccessIterator1>::value_type, - typename iterator_traits<_RandomAccessIterator2>::value_type>::value, - "Corpus and Pattern iterators must point to the same type"); - - if (__f == __l ) return std::make_pair(__l, __l); // empty corpus - if (__first_ == __last_) return std::make_pair(__f, __f); // empty pattern - - // If the pattern is larger than the corpus, we can't find it! - if ( __pattern_length_ > _VSTD::distance(__f, __l)) - return std::make_pair(__l, __l); - - // Do the search - return this->__search(__f, __l); - } - -private: - _RandomAccessIterator1 __first_; - _RandomAccessIterator1 __last_; - _BinaryPredicate __pred_; - difference_type __pattern_length_; - shared_ptr<skip_table_type> __skip_; - shared_ptr<vector<difference_type>> __suffix_; - - template <typename _RandomAccessIterator2> - pair<_RandomAccessIterator2, _RandomAccessIterator2> - __search(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const - { - _RandomAccessIterator2 __cur = __f; - const _RandomAccessIterator2 __last = __l - __pattern_length_; - const skip_table_type & __skip = *__skip_.get(); - const vector<difference_type> & __suffix = *__suffix_.get(); - - while (__cur <= __last) - { - - // Do we match right where we are? - difference_type __j = __pattern_length_; - while (__pred_(__first_ [__j-1], __cur [__j-1])) { - __j--; - // We matched - we're done! - if ( __j == 0 ) - return std::make_pair(__cur, __cur + __pattern_length_); - } - - // Since we didn't match, figure out how far to skip forward - difference_type __k = __skip[__cur [ __j - 1 ]]; - difference_type __m = __j - __k - 1; - if (__k < __j && __m > __suffix[ __j ]) - __cur += __m; - else - __cur += __suffix[ __j ]; - } - - return std::make_pair(__l, __l); // We didn't find anything - } - - - template<typename _Iterator, typename _Container> - void __compute_bm_prefix ( _Iterator __f, _Iterator __l, _BinaryPredicate __pred, _Container &__prefix ) - { - const size_t __count = _VSTD::distance(__f, __l); - - __prefix[0] = 0; - size_t __k = 0; - for ( size_t __i = 1; __i < __count; ++__i ) - { - while ( __k > 0 && !__pred ( __f[__k], __f[__i] )) - __k = __prefix [ __k - 1 ]; - - if ( __pred ( __f[__k], __f[__i] )) - __k++; - __prefix [ __i ] = __k; - } - } - - void __build_suffix_table(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l, - _BinaryPredicate __pred) - { - const size_t __count = _VSTD::distance(__f, __l); - vector<difference_type> & __suffix = *__suffix_.get(); - if (__count > 0) - { - vector<difference_type> __scratch(__count); - - __compute_bm_prefix(__f, __l, __pred, __scratch); - for ( size_t __i = 0; __i <= __count; __i++ ) - __suffix[__i] = __count - __scratch[__count-1]; - - typedef reverse_iterator<_RandomAccessIterator1> _RevIter; - __compute_bm_prefix(_RevIter(__l), _RevIter(__f), __pred, __scratch); - - for ( size_t __i = 0; __i < __count; __i++ ) - { - const size_t __j = __count - __scratch[__i]; - const difference_type __k = __i - __scratch[__i] + 1; - - if (__suffix[__j] > __k) - __suffix[__j] = __k; - } - } - } - -}; - -template<class _RandomAccessIterator, - class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>, - class _BinaryPredicate = equal_to<>> -_LIBCPP_DEPRECATED_BOYER_MOORE_SEARCHER _LIBCPP_INLINE_VISIBILITY -boyer_moore_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate> -make_boyer_moore_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l, - _Hash __hf = _Hash(), _BinaryPredicate __p = _BinaryPredicate ()) -{ - return boyer_moore_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>(__f, __l, __hf, __p); -} - -// boyer-moore-horspool -template <class _RandomAccessIterator1, - class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>, - class _BinaryPredicate = equal_to<>> -class _LIBCPP_DEPRECATED_BOYER_MOORE_HORSPOOL_SEARCHER _LIBCPP_TEMPLATE_VIS boyer_moore_horspool_searcher { -private: - typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type difference_type; - typedef typename std::iterator_traits<_RandomAccessIterator1>::value_type value_type; - typedef _BMSkipTable<value_type, difference_type, _Hash, _BinaryPredicate, - is_integral<value_type>::value && // what about enums? - sizeof(value_type) == 1 && - is_same<_Hash, hash<value_type>>::value && - is_same<_BinaryPredicate, equal_to<>>::value - > skip_table_type; - -public: - boyer_moore_horspool_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l, - _Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate()) - : __first_(__f), __last_(__l), __pred_(__pred), - __pattern_length_(_VSTD::distance(__first_, __last_)), - __skip_{_VSTD::make_shared<skip_table_type>(__pattern_length_, __pattern_length_, __hf, __pred_)} - { - // build the skip table - if ( __f != __l ) - { - __l = __l - 1; - for ( difference_type __i = 0; __f != __l; ++__f, (void) ++__i ) - __skip_->insert(*__f, __pattern_length_ - 1 - __i); - } - } - - template <typename _RandomAccessIterator2> - pair<_RandomAccessIterator2, _RandomAccessIterator2> - operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const - { - static_assert(__is_same_uncvref<typename std::iterator_traits<_RandomAccessIterator1>::value_type, - typename std::iterator_traits<_RandomAccessIterator2>::value_type>::value, - "Corpus and Pattern iterators must point to the same type"); - - if (__f == __l ) return std::make_pair(__l, __l); // empty corpus - if (__first_ == __last_) return std::make_pair(__f, __f); // empty pattern - - // If the pattern is larger than the corpus, we can't find it! - if ( __pattern_length_ > _VSTD::distance(__f, __l)) - return std::make_pair(__l, __l); - - // Do the search - return this->__search(__f, __l); - } - -private: - _RandomAccessIterator1 __first_; - _RandomAccessIterator1 __last_; - _BinaryPredicate __pred_; - difference_type __pattern_length_; - shared_ptr<skip_table_type> __skip_; - - template <typename _RandomAccessIterator2> - pair<_RandomAccessIterator2, _RandomAccessIterator2> - __search ( _RandomAccessIterator2 __f, _RandomAccessIterator2 __l ) const { - _RandomAccessIterator2 __cur = __f; - const _RandomAccessIterator2 __last = __l - __pattern_length_; - const skip_table_type & __skip = *__skip_.get(); - - while (__cur <= __last) - { - // Do we match right where we are? - difference_type __j = __pattern_length_; - while (__pred_(__first_[__j-1], __cur[__j-1])) - { - __j--; - // We matched - we're done! - if ( __j == 0 ) - return std::make_pair(__cur, __cur + __pattern_length_); - } - __cur += __skip[__cur[__pattern_length_-1]]; - } - - return std::make_pair(__l, __l); - } -}; - -template<class _RandomAccessIterator, - class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>, - class _BinaryPredicate = equal_to<>> -_LIBCPP_DEPRECATED_BOYER_MOORE_HORSPOOL_SEARCHER _LIBCPP_INLINE_VISIBILITY -boyer_moore_horspool_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate> -make_boyer_moore_horspool_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l, - _Hash __hf = _Hash(), _BinaryPredicate __p = _BinaryPredicate ()) -{ - return boyer_moore_horspool_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>(__f, __l, __hf, __p); -} - -#endif // _LIBCPP_STD_VER > 11 - -_LIBCPP_END_NAMESPACE_LFTS - -_LIBCPP_POP_MACROS - -#endif /* _LIBCPP_EXPERIMENTAL_FUNCTIONAL */
diff --git a/third_party/llvm-project/libcxx/include/experimental/iterator b/third_party/llvm-project/libcxx/include/experimental/iterator index cf73b74..e47314a 100644 --- a/third_party/llvm-project/libcxx/include/experimental/iterator +++ b/third_party/llvm-project/libcxx/include/experimental/iterator
@@ -65,7 +65,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 _LIBCPP_BEGIN_NAMESPACE_LFTS @@ -111,13 +111,13 @@ template <class _CharT, class _Traits, class _Delim> -_LIBCPP_HIDE_FROM_ABI ostream_joiner<typename decay<_Delim>::type, _CharT, _Traits> +_LIBCPP_HIDE_FROM_ABI ostream_joiner<__decay_t<_Delim>, _CharT, _Traits> make_ostream_joiner(basic_ostream<_CharT, _Traits>& __os, _Delim && __d) -{ return ostream_joiner<typename decay<_Delim>::type, _CharT, _Traits>(__os, _VSTD::forward<_Delim>(__d)); } +{ return ostream_joiner<__decay_t<_Delim>, _CharT, _Traits>(__os, _VSTD::forward<_Delim>(__d)); } _LIBCPP_END_NAMESPACE_LFTS -#endif // _LIBCPP_STD_VER > 11 +#endif // _LIBCPP_STD_VER >= 14 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <type_traits>
diff --git a/third_party/llvm-project/libcxx/include/experimental/memory_resource b/third_party/llvm-project/libcxx/include/experimental/memory_resource index f107f10..dcb61e3 100644 --- a/third_party/llvm-project/libcxx/include/experimental/memory_resource +++ b/third_party/llvm-project/libcxx/include/experimental/memory_resource
@@ -66,16 +66,15 @@ #include <__assert> // all public C++ headers provide the assertion handler #include <__memory/allocator_traits.h> +#include <__type_traits/aligned_storage.h> #include <__utility/move.h> #include <cstddef> -#include <cstdlib> #include <experimental/__config> #include <experimental/__memory> #include <limits> #include <new> #include <stdexcept> #include <tuple> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -432,11 +431,13 @@ # include <atomic> # include <climits> # include <concepts> +# include <cstdlib> # include <cstring> # include <ctime> # include <iterator> # include <memory> # include <ratio> +# include <type_traits> # include <variant> #endif
diff --git a/third_party/llvm-project/libcxx/include/experimental/propagate_const b/third_party/llvm-project/libcxx/include/experimental/propagate_const index 34e917d..3efec5d 100644 --- a/third_party/llvm-project/libcxx/include/experimental/propagate_const +++ b/third_party/llvm-project/libcxx/include/experimental/propagate_const
@@ -110,17 +110,32 @@ #include <__assert> // all public C++ headers provide the assertion handler #include <__functional/operations.h> #include <__fwd/hash.h> +#include <__type_traits/conditional.h> +#include <__type_traits/decay.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/is_array.h> +#include <__type_traits/is_constructible.h> +#include <__type_traits/is_convertible.h> +#include <__type_traits/is_function.h> +#include <__type_traits/is_pointer.h> +#include <__type_traits/is_reference.h> +#include <__type_traits/is_same.h> +#include <__type_traits/is_swappable.h> +#include <__type_traits/remove_cv.h> +#include <__type_traits/remove_pointer.h> +#include <__type_traits/remove_reference.h> +#include <__utility/declval.h> #include <__utility/forward.h> #include <__utility/move.h> #include <__utility/swap.h> +#include <cstddef> #include <experimental/__config> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 _LIBCPP_BEGIN_NAMESPACE_LFTS_V2 @@ -577,5 +592,10 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 11 +#endif // _LIBCPP_STD_VER >= 14 + +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <type_traits> +#endif + #endif // _LIBCPP_EXPERIMENTAL_PROPAGATE_CONST
diff --git a/third_party/llvm-project/libcxx/include/experimental/type_traits b/third_party/llvm-project/libcxx/include/experimental/type_traits index dd4c539..d1cc2e5 100644 --- a/third_party/llvm-project/libcxx/include/experimental/type_traits +++ b/third_party/llvm-project/libcxx/include/experimental/type_traits
@@ -71,7 +71,7 @@ #include <__assert> // all public C++ headers provide the assertion handler #include <experimental/__config> -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 #include <initializer_list> #include <type_traits> @@ -150,6 +150,6 @@ _LIBCPP_END_NAMESPACE_LFTS -#endif /* _LIBCPP_STD_VER > 11 */ +#endif /* _LIBCPP_STD_VER >= 14 */ #endif /* _LIBCPP_EXPERIMENTAL_TYPE_TRAITS */
diff --git a/third_party/llvm-project/libcxx/include/ext/hash_map b/third_party/llvm-project/libcxx/include/ext/hash_map index 3ad4b16..f7f53bc 100644 --- a/third_party/llvm-project/libcxx/include/ext/hash_map +++ b/third_party/llvm-project/libcxx/include/ext/hash_map
@@ -208,7 +208,6 @@ #include <ext/__hash> #include <functional> #include <stdexcept> -#include <type_traits> #if defined(__DEPRECATED) && __DEPRECATED #if defined(_LIBCPP_WARNING) @@ -985,6 +984,7 @@ #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <concepts> # include <iterator> +# include <type_traits> #endif #endif // _LIBCPP_HASH_MAP
diff --git a/third_party/llvm-project/libcxx/include/ext/hash_set b/third_party/llvm-project/libcxx/include/ext/hash_set index dc8b786..9c67862 100644 --- a/third_party/llvm-project/libcxx/include/ext/hash_set +++ b/third_party/llvm-project/libcxx/include/ext/hash_set
@@ -665,6 +665,7 @@ #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <concepts> # include <iterator> +# include <type_traits> #endif #endif // _LIBCPP_HASH_SET
diff --git a/third_party/llvm-project/libcxx/include/filesystem b/third_party/llvm-project/libcxx/include/filesystem index 7efa4ed..b10555d 100644 --- a/third_party/llvm-project/libcxx/include/filesystem +++ b/third_party/llvm-project/libcxx/include/filesystem
@@ -159,6 +159,9 @@ void swap(path& lhs, path& rhs) noexcept; size_t hash_value(const path& p) noexcept; + // [fs.path.hash], hash support + template<> struct hash<filesystem::path>; + template <class Source> path u8path(const Source& source); template <class InputIterator> @@ -464,6 +467,8 @@ #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <concepts> +# include <cstdlib> +# include <system_error> #endif #endif // _LIBCPP_FILESYSTEM
diff --git a/third_party/llvm-project/libcxx/include/forward_list b/third_party/llvm-project/libcxx/include/forward_list index 61dde81..ad616d1 100644 --- a/third_party/llvm-project/libcxx/include/forward_list +++ b/third_party/llvm-project/libcxx/include/forward_list
@@ -146,23 +146,27 @@ template <class T, class Allocator> bool operator< (const forward_list<T, Allocator>& x, - const forward_list<T, Allocator>& y); + const forward_list<T, Allocator>& y); // removed in C++20 template <class T, class Allocator> bool operator!=(const forward_list<T, Allocator>& x, - const forward_list<T, Allocator>& y); + const forward_list<T, Allocator>& y); // removed in C++20 template <class T, class Allocator> bool operator> (const forward_list<T, Allocator>& x, - const forward_list<T, Allocator>& y); + const forward_list<T, Allocator>& y); // removed in C++20 template <class T, class Allocator> bool operator>=(const forward_list<T, Allocator>& x, - const forward_list<T, Allocator>& y); + const forward_list<T, Allocator>& y); // removed in C++20 template <class T, class Allocator> bool operator<=(const forward_list<T, Allocator>& x, - const forward_list<T, Allocator>& y); + const forward_list<T, Allocator>& y); // removed in C++20 + +template<class T, class Allocator> + synth-three-way-result<T> operator<=>(const forward_list<T, Allocator>& x, + const forward_list<T, Allocator>& y); // since C++20 template <class T, class Allocator> void swap(forward_list<T, Allocator>& x, forward_list<T, Allocator>& y) @@ -181,6 +185,7 @@ #include <__algorithm/comp.h> #include <__algorithm/lexicographical_compare.h> +#include <__algorithm/lexicographical_compare_three_way.h> #include <__algorithm/min.h> #include <__assert> // all public C++ headers provide the assertion handler #include <__config> @@ -197,11 +202,18 @@ #include <__memory/swap_allocator.h> #include <__memory/unique_ptr.h> #include <__memory_resource/polymorphic_allocator.h> +#include <__type_traits/conditional.h> #include <__type_traits/is_allocator.h> +#include <__type_traits/is_const.h> +#include <__type_traits/is_nothrow_default_constructible.h> +#include <__type_traits/is_nothrow_move_assignable.h> +#include <__type_traits/is_nothrow_move_constructible.h> +#include <__type_traits/is_pointer.h> +#include <__type_traits/is_same.h> +#include <__type_traits/type_identity.h> #include <__utility/forward.h> #include <__utility/move.h> #include <limits> -#include <type_traits> #include <version> // standard-mandated includes @@ -482,14 +494,6 @@ typedef typename allocator_traits<__begin_node_allocator>::pointer __begin_node_pointer; - static_assert((!is_same<allocator_type, __node_allocator>::value), - "internal allocator type must differ from user-specified " - "type; otherwise overload resolution breaks"); - - static_assert(is_same<allocator_type, __rebind_alloc<__node_traits, value_type> >::value, - "[allocator.requirements] states that rebinding an allocator to the same type should result in the " - "original allocator"); - __compressed_pair<__begin_node, __node_allocator> __before_begin_; _LIBCPP_INLINE_VISIBILITY @@ -659,9 +663,17 @@ typedef _Tp value_type; typedef _Alloc allocator_type; - static_assert((is_same<typename allocator_type::value_type, value_type>::value), + static_assert(is_same<value_type, typename allocator_type::value_type>::value, "Allocator::value_type must be same type as value_type"); + static_assert(is_same<allocator_type, __rebind_alloc<allocator_traits<allocator_type>, value_type> >::value, + "[allocator.requirements] states that rebinding an allocator to the same type should result in the " + "original allocator"); + + static_assert((!is_same<allocator_type, __node_allocator>::value), + "internal allocator type must differ from user-specified " + "type; otherwise overload resolution breaks"); + typedef value_type& reference; typedef const value_type& const_reference; typedef typename allocator_traits<allocator_type>::pointer pointer; @@ -671,7 +683,7 @@ typedef typename base::iterator iterator; typedef typename base::const_iterator const_iterator; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 typedef size_type __remove_return_type; #else typedef void __remove_return_type; @@ -684,7 +696,7 @@ _LIBCPP_INLINE_VISIBILITY explicit forward_list(const allocator_type& __a); explicit forward_list(size_type __n); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 explicit forward_list(size_type __n, const allocator_type& __a); #endif forward_list(size_type __n, const value_type& __v); @@ -787,7 +799,7 @@ const_reference front() const {return base::__before_begin()->__next_->__value_;} #ifndef _LIBCPP_CXX03_LANG -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class... _Args> reference emplace_front(_Args&&... __args); #else template <class... _Args> void emplace_front(_Args&&... __args); @@ -927,7 +939,7 @@ } } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp, class _Alloc> forward_list<_Tp, _Alloc>::forward_list(size_type __n, const allocator_type& __base_alloc) @@ -1119,7 +1131,7 @@ template <class _Tp, class _Alloc> template <class... _Args> -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 typename forward_list<_Tp, _Alloc>::reference #else void @@ -1133,7 +1145,7 @@ _VSTD::forward<_Args>(__args)...); __h->__next_ = base::__before_begin()->__next_; base::__before_begin()->__next_ = __h.release(); -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 return base::__before_begin()->__next_->__value_; #endif } @@ -1237,17 +1249,17 @@ __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v); __node_pointer __first = __h.release(); __node_pointer __last = __first; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS for (--__n; __n != 0; --__n, __last = __last->__next_) { __h.reset(__node_traits::allocate(__a, 1)); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v); __last->__next_ = __h.release(); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -1260,7 +1272,7 @@ } throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __last->__next_ = __r->__next_; __r->__next_ = __first; __r = static_cast<__begin_node_pointer>(__last); @@ -1283,17 +1295,17 @@ __node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f); __node_pointer __first = __h.release(); __node_pointer __last = __first; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS for (++__f; __f != __l; ++__f, ((void)(__last = __last->__next_))) { __h.reset(__node_traits::allocate(__a, 1)); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f); __last->__next_ = __h.release(); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -1306,7 +1318,7 @@ } throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __last->__next_ = __r->__next_; __r->__next_ = __first; __r = static_cast<__begin_node_pointer>(__last); @@ -1711,6 +1723,8 @@ return (__ix == __ex) == (__iy == __ey); } +#if _LIBCPP_STD_VER <= 17 + template <class _Tp, class _Alloc> inline _LIBCPP_INLINE_VISIBILITY bool operator!=(const forward_list<_Tp, _Alloc>& __x, @@ -1752,6 +1766,20 @@ return !(__y < __x); } +#else // #if _LIBCPP_STD_VER <= 17 + +template<class _Tp, class _Allocator> +inline _LIBCPP_HIDE_FROM_ABI +__synth_three_way_result<_Tp> +operator<=>(const forward_list<_Tp, _Allocator>& __x, + const forward_list<_Tp, _Allocator>& __y) +{ + return std::lexicographical_compare_three_way( + __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>); +} + +#endif // #if _LIBCPP_STD_VER <= 17 + template <class _Tp, class _Alloc> inline _LIBCPP_INLINE_VISIBILITY void @@ -1761,7 +1789,7 @@ __x.swap(__y); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Tp, class _Allocator, class _Predicate> inline _LIBCPP_INLINE_VISIBILITY typename forward_list<_Tp, _Allocator>::size_type @@ -1779,7 +1807,7 @@ _LIBCPP_END_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD namespace pmr { template <class _ValueT> @@ -1794,9 +1822,11 @@ # include <algorithm> # include <atomic> # include <concepts> +# include <cstdlib> # include <functional> # include <iosfwd> # include <iterator> +# include <type_traits> # include <typeinfo> #endif
diff --git a/third_party/llvm-project/libcxx/include/fstream b/third_party/llvm-project/libcxx/include/fstream index 41e95bf..09deccf 100644 --- a/third_party/llvm-project/libcxx/include/fstream +++ b/third_party/llvm-project/libcxx/include/fstream
@@ -188,8 +188,6 @@ #include <__utility/swap.h> #include <__utility/unreachable.h> #include <cstdio> -#include <cstdlib> -#include <cstring> #include <istream> #include <ostream> #include <typeinfo> @@ -398,17 +396,17 @@ template <class _CharT, class _Traits> basic_filebuf<_CharT, _Traits>::~basic_filebuf() { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS close(); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS if (__owns_eb_) delete [] __extbuf_; if (__owns_ib_) @@ -1753,6 +1751,7 @@ #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <atomic> # include <concepts> +# include <cstdlib> # include <iosfwd> # include <limits> # include <new>
diff --git a/third_party/llvm-project/libcxx/include/functional b/third_party/llvm-project/libcxx/include/functional index 8589d3a..05d42fc 100644 --- a/third_party/llvm-project/libcxx/include/functional +++ b/third_party/llvm-project/libcxx/include/functional
@@ -43,20 +43,22 @@ // construct/copy/destroy template<class U> - reference_wrapper(U&&); - reference_wrapper(const reference_wrapper<T>& x) noexcept; + constexpr reference_wrapper(U&&); // constexpr since C++20 + constexpr reference_wrapper(const reference_wrapper<T>& x) noexcept; // constexpr since C++20 // assignment - reference_wrapper& operator=(const reference_wrapper<T>& x) noexcept; + constexpr reference_wrapper& + operator=(const reference_wrapper<T>& x) noexcept; // constexpr since C++20 // access - operator T& () const noexcept; - T& get() const noexcept; + constexpr operator T& () const noexcept; // constexpr since C++20 + constexpr T& get() const noexcept; // constexpr since C++20 // invoke template <class... ArgTypes> - typename result_of<T&(ArgTypes&&...)>::type - operator() (ArgTypes&&...) const; + constexpr typename result_of<T&(ArgTypes&&...)>::type // constexpr since C++20 + operator() (ArgTypes&&...) const + noexcept(is_nothrow_invocable_v<T&, ArgTypes...>); // noexcept since C++17 }; template <class T> @@ -220,11 +222,16 @@ template<class R, class Fn, class... BoundArgs> constexpr unspecified bind(Fn&&, BoundArgs&&...); // constexpr in C++20 +// [func.invoke] template<class F, class... Args> constexpr // constexpr in C++20 invoke_result_t<F, Args...> invoke(F&& f, Args&&... args) // C++17 noexcept(is_nothrow_invocable_v<F, Args...>); +template<class R, class F, class... Args> + constexpr R invoke_r(F&& f, Args&&... args) // C++23 + noexcept(is_nothrow_invocable_r_v<R, F, Args...>); + namespace placeholders { // M is the implementation-defined number of placeholders extern unspecified _1; @@ -250,10 +257,10 @@ }; template <class Operation, class T> -binder1st<Operation> bind1st(const Operation& op, const T& x); // deprecated in C++11, removed in C++17 +binder1st<Operation> bind1st(const Operation& op, const T& x); // deprecated in C++11, removed in C++17 template <class Operation> -class binder2nd // deprecated in C++11, removed in C++17 +class binder2nd // deprecated in C++11, removed in C++17 : public unary_function<typename Operation::first_argument_type, typename Operation::result_type> { @@ -267,9 +274,9 @@ }; template <class Operation, class T> -binder2nd<Operation> bind2nd(const Operation& op, const T& x); // deprecated in C++11, removed in C++17 +binder2nd<Operation> bind2nd(const Operation& op, const T& x); // deprecated in C++11, removed in C++17 -template <class Arg, class Result> // deprecated in C++11, removed in C++17 +template <class Arg, class Result> // deprecated in C++11, removed in C++17 class pointer_to_unary_function : public unary_function<Arg, Result> { public: @@ -278,9 +285,9 @@ }; template <class Arg, class Result> -pointer_to_unary_function<Arg,Result> ptr_fun(Result (*f)(Arg)); // deprecated in C++11, removed in C++17 +pointer_to_unary_function<Arg,Result> ptr_fun(Result (*f)(Arg)); // deprecated in C++11, removed in C++17 -template <class Arg1, class Arg2, class Result> // deprecated in C++11, removed in C++17 +template <class Arg1, class Arg2, class Result> // deprecated in C++11, removed in C++17 class pointer_to_binary_function : public binary_function<Arg1, Arg2, Result> { public: @@ -289,9 +296,9 @@ }; template <class Arg1, class Arg2, class Result> -pointer_to_binary_function<Arg1,Arg2,Result> ptr_fun(Result (*f)(Arg1,Arg2)); // deprecated in C++11, removed in C++17 +pointer_to_binary_function<Arg1,Arg2,Result> ptr_fun(Result (*f)(Arg1,Arg2)); // deprecated in C++11, removed in C++17 -template<class S, class T> // deprecated in C++11, removed in C++17 +template<class S, class T> // deprecated in C++11, removed in C++17 class mem_fun_t : public unary_function<T*, S> { public: @@ -300,18 +307,18 @@ }; template<class S, class T, class A> -class mem_fun1_t : public binary_function<T*, A, S> // deprecated in C++11, removed in C++17 +class mem_fun1_t : public binary_function<T*, A, S> // deprecated in C++11, removed in C++17 { public: explicit mem_fun1_t(S (T::*p)(A)); S operator()(T* p, A x) const; }; -template<class S, class T> mem_fun_t<S,T> mem_fun(S (T::*f)()); // deprecated in C++11, removed in C++17 -template<class S, class T, class A> mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A)); // deprecated in C++11, removed in C++17 +template<class S, class T> mem_fun_t<S,T> mem_fun(S (T::*f)()); // deprecated in C++11, removed in C++17 +template<class S, class T, class A> mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A)); // deprecated in C++11, removed in C++17 template<class S, class T> -class mem_fun_ref_t : public unary_function<T, S> // deprecated in C++11, removed in C++17 +class mem_fun_ref_t : public unary_function<T, S> // deprecated in C++11, removed in C++17 { public: explicit mem_fun_ref_t(S (T::*p)()); @@ -319,18 +326,20 @@ }; template<class S, class T, class A> -class mem_fun1_ref_t : public binary_function<T, A, S> // deprecated in C++11, removed in C++17 +class mem_fun1_ref_t : public binary_function<T, A, S> // deprecated in C++11, removed in C++17 { public: explicit mem_fun1_ref_t(S (T::*p)(A)); S operator()(T& p, A x) const; }; -template<class S, class T> mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)()); // deprecated in C++11, removed in C++17 -template<class S, class T, class A> mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A)); // deprecated in C++11, removed in C++17 +template<class S, class T> +mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)()); // deprecated in C++11, removed in C++17 +template<class S, class T, class A> +mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A)); // deprecated in C++11, removed in C++17 template <class S, class T> -class const_mem_fun_t : public unary_function<const T*, S> // deprecated in C++11, removed in C++17 +class const_mem_fun_t : public unary_function<const T*, S> // deprecated in C++11, removed in C++17 { public: explicit const_mem_fun_t(S (T::*p)() const); @@ -338,18 +347,20 @@ }; template <class S, class T, class A> -class const_mem_fun1_t : public binary_function<const T*, A, S> // deprecated in C++11, removed in C++17 +class const_mem_fun1_t : public binary_function<const T*, A, S> // deprecated in C++11, removed in C++17 { public: explicit const_mem_fun1_t(S (T::*p)(A) const); S operator()(const T* p, A x) const; }; -template <class S, class T> const_mem_fun_t<S,T> mem_fun(S (T::*f)() const); // deprecated in C++11, removed in C++17 -template <class S, class T, class A> const_mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A) const); // deprecated in C++11, removed in C++17 +template <class S, class T> +const_mem_fun_t<S,T> mem_fun(S (T::*f)() const); // deprecated in C++11, removed in C++17 +template <class S, class T, class A> +const_mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A) const); // deprecated in C++11, removed in C++17 template <class S, class T> -class const_mem_fun_ref_t : public unary_function<T, S> // deprecated in C++11, removed in C++17 +class const_mem_fun_ref_t : public unary_function<T, S> // deprecated in C++11, removed in C++17 { public: explicit const_mem_fun_ref_t(S (T::*p)() const); @@ -357,18 +368,19 @@ }; template <class S, class T, class A> -class const_mem_fun1_ref_t : public binary_function<T, A, S> // deprecated in C++11, removed in C++17 +class const_mem_fun1_ref_t : public binary_function<T, A, S> // deprecated in C++11, removed in C++17 { public: explicit const_mem_fun1_ref_t(S (T::*p)(A) const); S operator()(const T& p, A x) const; }; -template <class S, class T> const_mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)() const); // deprecated in C++11, removed in C++17 -template <class S, class T, class A> const_mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A) const); // deprecated in C++11, removed in C++17 +template <class S, class T> +const_mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)() const); // deprecated in C++11, removed in C++17 +template <class S, class T, class A> +const_mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A) const); // deprecated in C++11, removed in C++17 -template<class R, class T> -constexpr unspecified mem_fn(R T::*); // constexpr in C++20 +template<class R, class T> constexpr unspecified mem_fn(R T::*); // constexpr in C++20 class bad_function_call : public exception @@ -505,7 +517,7 @@ #include <__compare/compare_three_way.h> #include <__config> #include <__debug> -#include <__functional/binary_function.h> // TODO: deprecate +#include <__functional/binary_function.h> #include <__functional/binary_negate.h> #include <__functional/bind.h> #include <__functional/bind_back.h> @@ -527,13 +539,11 @@ #include <__functional/pointer_to_unary_function.h> #include <__functional/ranges_operations.h> #include <__functional/reference_wrapper.h> -#include <__functional/unary_function.h> // TODO: deprecate +#include <__functional/unary_function.h> #include <__functional/unary_negate.h> #include <__functional/unwrap_ref.h> #include <__utility/forward.h> -#include <exception> #include <memory> // TODO: find out why removing this breaks the modules build -#include <type_traits> #include <typeinfo> #include <version> @@ -542,8 +552,12 @@ #endif #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <atomic> # include <concepts> +# include <cstdlib> +# include <exception> # include <tuple> +# include <type_traits> # include <utility> #endif
diff --git a/third_party/llvm-project/libcxx/include/future b/third_party/llvm-project/libcxx/include/future index 2f14a47..22fc585 100644 --- a/third_party/llvm-project/libcxx/include/future +++ b/third_party/llvm-project/libcxx/include/future
@@ -366,17 +366,28 @@ #include <__chrono/duration.h> #include <__chrono/time_point.h> #include <__config> +#include <__exception/exception_ptr.h> +#include <__memory/allocator.h> #include <__memory/allocator_arg_t.h> #include <__memory/allocator_destructor.h> +#include <__memory/allocator_traits.h> +#include <__memory/compressed_pair.h> +#include <__memory/pointer_traits.h> +#include <__memory/shared_ptr.h> +#include <__memory/unique_ptr.h> #include <__memory/uses_allocator.h> +#include <__system_error/error_category.h> +#include <__system_error/error_code.h> +#include <__system_error/error_condition.h> +#include <__type_traits/aligned_storage.h> +#include <__type_traits/alignment_of.h> #include <__type_traits/strip_signature.h> #include <__utility/auto_cast.h> #include <__utility/forward.h> #include <__utility/move.h> -#include <exception> #include <mutex> #include <new> -#include <system_error> +#include <stdexcept> #include <thread> #include <version> @@ -520,16 +531,16 @@ }; _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS _LIBCPP_AVAILABILITY_FUTURE_ERROR #endif void __throw_future_error(future_errc __ev) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw future_error(make_error_code(__ev)); #else - ((void)__ev); - _VSTD::abort(); + (void)__ev; + _LIBCPP_VERBOSE_ABORT("future_error was thrown in -fno-exceptions mode"); #endif } @@ -869,18 +880,18 @@ void __deferred_assoc_state<_Rp, _Fp>::__execute() { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS this->set_value(__func_()); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->set_exception(current_exception()); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } template <class _Fp> @@ -910,19 +921,19 @@ void __deferred_assoc_state<void, _Fp>::__execute() { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __func_(); this->set_value(); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->set_exception(current_exception()); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } template <class _Rp, class _Fp> @@ -952,18 +963,18 @@ void __async_assoc_state<_Rp, _Fp>::__execute() { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS this->set_value(__func_()); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->set_exception(current_exception()); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } template <class _Rp, class _Fp> @@ -1001,19 +1012,19 @@ void __async_assoc_state<void, _Fp>::__execute() { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __func_(); this->set_value(); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->set_exception(current_exception()); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } template <class _Fp> @@ -1120,7 +1131,7 @@ _Rp future<_Rp>::get() { - unique_ptr<__shared_count, __release_shared_count> __(__state_); + unique_ptr<__shared_count, __release_shared_count> __guard(__state_); __assoc_state<_Rp>* __s = __state_; __state_ = nullptr; return __s->move(); @@ -1202,7 +1213,7 @@ _Rp& future<_Rp&>::get() { - unique_ptr<__shared_count, __release_shared_count> __(__state_); + unique_ptr<__shared_count, __release_shared_count> __guard(__state_); __assoc_state<_Rp&>* __s = __state_; __state_ = nullptr; return __s->copy(); @@ -1756,7 +1767,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(_Fp&& __f) : __f_(nullptr) { - typedef __libcpp_remove_reference_t<typename decay<_Fp>::type> _FR; + typedef __libcpp_remove_reference_t<__decay_t<_Fp> > _FR; typedef __packaged_task_func<_FR, allocator<_FR>, _Rp(_ArgTypes...)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) { @@ -1780,7 +1791,7 @@ allocator_arg_t, const _Alloc& __a0, _Fp&& __f) : __f_(nullptr) { - typedef __libcpp_remove_reference_t<typename decay<_Fp>::type> _FR; + typedef __libcpp_remove_reference_t<__decay_t<_Fp> > _FR; typedef __packaged_task_func<_FR, _Alloc, _Rp(_ArgTypes...)> _FF; if (sizeof(_FF) <= sizeof(__buf_)) { @@ -1902,8 +1913,8 @@ class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> > _LIBCPP_INLINE_VISIBILITY packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f) - : __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)), - __p_(allocator_arg, __a) {} + : __f_(allocator_arg_t(), __a, _VSTD::forward<_Fp>(__f)), + __p_(allocator_arg_t(), __a) {} // ~packaged_task() = default; // no copy @@ -1950,18 +1961,18 @@ __throw_future_error(future_errc::no_state); if (__p_.__state_->__has_value()) __throw_future_error(future_errc::promise_already_satisfied); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __p_.set_value(__f_(_VSTD::forward<_ArgTypes>(__args)...)); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __p_.set_exception(current_exception()); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } template<class _Rp, class ..._ArgTypes> @@ -1972,18 +1983,18 @@ __throw_future_error(future_errc::no_state); if (__p_.__state_->__has_value()) __throw_future_error(future_errc::promise_already_satisfied); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __p_.set_value_at_thread_exit(__f_(_VSTD::forward<_ArgTypes>(__args)...)); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __p_.set_exception_at_thread_exit(current_exception()); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } template<class _Rp, class ..._ArgTypes> @@ -2017,8 +2028,8 @@ class = __enable_if_t<!is_same<__remove_cvref_t<_Fp>, packaged_task>::value> > _LIBCPP_INLINE_VISIBILITY packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f) - : __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)), - __p_(allocator_arg, __a) {} + : __f_(allocator_arg_t(), __a, _VSTD::forward<_Fp>(__f)), + __p_(allocator_arg_t(), __a) {} // ~packaged_task() = default; // no copy @@ -2075,19 +2086,19 @@ __throw_future_error(future_errc::no_state); if (__p_.__state_->__has_value()) __throw_future_error(future_errc::promise_already_satisfied); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __f_(_VSTD::forward<_ArgTypes>(__args)...); __p_.set_value(); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __p_.set_exception(current_exception()); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } template<class ..._ArgTypes> @@ -2098,19 +2109,19 @@ __throw_future_error(future_errc::no_state); if (__p_.__state_->__has_value()) __throw_future_error(future_errc::promise_already_satisfied); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __f_(_VSTD::forward<_ArgTypes>(__args)...); __p_.set_value_at_thread_exit(); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __p_.set_exception_at_thread_exit(current_exception()); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } template<class ..._ArgTypes> @@ -2189,20 +2200,20 @@ template <class _Fp, class... _Args> _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI -future<typename __invoke_of<typename decay<_Fp>::type, typename decay<_Args>::type...>::type> +future<typename __invoke_of<__decay_t<_Fp>, __decay_t<_Args>...>::type> async(launch __policy, _Fp&& __f, _Args&&... __args) { - typedef __async_func<typename decay<_Fp>::type, typename decay<_Args>::type...> _BF; + typedef __async_func<__decay_t<_Fp>, __decay_t<_Args>...> _BF; typedef typename _BF::_Rp _Rp; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif if (__does_policy_contain(__policy, launch::async)) return _VSTD::__make_async_assoc_state<_Rp>(_BF(_LIBCPP_AUTO_CAST(_VSTD::forward<_Fp>(__f)), _LIBCPP_AUTO_CAST(_VSTD::forward<_Args>(__args))...)); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch ( ... ) { if (__policy == launch::async) throw ; } #endif @@ -2215,7 +2226,7 @@ template <class _Fp, class... _Args> _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY -future<typename __invoke_of<typename decay<_Fp>::type, typename decay<_Args>::type...>::type> +future<typename __invoke_of<__decay_t<_Fp>, __decay_t<_Args>...>::type> async(_Fp&& __f, _Args&&... __args) { return _VSTD::async(launch::any, _VSTD::forward<_Fp>(__f), @@ -2454,4 +2465,11 @@ # include <chrono> #endif +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <atomic> +# include <cstdlib> +# include <exception> +# include <system_error> +#endif + #endif // _LIBCPP_FUTURE
diff --git a/third_party/llvm-project/libcxx/include/iomanip b/third_party/llvm-project/libcxx/include/iomanip index 38c5c9b..53445c7 100644 --- a/third_party/llvm-project/libcxx/include/iomanip +++ b/third_party/llvm-project/libcxx/include/iomanip
@@ -301,10 +301,10 @@ _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS typename basic_istream<_CharT, _Traits>::sentry __s(__is); if (__s) { @@ -315,13 +315,13 @@ __mf.get(_Ip(__is), _Ip(), __x.__intl_, __is, __err, __x.__mon_); __is.setstate(__err); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __is.__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return __is; } @@ -361,10 +361,10 @@ _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS typename basic_ostream<_CharT, _Traits>::sentry __s(__os); if (__s) { @@ -374,13 +374,13 @@ if (__mf.put(_Op(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed()) __os.setstate(ios_base::badbit); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __os.__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return __os; } @@ -420,10 +420,10 @@ _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS typename basic_istream<_CharT, _Traits>::sentry __s(__is); if (__s) { @@ -435,13 +435,13 @@ __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)); __is.setstate(__err); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __is.__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return __is; } @@ -481,10 +481,10 @@ _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS typename basic_ostream<_CharT, _Traits>::sentry __s(__os); if (__s) { @@ -495,13 +495,13 @@ __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)).failed()) __os.setstate(ios_base::badbit); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __os.__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return __os; } @@ -513,8 +513,6 @@ return __iom_t10<_CharT>(__tm, __fmt); } -#if _LIBCPP_STD_VER >= 11 - template <class _CharT, class _Traits> _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& __quoted_output(basic_ostream<_CharT, _Traits>& __os, @@ -622,9 +620,7 @@ return __quoted_proxy<_CharT, _Traits, _Allocator>(__s, __delim, __escape); } -#endif // _LIBCPP_STD_VER >= 11 - -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _CharT> _LIBCPP_HIDE_FROM_ABI @@ -656,7 +652,7 @@ return __quoted_output_proxy<_CharT, _Traits>(__sv.data(), __sv.data() + __sv.size(), __delim, __escape); } -#endif // _LIBCPP_STD_VER > 11 +#endif // _LIBCPP_STD_VER >= 14 _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/ios b/third_party/llvm-project/libcxx/include/ios index 9eecf4d..d972a22 100644 --- a/third_party/llvm-project/libcxx/include/ios +++ b/third_party/llvm-project/libcxx/include/ios
@@ -219,8 +219,12 @@ #include <__assert> // all public C++ headers provide the assertion handler #include <__ios/fpos.h> #include <__locale> +#include <__system_error/error_category.h> +#include <__system_error/error_code.h> +#include <__system_error/error_condition.h> +#include <__system_error/system_error.h> #include <__utility/swap.h> -#include <system_error> +#include <__verbose_abort> #include <version> // standard-mandated includes @@ -229,7 +233,7 @@ #include <iosfwd> #if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) -#include <atomic> // for __xindex_ +# include <__atomic/atomic.h> // for __xindex_ #endif #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -448,11 +452,10 @@ _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY void __throw_failure(char const* __msg) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw ios_base::failure(__msg); #else - ((void)__msg); - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("ios_base::failure was thrown in -fno-exceptions mode with message \"%s\"", __msg); #endif } @@ -1039,6 +1042,7 @@ _LIBCPP_END_NAMESPACE_STD #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <atomic> # include <concepts> # include <cstddef> # include <cstdlib> @@ -1047,6 +1051,7 @@ # include <limits> # include <new> # include <stdexcept> +# include <system_error> # include <type_traits> # include <typeinfo> #endif
diff --git a/third_party/llvm-project/libcxx/include/istream b/third_party/llvm-project/libcxx/include/istream index 6e67d61..7350e11 100644 --- a/third_party/llvm-project/libcxx/include/istream +++ b/third_party/llvm-project/libcxx/include/istream
@@ -161,6 +161,10 @@ #include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__iterator/istreambuf_iterator.h> +#include <__type_traits/conjunction.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/is_base_of.h> +#include <__utility/declval.h> #include <__utility/forward.h> #include <ostream> #include <version> @@ -360,14 +364,14 @@ typename basic_istream<_CharT, _Traits>::sentry __s(__is); if (__s) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS typedef istreambuf_iterator<_CharT, _Traits> _Ip; typedef num_get<_CharT, _Ip> _Fp; std::use_facet<_Fp>(__is.getloc()).get(_Ip(__is), _Ip(), __is, __state, __n); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -469,10 +473,10 @@ typename basic_istream<_CharT, _Traits>::sentry __s(__is); if (__s) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS typedef istreambuf_iterator<_CharT, _Traits> _Ip; typedef num_get<_CharT, _Ip> _Fp; long __temp; @@ -491,7 +495,7 @@ { __n = static_cast<_Tp>(__temp); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -502,7 +506,7 @@ throw; } } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __is.setstate(__state); } return __is; @@ -531,7 +535,7 @@ typename basic_istream<_CharT, _Traits>::sentry __sen(__is); if (__sen) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif @@ -555,7 +559,7 @@ __is.width(0); if (__s == __p) __state |= ios_base::failbit; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -572,7 +576,7 @@ return __is; } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template<class _CharT, class _Traits, size_t _Np> inline _LIBCPP_INLINE_VISIBILITY @@ -630,7 +634,7 @@ return __is >> (char*)__s; } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 template<class _CharT, class _Traits> _LIBCPP_HIDE_FROM_ABI basic_istream<_CharT, _Traits>& @@ -640,7 +644,7 @@ typename basic_istream<_CharT, _Traits>::sentry __sen(__is); if (__sen) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif @@ -649,7 +653,7 @@ __state |= ios_base::eofbit | ios_base::failbit; else __c = _Traits::to_char_type(__i); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -693,10 +697,10 @@ { if (__sb) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS while (true) { typename traits_type::int_type __i = this->rdbuf()->sgetc(); @@ -714,7 +718,7 @@ } if (__gc_ == 0) __state |= ios_base::failbit; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -728,7 +732,7 @@ throw; } } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } else { @@ -749,7 +753,7 @@ sentry __s(*this, true); if (__s) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif @@ -758,7 +762,7 @@ __state |= ios_base::failbit | ios_base::eofbit; else __gc_ = 1; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -785,7 +789,7 @@ { if (__n > 0) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif @@ -806,7 +810,7 @@ } if (__gc_ == 0) __state |= ios_base::failbit; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -845,10 +849,10 @@ sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS while (true) { typename traits_type::int_type __i = this->rdbuf()->sgetc(); @@ -865,14 +869,14 @@ ++__gc_; this->rdbuf()->sbumpc(); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __state |= ios_base::badbit; // according to the spec, exceptions here are caught but not rethrown } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS if (__gc_ == 0) __state |= ios_base::failbit; this->setstate(__state); @@ -889,10 +893,10 @@ sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS while (true) { typename traits_type::int_type __i = this->rdbuf()->sgetc(); @@ -917,7 +921,7 @@ this->rdbuf()->sbumpc(); ++__gc_; } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -932,7 +936,7 @@ throw; } } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } if (__n > 0) *__s = char_type(); @@ -951,10 +955,10 @@ sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS if (__n == numeric_limits<streamsize>::max()) { while (true) @@ -985,7 +989,7 @@ break; } } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -996,7 +1000,7 @@ throw; } } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS this->setstate(__state); } return *this; @@ -1012,14 +1016,14 @@ sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __r = this->rdbuf()->sgetc(); if (traits_type::eq_int_type(__r, traits_type::eof())) __state |= ios_base::eofbit; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -1030,7 +1034,7 @@ throw; } } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS this->setstate(__state); } return __r; @@ -1045,14 +1049,14 @@ sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __gc_ = this->rdbuf()->sgetn(__s, __n); if (__gc_ != __n) __state |= ios_base::failbit | ios_base::eofbit; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -1063,7 +1067,7 @@ throw; } } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } else { @@ -1082,10 +1086,10 @@ sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS streamsize __c = this->rdbuf()->in_avail(); switch (__c) { @@ -1101,7 +1105,7 @@ __state |= ios_base::failbit | ios_base::eofbit; break; } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -1112,7 +1116,7 @@ throw; } } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } else { @@ -1132,13 +1136,13 @@ sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS if (this->rdbuf() == nullptr || this->rdbuf()->sputbackc(__c) == traits_type::eof()) __state |= ios_base::badbit; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -1149,7 +1153,7 @@ throw; } } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } else { @@ -1169,13 +1173,13 @@ sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS if (this->rdbuf() == nullptr || this->rdbuf()->sungetc() == traits_type::eof()) __state |= ios_base::badbit; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -1186,7 +1190,7 @@ throw; } } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } else { @@ -1205,10 +1209,10 @@ sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS if (this->rdbuf() == nullptr) return -1; if (this->rdbuf()->pubsync() == -1) @@ -1216,7 +1220,7 @@ __state |= ios_base::badbit; return -1; } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -1227,7 +1231,7 @@ throw; } } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS this->setstate(__state); } return __r; @@ -1242,12 +1246,12 @@ sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __r = this->rdbuf()->pubseekoff(0, ios_base::cur, ios_base::in); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -1258,7 +1262,7 @@ throw; } } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS this->setstate(__state); } return __r; @@ -1273,13 +1277,13 @@ sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1)) __state |= ios_base::failbit; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -1290,7 +1294,7 @@ throw; } } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS this->setstate(__state); } return *this; @@ -1305,13 +1309,13 @@ sentry __sen(*this, true); if (__sen) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1)) __state |= ios_base::failbit; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -1322,7 +1326,7 @@ throw; } } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS this->setstate(__state); } return *this; @@ -1336,10 +1340,10 @@ typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true); if (__sen) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS const ctype<_CharT>& __ct = std::use_facet<ctype<_CharT> >(__is.getloc()); while (true) { @@ -1353,7 +1357,7 @@ break; __is.rdbuf()->sbumpc(); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -1364,7 +1368,7 @@ throw; } } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __is.setstate(__state); } return __is; @@ -1450,7 +1454,7 @@ typename basic_istream<_CharT, _Traits>::sentry __sen(__is); if (__sen) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif @@ -1480,7 +1484,7 @@ __is.width(0); if (__c == 0) __state |= ios_base::failbit; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -1506,7 +1510,7 @@ typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true); if (__sen) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif @@ -1533,7 +1537,7 @@ } if (__extr == 0) __state |= ios_base::failbit; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -1585,7 +1589,7 @@ typename basic_istream<_CharT, _Traits>::sentry __sen(__is); if (__sen) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif @@ -1612,7 +1616,7 @@ __x = bitset<_Size>(__str); if (_Size > 0 && __c == 0) __state |= ios_base::failbit; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) {
diff --git a/third_party/llvm-project/libcxx/include/iterator b/third_party/llvm-project/libcxx/include/iterator index 35eca67..c4bec91 100644 --- a/third_party/llvm-project/libcxx/include/iterator +++ b/third_party/llvm-project/libcxx/include/iterator
@@ -387,7 +387,7 @@ class move_iterator { public: using iterator_type = Iterator; - using iterator_concept = input_iterator_tag; // From C++20 + using iterator_concept = see below; // From C++20 using iterator_category = see below; // not always present starting from C++20 using value_type = iter_value_t<Iterator>; // Until C++20, iterator_traits<Iterator>::value_type using difference_type = iter_difference_t<Iterator>; // Until C++20, iterator_traits<Iterator>::difference_type; @@ -732,6 +732,7 @@ #endif #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <cstdlib> # include <exception> # include <new> # include <type_traits>
diff --git a/third_party/llvm-project/libcxx/include/latch b/third_party/llvm-project/libcxx/include/latch index ff17f84..d72cb4f 100644 --- a/third_party/llvm-project/libcxx/include/latch +++ b/third_party/llvm-project/libcxx/include/latch
@@ -41,9 +41,12 @@ */ #include <__assert> // all public C++ headers provide the assertion handler +#include <__atomic/atomic_base.h> +#include <__atomic/atomic_sync.h> +#include <__atomic/memory_order.h> #include <__availability> #include <__config> -#include <atomic> +#include <cstddef> #include <limits> #include <version> @@ -111,4 +114,8 @@ _LIBCPP_POP_MACROS +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <atomic> +#endif + #endif //_LIBCPP_LATCH
diff --git a/third_party/llvm-project/libcxx/include/libcxx.imp b/third_party/llvm-project/libcxx/include/libcxx.imp index 575ce0f..daa9188 100644 --- a/third_party/llvm-project/libcxx/include/libcxx.imp +++ b/third_party/llvm-project/libcxx/include/libcxx.imp
@@ -8,7 +8,6 @@ { include: [ "<__node_handle>", "private", "<unordered_set>", "public" ] }, { include: [ "<__split_buffer>", "private", "<deque>", "public" ] }, { include: [ "<__split_buffer>", "private", "<vector>", "public" ] }, - { include: [ "<__std_stream>", "private", "<iostream>", "public" ] }, { include: [ "<__threading_support>", "private", "<atomic>", "public" ] }, { include: [ "<__threading_support>", "private", "<mutex>", "public" ] }, { include: [ "<__threading_support>", "private", "<semaphore>", "public" ] }, @@ -16,13 +15,16 @@ { include: [ "<__tree>", "private", "<map>", "public" ] }, { include: [ "<__tree>", "private", "<set>", "public" ] }, { include: [ "@<__algorithm/.*>", "private", "<algorithm>", "public" ] }, + { include: [ "@<__atomic/.*>", "private", "<atomic>", "public" ] }, { include: [ "@<__bit/.*>", "private", "<bit>", "public" ] }, { include: [ "@<__charconv/.*>", "private", "<charconv>", "public" ] }, { include: [ "@<__chrono/.*>", "private", "<chrono>", "public" ] }, { include: [ "@<__compare/.*>", "private", "<compare>", "public" ] }, { include: [ "@<__concepts/.*>", "private", "<concepts>", "public" ] }, + { include: [ "@<__condition_variable/.*>", "private", "<condition_variable>", "public" ] }, { include: [ "@<__coroutine/.*>", "private", "<coroutine>", "public" ] }, { include: [ "@<__debug_utils/.*>", "private", "<debug_utils>", "public" ] }, + { include: [ "@<__exception/.*>", "private", "<exception>", "public" ] }, { include: [ "@<__expected/.*>", "private", "<expected>", "public" ] }, { include: [ "@<__filesystem/.*>", "private", "<filesystem>", "public" ] }, { include: [ "@<__format/.*>", "private", "<format>", "public" ] }, @@ -32,13 +34,15 @@ { include: [ "@<__iterator/.*>", "private", "<iterator>", "public" ] }, { include: [ "@<__memory/.*>", "private", "<memory>", "public" ] }, { include: [ "@<__memory_resource/.*>", "private", "<memory_resource>", "public" ] }, + { include: [ "@<__mutex/.*>", "private", "<mutex>", "public" ] }, { include: [ "@<__numeric/.*>", "private", "<numeric>", "public" ] }, { include: [ "@<__random/.*>", "private", "<random>", "public" ] }, { include: [ "@<__ranges/.*>", "private", "<ranges>", "public" ] }, { include: [ "@<__string/.*>", "private", "<string>", "public" ] }, { include: [ "@<__support/.*>", "private", "<support>", "public" ] }, + { include: [ "@<__system_error/.*>", "private", "<system_error>", "public" ] }, { include: [ "@<__thread/.*>", "private", "<thread>", "public" ] }, - { include: [ "@<__tuple_dir/.*>", "private", "<tuple>", "public" ] }, + { include: [ "@<__tuple/.*>", "private", "<tuple>", "public" ] }, { include: [ "@<__type_traits/.*>", "private", "<type_traits>", "public" ] }, { include: [ "@<__utility/.*>", "private", "<utility>", "public" ] }, { include: [ "@<__variant/.*>", "private", "<variant>", "public" ] },
diff --git a/third_party/llvm-project/libcxx/include/list b/third_party/llvm-project/libcxx/include/list index a0c7327..6969d3c 100644 --- a/third_party/llvm-project/libcxx/include/list +++ b/third_party/llvm-project/libcxx/include/list
@@ -155,15 +155,18 @@ template <class T, class Alloc> bool operator==(const list<T,Alloc>& x, const list<T,Alloc>& y); template <class T, class Alloc> - bool operator< (const list<T,Alloc>& x, const list<T,Alloc>& y); + bool operator< (const list<T,Alloc>& x, const list<T,Alloc>& y); // removed in C++20 template <class T, class Alloc> - bool operator!=(const list<T,Alloc>& x, const list<T,Alloc>& y); + bool operator!=(const list<T,Alloc>& x, const list<T,Alloc>& y); // removed in C++20 template <class T, class Alloc> - bool operator> (const list<T,Alloc>& x, const list<T,Alloc>& y); + bool operator> (const list<T,Alloc>& x, const list<T,Alloc>& y); // removed in C++20 template <class T, class Alloc> - bool operator>=(const list<T,Alloc>& x, const list<T,Alloc>& y); + bool operator>=(const list<T,Alloc>& x, const list<T,Alloc>& y); // removed in C++20 template <class T, class Alloc> - bool operator<=(const list<T,Alloc>& x, const list<T,Alloc>& y); + bool operator<=(const list<T,Alloc>& x, const list<T,Alloc>& y); // removed in C++20 +template<class T, class Allocator> + synth-three-way-result<T> operator<=>(const list<T, Allocator>& x, + const list<T, Allocator>& y); // since C++20 template <class T, class Alloc> void swap(list<T,Alloc>& x, list<T,Alloc>& y) @@ -171,10 +174,10 @@ template <class T, class Allocator, class U> typename list<T, Allocator>::size_type - erase(list<T, Allocator>& c, const U& value); // C++20 + erase(list<T, Allocator>& c, const U& value); // since C++20 template <class T, class Allocator, class Predicate> typename list<T, Allocator>::size_type - erase_if(list<T, Allocator>& c, Predicate pred); // C++20 + erase_if(list<T, Allocator>& c, Predicate pred); // since C++20 } // std @@ -183,6 +186,7 @@ #include <__algorithm/comp.h> #include <__algorithm/equal.h> #include <__algorithm/lexicographical_compare.h> +#include <__algorithm/lexicographical_compare_three_way.h> #include <__algorithm/min.h> #include <__assert> // all public C++ headers provide the assertion handler #include <__config> @@ -203,13 +207,19 @@ #include <__memory/swap_allocator.h> #include <__memory/unique_ptr.h> #include <__memory_resource/polymorphic_allocator.h> +#include <__type_traits/conditional.h> #include <__type_traits/is_allocator.h> +#include <__type_traits/is_nothrow_default_constructible.h> +#include <__type_traits/is_nothrow_move_assignable.h> +#include <__type_traits/is_nothrow_move_constructible.h> +#include <__type_traits/is_pointer.h> +#include <__type_traits/is_same.h> +#include <__type_traits/type_identity.h> #include <__utility/forward.h> #include <__utility/move.h> #include <__utility/swap.h> #include <cstring> #include <limits> -#include <type_traits> #include <version> // standard-mandated includes @@ -824,7 +834,7 @@ typedef _Tp value_type; typedef _Alloc allocator_type; static_assert((is_same<value_type, typename allocator_type::value_type>::value), - "Invalid allocator::value_type"); + "Allocator::value_type must be same type as value_type"); typedef value_type& reference; typedef const value_type& const_reference; typedef typename base::pointer pointer; @@ -835,7 +845,7 @@ typedef typename base::const_iterator const_iterator; typedef _VSTD::reverse_iterator<iterator> reverse_iterator; typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 typedef size_type __remove_return_type; #else typedef void __remove_return_type; @@ -857,7 +867,7 @@ _VSTD::__debug_db_insert_c(this); } explicit list(size_type __n); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 explicit list(size_type __n, const allocator_type& __a); #endif list(size_type __n, const value_type& __x); @@ -986,13 +996,13 @@ void push_back(value_type&& __x); template <class... _Args> -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 reference emplace_front(_Args&&... __args); #else void emplace_front(_Args&&... __args); #endif template <class... _Args> -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 reference emplace_back(_Args&&... __args); #else void emplace_back(_Args&&... __args); @@ -1200,7 +1210,7 @@ #endif } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp, class _Alloc> list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a) { @@ -1423,10 +1433,10 @@ __r = iterator(__hold->__as_link(), this); __hold.release(); iterator __e = __r; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS for (--__n; __n != 0; --__n, (void) ++__e, ++__ds) { __hold.reset(__node_alloc_traits::allocate(__na, 1)); @@ -1435,7 +1445,7 @@ __hold->__prev_ = __e.__ptr_; __hold.release(); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -1450,7 +1460,7 @@ } throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_); base::__sz() += __ds; } @@ -1476,10 +1486,10 @@ __r = iterator(__hold.get()->__as_link(), this); __hold.release(); iterator __e = __r; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS for (++__f; __f != __l; ++__f, (void) ++__e, ++__ds) { __hold.reset(__node_alloc_traits::allocate(__na, 1)); @@ -1488,7 +1498,7 @@ __hold->__prev_ = __e.__ptr_; __hold.release(); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -1503,7 +1513,7 @@ } throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_); base::__sz() += __ds; } @@ -1563,7 +1573,7 @@ template <class _Tp, class _Alloc> template <class... _Args> -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 typename list<_Tp, _Alloc>::reference #else void @@ -1575,7 +1585,7 @@ __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...); __link_nodes_at_front(__hold.get()->__as_link(), __hold.get()->__as_link()); ++base::__sz(); -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 return __hold.release()->__value_; #else __hold.release(); @@ -1584,7 +1594,7 @@ template <class _Tp, class _Alloc> template <class... _Args> -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 typename list<_Tp, _Alloc>::reference #else void @@ -1597,7 +1607,7 @@ __link_pointer __nl = __hold->__as_link(); __link_nodes_at_back(__nl, __nl); ++base::__sz(); -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 return __hold.release()->__value_; #else __hold.release(); @@ -1787,10 +1797,10 @@ ++__ds; iterator __r = iterator(__hold.release()->__as_link(), this); iterator __e = __r; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS for (--__n; __n != 0; --__n, (void) ++__e, ++__ds) { __hold.reset(__node_alloc_traits::allocate(__na, 1)); @@ -1799,7 +1809,7 @@ __hold->__prev_ = __e.__ptr_; __hold.release(); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -1814,7 +1824,7 @@ } throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __link_nodes_at_back(__r.__ptr_, __e.__ptr_); base::__sz() += __ds; } @@ -1837,10 +1847,10 @@ __link_pointer __nl = __hold.release()->__as_link(); iterator __r = iterator(__nl, this); iterator __e = __r; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS for (--__n; __n != 0; --__n, (void) ++__e, ++__ds) { __hold.reset(__node_alloc_traits::allocate(__na, 1)); @@ -1849,7 +1859,7 @@ __hold->__prev_ = __e.__ptr_; __hold.release(); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -1864,7 +1874,7 @@ } throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __link_nodes(base::__end_as_link(), __r.__ptr_, __e.__ptr_); base::__sz() += __ds; } @@ -2289,6 +2299,8 @@ return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin()); } +#if _LIBCPP_STD_VER <= 17 + template <class _Tp, class _Alloc> inline _LIBCPP_INLINE_VISIBILITY bool @@ -2329,6 +2341,19 @@ return !(__y < __x); } +#else // _LIBCPP_STD_VER <= 17 + +template<class _Tp, class _Allocator> +inline _LIBCPP_HIDE_FROM_ABI +__synth_three_way_result<_Tp> +operator<=>(const list<_Tp, _Allocator>& __x, const list<_Tp, _Allocator>& __y) +{ + return std::lexicographical_compare_three_way( + __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>); +} + +#endif // _LIBCPP_STD_VER <= 17 + template <class _Tp, class _Alloc> inline _LIBCPP_INLINE_VISIBILITY void @@ -2338,7 +2363,7 @@ __x.swap(__y); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Tp, class _Allocator, class _Predicate> inline _LIBCPP_INLINE_VISIBILITY typename list<_Tp, _Allocator>::size_type erase_if(list<_Tp, _Allocator>& __c, _Predicate __pred) { @@ -2358,11 +2383,11 @@ inline constexpr bool __format::__enable_insertable<std::list<wchar_t>> = true; #endif -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD namespace pmr { template <class _ValueT> @@ -2377,9 +2402,11 @@ # include <algorithm> # include <atomic> # include <concepts> +# include <cstdlib> # include <functional> # include <iosfwd> # include <iterator> +# include <type_traits> # include <typeinfo> #endif
diff --git a/third_party/llvm-project/libcxx/include/locale b/third_party/llvm-project/libcxx/include/locale index 5e925e8..251689f 100644 --- a/third_party/llvm-project/libcxx/include/locale +++ b/third_party/llvm-project/libcxx/include/locale
@@ -202,6 +202,8 @@ #include <__iterator/ostreambuf_iterator.h> #include <__locale> #include <__memory/unique_ptr.h> +#include <__type_traits/make_unsigned.h> +#include <cerrno> #include <cstdio> #include <cstdlib> #include <ctime> @@ -3628,13 +3630,13 @@ explicit wstring_convert(_Codecvt* __pcvt); #else _LIBCPP_INLINE_VISIBILITY - _LIBCPP_EXPLICIT_AFTER_CXX11 + _LIBCPP_EXPLICIT_SINCE_CXX14 wstring_convert(_Codecvt* __pcvt = new _Codecvt); #endif _LIBCPP_INLINE_VISIBILITY wstring_convert(_Codecvt* __pcvt, state_type __state); - _LIBCPP_EXPLICIT_AFTER_CXX11 wstring_convert(const byte_string& __byte_err, + _LIBCPP_EXPLICIT_SINCE_CXX14 wstring_convert(const byte_string& __byte_err, const wide_string& __wide_err = wide_string()); #ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY @@ -3910,7 +3912,7 @@ _Codecvt* __pcvt = new _Codecvt, state_type __state = state_type()); #else - _LIBCPP_EXPLICIT_AFTER_CXX11 + _LIBCPP_EXPLICIT_SINCE_CXX14 wbuffer_convert(streambuf* __bytebuf = nullptr, _Codecvt* __pcvt = new _Codecvt, state_type __state = state_type());
diff --git a/third_party/llvm-project/libcxx/include/map b/third_party/llvm-project/libcxx/include/map index 9cf47b2..75de40b 100644 --- a/third_party/llvm-project/libcxx/include/map +++ b/third_party/llvm-project/libcxx/include/map
@@ -250,27 +250,32 @@ template <class Key, class T, class Compare, class Allocator> bool operator< (const map<Key, T, Compare, Allocator>& x, - const map<Key, T, Compare, Allocator>& y); + const map<Key, T, Compare, Allocator>& y); // removed in C++20 template <class Key, class T, class Compare, class Allocator> bool operator!=(const map<Key, T, Compare, Allocator>& x, - const map<Key, T, Compare, Allocator>& y); + const map<Key, T, Compare, Allocator>& y); // removed in C++20 template <class Key, class T, class Compare, class Allocator> bool operator> (const map<Key, T, Compare, Allocator>& x, - const map<Key, T, Compare, Allocator>& y); + const map<Key, T, Compare, Allocator>& y); // removed in C++20 template <class Key, class T, class Compare, class Allocator> bool operator>=(const map<Key, T, Compare, Allocator>& x, - const map<Key, T, Compare, Allocator>& y); + const map<Key, T, Compare, Allocator>& y); // removed in C++20 template <class Key, class T, class Compare, class Allocator> bool operator<=(const map<Key, T, Compare, Allocator>& x, - const map<Key, T, Compare, Allocator>& y); + const map<Key, T, Compare, Allocator>& y); // removed in C++20 + +template<class Key, class T, class Compare, class Allocator> + synth-three-way-result<pair<const Key, T>> + operator<=>(const map<Key, T, Compare, Allocator>& x, + const map<Key, T, Compare, Allocator>& y); // since C++20 // specialized algorithms: template <class Key, class T, class Compare, class Allocator> @@ -491,27 +496,32 @@ template <class Key, class T, class Compare, class Allocator> bool operator< (const multimap<Key, T, Compare, Allocator>& x, - const multimap<Key, T, Compare, Allocator>& y); + const multimap<Key, T, Compare, Allocator>& y); // removed in C++20 template <class Key, class T, class Compare, class Allocator> bool operator!=(const multimap<Key, T, Compare, Allocator>& x, - const multimap<Key, T, Compare, Allocator>& y); + const multimap<Key, T, Compare, Allocator>& y); // removed in C++20 template <class Key, class T, class Compare, class Allocator> bool operator> (const multimap<Key, T, Compare, Allocator>& x, - const multimap<Key, T, Compare, Allocator>& y); + const multimap<Key, T, Compare, Allocator>& y); // removed in C++20 template <class Key, class T, class Compare, class Allocator> bool operator>=(const multimap<Key, T, Compare, Allocator>& x, - const multimap<Key, T, Compare, Allocator>& y); + const multimap<Key, T, Compare, Allocator>& y); // removed in C++20 template <class Key, class T, class Compare, class Allocator> bool operator<=(const multimap<Key, T, Compare, Allocator>& x, - const multimap<Key, T, Compare, Allocator>& y); + const multimap<Key, T, Compare, Allocator>& y); // removed in C++20 + +template<class Key, class T, class Compare, class Allocator> + synth-three-way-result<pair<const Key, T>> + operator<=>(const multimap<Key, T, Compare, Allocator>& x, + const multimap<Key, T, Compare, Allocator>& y); // since c++20 // specialized algorithms: template <class Key, class T, class Compare, class Allocator> @@ -530,6 +540,7 @@ #include <__algorithm/equal.h> #include <__algorithm/lexicographical_compare.h> +#include <__algorithm/lexicographical_compare_three_way.h> #include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__functional/binary_function.h> @@ -538,6 +549,7 @@ #include <__iterator/erase_if_container.h> #include <__iterator/iterator_traits.h> #include <__iterator/reverse_iterator.h> +#include <__memory/addressof.h> #include <__memory/allocator.h> #include <__memory_resource/polymorphic_allocator.h> #include <__node_handle> @@ -547,7 +559,6 @@ #include <__utility/piecewise_construct.h> #include <__utility/swap.h> #include <tuple> -#include <type_traits> #include <version> // standard-mandated includes @@ -601,7 +612,7 @@ swap(static_cast<_Compare&>(*this), static_cast<_Compare&>(__y)); } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <typename _K2> _LIBCPP_INLINE_VISIBILITY bool operator()(const _K2& __x, const _CP& __y) const @@ -647,7 +658,7 @@ swap(__comp_, __y.__comp_); } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <typename _K2> _LIBCPP_INLINE_VISIBILITY bool operator()(const _K2& __x, const _CP& __y) const @@ -742,7 +753,7 @@ _LIBCPP_INLINE_VISIBILITY value_type& __get_value() { -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 return *_VSTD::launder(_VSTD::addressof(__cc_)); #else return __cc_; @@ -752,7 +763,7 @@ _LIBCPP_INLINE_VISIBILITY const value_type& __get_value() const { -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 return *_VSTD::launder(_VSTD::addressof(__cc_)); #else return __cc_; @@ -1020,7 +1031,7 @@ typedef _VSTD::reverse_iterator<iterator> reverse_iterator; typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 typedef __map_node_handle<typename __base::__node, allocator_type> node_type; typedef __insert_return_type<iterator, node_type> insert_return_type; #endif @@ -1067,7 +1078,7 @@ insert(__f, __l); } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _InputIterator> _LIBCPP_INLINE_VISIBILITY map(_InputIterator __f, _InputIterator __l, const allocator_type& __a) @@ -1130,7 +1141,7 @@ insert(__il.begin(), __il.end()); } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 _LIBCPP_INLINE_VISIBILITY map(initializer_list<value_type> __il, const allocator_type& __a) : map(__il, key_compare(), __a) {} @@ -1273,7 +1284,7 @@ insert(__e.__i_, *__f); } -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class... _Args> _LIBCPP_INLINE_VISIBILITY @@ -1367,7 +1378,7 @@ return __r; } -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);} @@ -1382,7 +1393,7 @@ _LIBCPP_INLINE_VISIBILITY void clear() _NOEXCEPT {__tree_.clear();} -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_INLINE_VISIBILITY insert_return_type insert(node_type&& __nh) { @@ -1452,7 +1463,7 @@ iterator find(const key_type& __k) {return __tree_.find(__k);} _LIBCPP_INLINE_VISIBILITY const_iterator find(const key_type& __k) const {return __tree_.find(__k);} -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <typename _K2> _LIBCPP_INLINE_VISIBILITY __enable_if_t<__is_transparent<_Compare, _K2>::value, iterator> @@ -1466,21 +1477,21 @@ _LIBCPP_INLINE_VISIBILITY size_type count(const key_type& __k) const {return __tree_.__count_unique(__k);} -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <typename _K2> _LIBCPP_INLINE_VISIBILITY __enable_if_t<__is_transparent<_Compare, _K2>::value, size_type> count(const _K2& __k) const {return __tree_.__count_multi(__k);} #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY bool contains(const key_type& __k) const {return find(__k) != end();} template <typename _K2> _LIBCPP_INLINE_VISIBILITY __enable_if_t<__is_transparent<_Compare, _K2>::value, bool> contains(const _K2& __k) const { return find(__k) != end(); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY iterator lower_bound(const key_type& __k) @@ -1488,7 +1499,7 @@ _LIBCPP_INLINE_VISIBILITY const_iterator lower_bound(const key_type& __k) const {return __tree_.lower_bound(__k);} -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <typename _K2> _LIBCPP_INLINE_VISIBILITY __enable_if_t<__is_transparent<_Compare, _K2>::value, iterator> @@ -1506,7 +1517,7 @@ _LIBCPP_INLINE_VISIBILITY const_iterator upper_bound(const key_type& __k) const {return __tree_.upper_bound(__k);} -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <typename _K2> _LIBCPP_INLINE_VISIBILITY __enable_if_t<__is_transparent<_Compare, _K2>::value, iterator> @@ -1523,7 +1534,7 @@ _LIBCPP_INLINE_VISIBILITY pair<const_iterator,const_iterator> equal_range(const key_type& __k) const {return __tree_.__equal_range_unique(__k);} -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <typename _K2> _LIBCPP_INLINE_VISIBILITY __enable_if_t<__is_transparent<_Compare, _K2>::value, pair<iterator,iterator>> @@ -1677,6 +1688,8 @@ return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin()); } +#if _LIBCPP_STD_VER <= 17 + template <class _Key, class _Tp, class _Compare, class _Allocator> inline _LIBCPP_INLINE_VISIBILITY bool @@ -1722,6 +1735,24 @@ return !(__y < __x); } +#else // #if _LIBCPP_STD_VER <= 17 + +template<class _Key, class _Tp, class _Compare, class _Allocator> +inline _LIBCPP_HIDE_FROM_ABI +__synth_three_way_result<pair<const _Key, _Tp>> +operator<=>(const map<_Key, _Tp, _Compare, _Allocator>& __x, + const map<_Key, _Tp, _Compare, _Allocator>& __y) +{ + return std::lexicographical_compare_three_way( + __x.begin(), + __x.end(), + __y.begin(), + __y.end(), + std::__synth_three_way<pair<const _Key, _Tp>, pair<const _Key, _Tp>>); +} + +#endif // #if _LIBCPP_STD_VER <= 17 + template <class _Key, class _Tp, class _Compare, class _Allocator> inline _LIBCPP_INLINE_VISIBILITY void @@ -1732,7 +1763,7 @@ __x.swap(__y); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Key, class _Tp, class _Compare, class _Allocator, class _Predicate> inline _LIBCPP_INLINE_VISIBILITY @@ -1800,7 +1831,7 @@ typedef _VSTD::reverse_iterator<iterator> reverse_iterator; typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 typedef __map_node_handle<typename __base::__node, allocator_type> node_type; #endif @@ -1846,7 +1877,7 @@ insert(__f, __l); } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _InputIterator> _LIBCPP_INLINE_VISIBILITY multimap(_InputIterator __f, _InputIterator __l, const allocator_type& __a) @@ -1910,7 +1941,7 @@ insert(__il.begin(), __il.end()); } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 _LIBCPP_INLINE_VISIBILITY multimap(initializer_list<value_type> __il, const allocator_type& __a) : multimap(__il, key_compare(), __a) {} @@ -2053,7 +2084,7 @@ iterator erase(const_iterator __f, const_iterator __l) {return __tree_.erase(__f.__i_, __l.__i_);} -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_INLINE_VISIBILITY iterator insert(node_type&& __nh) { @@ -2127,7 +2158,7 @@ iterator find(const key_type& __k) {return __tree_.find(__k);} _LIBCPP_INLINE_VISIBILITY const_iterator find(const key_type& __k) const {return __tree_.find(__k);} -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <typename _K2> _LIBCPP_INLINE_VISIBILITY __enable_if_t<__is_transparent<_Compare, _K2>::value, iterator> @@ -2141,21 +2172,21 @@ _LIBCPP_INLINE_VISIBILITY size_type count(const key_type& __k) const {return __tree_.__count_multi(__k);} -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <typename _K2> _LIBCPP_INLINE_VISIBILITY __enable_if_t<__is_transparent<_Compare, _K2>::value, size_type> count(const _K2& __k) const {return __tree_.__count_multi(__k);} #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY bool contains(const key_type& __k) const {return find(__k) != end();} template <typename _K2> _LIBCPP_INLINE_VISIBILITY __enable_if_t<__is_transparent<_Compare, _K2>::value, bool> contains(const _K2& __k) const { return find(__k) != end(); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY iterator lower_bound(const key_type& __k) @@ -2163,7 +2194,7 @@ _LIBCPP_INLINE_VISIBILITY const_iterator lower_bound(const key_type& __k) const {return __tree_.lower_bound(__k);} -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <typename _K2> _LIBCPP_INLINE_VISIBILITY __enable_if_t<__is_transparent<_Compare, _K2>::value, iterator> @@ -2181,7 +2212,7 @@ _LIBCPP_INLINE_VISIBILITY const_iterator upper_bound(const key_type& __k) const {return __tree_.upper_bound(__k);} -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <typename _K2> _LIBCPP_INLINE_VISIBILITY __enable_if_t<__is_transparent<_Compare, _K2>::value, iterator> @@ -2198,7 +2229,7 @@ _LIBCPP_INLINE_VISIBILITY pair<const_iterator,const_iterator> equal_range(const key_type& __k) const {return __tree_.__equal_range_multi(__k);} -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <typename _K2> _LIBCPP_INLINE_VISIBILITY __enable_if_t<__is_transparent<_Compare, _K2>::value, pair<iterator,iterator>> @@ -2271,6 +2302,8 @@ return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin()); } +#if _LIBCPP_STD_VER <= 17 + template <class _Key, class _Tp, class _Compare, class _Allocator> inline _LIBCPP_INLINE_VISIBILITY bool @@ -2316,6 +2349,24 @@ return !(__y < __x); } +#else // #if _LIBCPP_STD_VER <= 17 + +template<class _Key, class _Tp, class _Compare, class _Allocator> +inline _LIBCPP_HIDE_FROM_ABI +__synth_three_way_result<pair<const _Key, _Tp>> +operator<=>(const multimap<_Key, _Tp, _Compare, _Allocator>& __x, + const multimap<_Key, _Tp, _Compare, _Allocator>& __y) +{ + return std::lexicographical_compare_three_way( + __x.begin(), + __x.end(), + __y.begin(), + __y.end(), + std::__synth_three_way<pair<const _Key, _Tp>, pair<const _Key, _Tp>>); +} + +#endif // #if _LIBCPP_STD_VER <= 17 + template <class _Key, class _Tp, class _Compare, class _Allocator> inline _LIBCPP_INLINE_VISIBILITY void @@ -2326,7 +2377,7 @@ __x.swap(__y); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Key, class _Tp, class _Compare, class _Allocator, class _Predicate> inline _LIBCPP_INLINE_VISIBILITY @@ -2339,7 +2390,7 @@ _LIBCPP_END_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD namespace pmr { template <class _KeyT, class _ValueT, class _CompareT = std::less<_KeyT>> @@ -2353,8 +2404,10 @@ #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <concepts> +# include <cstdlib> # include <functional> # include <iterator> +# include <type_traits> # include <utility> #endif
diff --git a/third_party/llvm-project/libcxx/include/memory b/third_party/llvm-project/libcxx/include/memory index 0a7787a..24344d8 100644 --- a/third_party/llvm-project/libcxx/include/memory +++ b/third_party/llvm-project/libcxx/include/memory
@@ -917,9 +917,11 @@ #endif #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <atomic> # include <concepts> # include <cstddef> # include <cstdint> +# include <cstdlib> # include <cstring> # include <iosfwd> # include <iterator>
diff --git a/third_party/llvm-project/libcxx/include/module.modulemap.in b/third_party/llvm-project/libcxx/include/module.modulemap.in index 1f1d67d..7a7edbf 100644 --- a/third_party/llvm-project/libcxx/include/module.modulemap.in +++ b/third_party/llvm-project/libcxx/include/module.modulemap.in
@@ -2,12 +2,11 @@ // since __config may be included from C headers which may create an // include cycle. module std_config [system] [extern_c] { - header "__config" + textual header "__config" export * } module std [system] { - export std_config // FIXME: The standard does not require that each of these submodules // re-exports its imported modules. We should provide an alternative form of // export that issues a warning if a name from the submodule is used, and @@ -62,23 +61,25 @@ module stdbool_h { // <stdbool.h>'s __bool_true_false_are_defined macro requires textual inclusion. textual header "stdbool.h" + export * } module stddef_h { // <stddef.h>'s __need_* macros require textual inclusion. textual header "stddef.h" + export * } module stdint_h { header "stdint.h" export * // FIXME: This module only exists on OS X and for some reason the - // wildcard above doesn't export it. + // wildcard above doesn't export it. Removing this breaks the tests + // for C compatibility headers in C++17 mode with modules enabled. export Darwin.C.stdint } module stdio_h { // <stdio.h>'s __need_* macros require textual inclusion. textual header "stdio.h" export * - export Darwin.C.stdio } module stdlib_h { // <stdlib.h>'s __need_* macros require textual inclusion. @@ -289,6 +290,9 @@ export * } module lexicographical_compare { private header "__algorithm/lexicographical_compare.h" } + module lexicographical_compare_three_way { + private header "__algorithm/lexicographical_compare_three_way.h" + } module lower_bound { private header "__algorithm/lower_bound.h" } module make_heap { private header "__algorithm/make_heap.h" } module make_projected { private header "__algorithm/make_projected.h" } @@ -298,7 +302,10 @@ module min { private header "__algorithm/min.h" } module min_element { private header "__algorithm/min_element.h" } module min_max_result { private header "__algorithm/min_max_result.h" } - module minmax { private header "__algorithm/minmax.h" } + module minmax { + private header "__algorithm/minmax.h" + export * + } module minmax_element { private header "__algorithm/minmax_element.h" } module mismatch { private header "__algorithm/mismatch.h" } module move { private header "__algorithm/move.h" } @@ -596,11 +603,15 @@ module stable_partition { private header "__algorithm/stable_partition.h" } module stable_sort { private header "__algorithm/stable_sort.h" } module swap_ranges { private header "__algorithm/swap_ranges.h" } + module three_way_comp_ref_type { private header "__algorithm/three_way_comp_ref_type.h" } module transform { private header "__algorithm/transform.h" } module unique { private header "__algorithm/unique.h" } module unique_copy { private header "__algorithm/unique_copy.h" } module unwrap_iter { private header "__algorithm/unwrap_iter.h" } - module unwrap_range { private header "__algorithm/unwrap_range.h" } + module unwrap_range { + private header "__algorithm/unwrap_range.h" + export utility.__utility.pair + } module upper_bound { private header "__algorithm/upper_bound.h" } } } @@ -618,6 +629,26 @@ module atomic { header "atomic" export * + + module __atomic { + module aliases { + private header "__atomic/aliases.h" + export atomic + } + module atomic { private header "__atomic/atomic.h" } + module atomic_base { private header "__atomic/atomic_base.h" } + module atomic_flag { private header "__atomic/atomic_flag.h" } + module atomic_init { private header "__atomic/atomic_init.h" } + module atomic_lock_free { private header "__atomic/atomic_lock_free.h" } + module atomic_sync { private header "__atomic/atomic_sync.h" } + module check_memory_order { private header "__atomic/check_memory_order.h" } + module contention_t { private header "__atomic/contention_t.h" } + module cxx_atomic_impl { private header "__atomic/cxx_atomic_impl.h" } + module fence { private header "__atomic/fence.h" } + module is_always_lock_free { private header "__atomic/is_always_lock_free.h" } + module kill_dependency { private header "__atomic/kill_dependency.h" } + module memory_order { private header "__atomic/memory_order.h" } + } } module barrier { @requires_LIBCXX_ENABLE_THREADS@ @@ -656,11 +687,16 @@ export * module __charconv { - module chars_format { private header "__charconv/chars_format.h" } - module from_chars_result { private header "__charconv/from_chars_result.h" } - module tables { private header "__charconv/tables.h" } - module to_chars_base_10 { private header "__charconv/to_chars_base_10.h" } - module to_chars_result { private header "__charconv/to_chars_result.h" } + module chars_format { private header "__charconv/chars_format.h" } + module from_chars_integral { private header "__charconv/from_chars_integral.h" } + module from_chars_result { private header "__charconv/from_chars_result.h" } + module tables { private header "__charconv/tables.h" } + module to_chars { private header "__charconv/to_chars.h" } + module to_chars_base_10 { private header "__charconv/to_chars_base_10.h" } + module to_chars_floating_point { private header "__charconv/to_chars_floating_point.h" } + module to_chars_integral { private header "__charconv/to_chars_integral.h" } + module to_chars_result { private header "__charconv/to_chars_result.h" } + module traits { private header "__charconv/traits.h" } } } @@ -670,6 +706,7 @@ module __chrono { module calendar { private header "__chrono/calendar.h" } + module concepts { private header "__chrono/concepts.h" } module convert_to_timespec { private header "__chrono/convert_to_timespec.h" } module convert_to_tm { private header "__chrono/convert_to_tm.h" } module day { private header "__chrono/day.h" } @@ -755,13 +792,19 @@ module derived_from { private header "__concepts/derived_from.h" } module destructible { private header "__concepts/destructible.h" } module different_from { private header "__concepts/different_from.h" } - module equality_comparable { private header "__concepts/equality_comparable.h" } + module equality_comparable { + private header "__concepts/equality_comparable.h" + export type_traits.common_reference + } module invocable { private header "__concepts/invocable.h" } module movable { private header "__concepts/movable.h" } module predicate { private header "__concepts/predicate.h" } module regular { private header "__concepts/regular.h" } module relation { private header "__concepts/relation.h" } - module same_as { private header "__concepts/same_as.h" } + module same_as { + private header "__concepts/same_as.h" + export type_traits.is_same + } module semiregular { private header "__concepts/semiregular.h" } module swappable { private header "__concepts/swappable.h" } module totally_ordered { private header "__concepts/totally_ordered.h" } @@ -770,9 +813,12 @@ module condition_variable { header "condition_variable" export * + + module __condition_variable { + module condition_variable { private header "__condition_variable/condition_variable.h" } + } } module coroutine { - requires coroutines header "coroutine" export compare export * @@ -792,6 +838,14 @@ module exception { header "exception" export * + + module __exception { + module exception { private header "__exception/exception.h" } + module exception_ptr { private header "__exception/exception_ptr.h" } + module nested_exception { private header "__exception/nested_exception.h" } + module operations { private header "__exception/operations.h" } + module terminate { private header "__exception/terminate.h" } + } } module execution { header "execution" @@ -850,9 +904,13 @@ private header "__format/format_context.h" export optional export locale + export __locale } module format_error { private header "__format/format_error.h" } - module format_functions { private header "__format/format_functions.h" } + module format_functions { + private header "__format/format_functions.h" + export string + } module format_fwd { private header "__format/format_fwd.h" } module format_parse_context { private header "__format/format_parse_context.h" } module format_string { private header "__format/format_string.h" } @@ -979,7 +1037,11 @@ module back_insert_iterator { private header "__iterator/back_insert_iterator.h" } module bounded_iter { private header "__iterator/bounded_iter.h" } module common_iterator { private header "__iterator/common_iterator.h" } - module concepts { private header "__iterator/concepts.h" } + module concepts { + private header "__iterator/concepts.h" + export concepts.equality_comparable + export type_traits.common_reference + } module counted_iterator { private header "__iterator/counted_iterator.h" } module data { private header "__iterator/data.h" } module default_sentinel { private header "__iterator/default_sentinel.h" } @@ -1012,7 +1074,10 @@ module permutable { private header "__iterator/permutable.h" } module prev { private header "__iterator/prev.h" } module projected { private header "__iterator/projected.h" } - module readable_traits { private header "__iterator/readable_traits.h" } + module readable_traits { + private header "__iterator/readable_traits.h" + export __iterator.iterator_traits + } module reverse_access { private header "__iterator/reverse_access.h" } module reverse_iterator { private header "__iterator/reverse_iterator.h" } module segmented_iterator { private header "__iterator/segmented_iterator.h" } @@ -1061,6 +1126,7 @@ module __memory { module addressof { private header "__memory/addressof.h" } module align { private header "__memory/align.h" } + module aligned_alloc { private header "__memory/aligned_alloc.h" } module allocate_at_least { private header "__memory/allocate_at_least.h" } module allocation_guard { private header "__memory/allocation_guard.h" } module allocator { private header "__memory/allocator.h" } @@ -1071,7 +1137,10 @@ module auto_ptr { private header "__memory/auto_ptr.h" } module builtin_new_allocator { private header "__memory/builtin_new_allocator.h" } module compressed_pair { private header "__memory/compressed_pair.h" } - module concepts { private header "__memory/concepts.h" } + module concepts { + private header "__memory/concepts.h" + export type_traits.remove_reference + } module construct_at { private header "__memory/construct_at.h" } module destruct_n { private header "__memory/destruct_n.h" } module pointer_traits { private header "__memory/pointer_traits.h" } @@ -1110,6 +1179,13 @@ @requires_LIBCXX_ENABLE_THREADS@ header "mutex" export * + + module __mutex { + module lock_guard { private header "__mutex/lock_guard.h" } + module mutex { private header "__mutex/mutex.h" } + module tag_types { private header "__mutex/tag_types.h" } + module unique_lock { private header "__mutex/unique_lock.h" } + } } module new { header "new" @@ -1339,6 +1415,7 @@ export string_view module __string { module char_traits { private header "__string/char_traits.h" } + module constexpr_c_functions { private header "__string/constexpr_c_functions.h" } module extern_template_lists { private header "__string/extern_template_lists.h" } module string_fwd { private header "__fwd/string.h" } } @@ -1357,7 +1434,24 @@ } module system_error { header "system_error" + export __errc export * + module __system_error { + module errc { private header "__system_error/errc.h" } + module error_category { private header "__system_error/error_category.h" } + module error_code { + private header "__system_error/error_code.h" + export functional.__functional.hash + export functional.__functional.unary_function + } + module error_condition { + private header "__system_error/error_condition.h" + export functional.__functional.hash + export functional.__functional.unary_function + } + module system_error { private header "__system_error/system_error.h" } + + } } module thread { @requires_LIBCXX_ENABLE_THREADS@ @@ -1373,18 +1467,18 @@ header "tuple" export * - module apply_cv { private header "__tuple_dir/apply_cv.h" } + module apply_cv { private header "__tuple/apply_cv.h" } module get_fwd { private header "__fwd/get.h" } - module make_tuple_types { private header "__tuple_dir/make_tuple_types.h" } - module pair_like { private header "__tuple_dir/pair_like.h" } - module sfinae_helpers { private header "__tuple_dir/sfinae_helpers.h" } - module tuple_element { private header "__tuple_dir/tuple_element.h" } + module make_tuple_types { private header "__tuple/make_tuple_types.h" } + module pair_like { private header "__tuple/pair_like.h" } + module sfinae_helpers { private header "__tuple/sfinae_helpers.h" } + module tuple_element { private header "__tuple/tuple_element.h" } module tuple_fwd { private header "__fwd/tuple.h" } - module tuple_indices { private header "__tuple_dir/tuple_indices.h" } - module tuple_like { private header "__tuple_dir/tuple_like.h" } - module tuple_like_ext { private header "__tuple_dir/tuple_like_ext.h" } - module tuple_size { private header "__tuple_dir/tuple_size.h" } - module tuple_types { private header "__tuple_dir/tuple_types.h" } + module tuple_indices { private header "__tuple/tuple_indices.h" } + module tuple_like { private header "__tuple/tuple_like.h" } + module tuple_like_ext { private header "__tuple/tuple_like_ext.h" } + module tuple_size { private header "__tuple/tuple_size.h" } + module tuple_types { private header "__tuple/tuple_types.h" } } module type_traits { header "type_traits" @@ -1449,6 +1543,10 @@ module is_destructible { private header "__type_traits/is_destructible.h" } module is_empty { private header "__type_traits/is_empty.h" } module is_enum { private header "__type_traits/is_enum.h" } + module is_equality_comparable { + private header "__type_traits/is_equality_comparable.h" + export integral_constant + } module is_final { private header "__type_traits/is_final.h" } module is_floating_point { private header "__type_traits/is_floating_point.h" } module is_function { private header "__type_traits/is_function.h" } @@ -1519,6 +1617,7 @@ module nat { private header "__type_traits/nat.h" } module negation { private header "__type_traits/negation.h" } module noexcept_move_assign_container { private header "__type_traits/noexcept_move_assign_container.h" } + module predicate_traits { private header "__type_traits/predicate_traits.h" } module promote { private header "__type_traits/promote.h" } module rank { private header "__type_traits/rank.h" } module remove_all_extents { private header "__type_traits/remove_all_extents.h" } @@ -1534,7 +1633,11 @@ module strip_signature { private header "__type_traits/strip_signature.h" } module type_identity { private header "__type_traits/type_identity.h" } module type_list { private header "__type_traits/type_list.h" } - module underlying_type { private header "__type_traits/underlying_type.h" } + module underlying_type { + private header "__type_traits/underlying_type.h" + + export type_traits + } module void_t { private header "__type_traits/void_t.h" } } module typeindex { @@ -1562,7 +1665,10 @@ module __utility { module as_const { private header "__utility/as_const.h" } - module auto_cast { private header "__utility/auto_cast.h" } + module auto_cast { + private header "__utility/auto_cast.h" + export type_traits.decay + } module cmp { private header "__utility/cmp.h" } module convert_to_integral { private header "__utility/convert_to_integral.h" } module declval { private header "__utility/declval.h" } @@ -1611,20 +1717,14 @@ module __availability { private header "__availability" export * } module __bit_reference { private header "__bit_reference" export * } module __debug { header "__debug" export * } - module __errc { private header "__errc" export * } module __hash_table { header "__hash_table" export * } module __locale { @requires_LIBCXX_ENABLE_LOCALIZATION@ private header "__locale" export * } module __mbstate_t { private header "__mbstate_t.h" export * } - module __mutex_base { private header "__mutex_base" export * } module __node_handle { private header "__node_handle" export * } module __split_buffer { private header "__split_buffer" export * } - module __std_stream { - @requires_LIBCXX_ENABLE_LOCALIZATION@ - private header "__std_stream" export * - } module __threading_support { header "__threading_support" export * } module __tree { header "__tree" export * } module __undef_macros { header "__undef_macros" export * } @@ -1633,15 +1733,6 @@ module experimental { requires cplusplus11 - module algorithm { - header "experimental/algorithm" - export * - } - module coroutine { - requires coroutines - header "experimental/coroutine" - export * - } module deque { header "experimental/deque" export * @@ -1650,10 +1741,6 @@ header "experimental/forward_list" export * } - module functional { - header "experimental/functional" - export * - } module iterator { header "experimental/iterator" export *
diff --git a/third_party/llvm-project/libcxx/include/mutex b/third_party/llvm-project/libcxx/include/mutex index d93fba8..ed9b43d 100644 --- a/third_party/llvm-project/libcxx/include/mutex +++ b/third_party/llvm-project/libcxx/include/mutex
@@ -187,9 +187,15 @@ */ #include <__assert> // all public C++ headers provide the assertion handler +#include <__chrono/steady_clock.h> +#include <__chrono/time_point.h> +#include <__condition_variable/condition_variable.h> #include <__config> #include <__memory/shared_ptr.h> -#include <__mutex_base> +#include <__mutex/lock_guard.h> +#include <__mutex/mutex.h> +#include <__mutex/tag_types.h> +#include <__mutex/unique_lock.h> #include <__threading_support> #include <__utility/forward.h> #include <cstdint> @@ -262,9 +268,9 @@ { using namespace chrono; unique_lock<mutex> __lk(__m_); - bool no_timeout = _Clock::now() < __t; - while (no_timeout && __locked_) - no_timeout = __cv_.wait_until(__lk, __t) == cv_status::no_timeout; + bool __no_timeout = _Clock::now() < __t; + while (__no_timeout && __locked_) + __no_timeout = __cv_.wait_until(__lk, __t) == cv_status::no_timeout; if (!__locked_) { __locked_ = true; @@ -304,7 +310,7 @@ { using namespace chrono; __thread_id __id = this_thread::get_id(); - unique_lock<mutex> lk(__m_); + unique_lock<mutex> __lk(__m_); if (__id == __id_) { if (__count_ == numeric_limits<size_t>::max()) @@ -312,9 +318,9 @@ ++__count_; return true; } - bool no_timeout = _Clock::now() < __t; - while (no_timeout && __count_ != 0) - no_timeout = __cv_.wait_until(lk, __t) == cv_status::no_timeout; + bool __no_timeout = _Clock::now() < __t; + while (__no_timeout && __count_ != 0) + __no_timeout = __cv_.wait_until(__lk, __t) == cv_status::no_timeout; if (__count_ == 0) { __count_ = 1; @@ -328,7 +334,7 @@ _LIBCPP_HIDE_FROM_ABI int try_lock(_L0& __l0, _L1& __l1) { - unique_lock<_L0> __u0(__l0, try_to_lock); + unique_lock<_L0> __u0(__l0, try_to_lock_t()); if (__u0.owns_lock()) { if (__l1.try_lock()) @@ -467,7 +473,7 @@ #endif // _LIBCPP_CXX03_LANG -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class ..._Mutexes> class _LIBCPP_TEMPLATE_VIS scoped_lock; @@ -544,7 +550,7 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(scoped_lock); -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 #endif // !_LIBCPP_HAS_NO_THREADS struct _LIBCPP_TEMPLATE_VIS once_flag; @@ -704,9 +710,18 @@ _LIBCPP_POP_MACROS #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <atomic> # include <concepts> +# include <cstdlib> +# include <cstring> +# include <ctime> # include <functional> +# include <initializer_list> +# include <new> +# include <stdexcept> +# include <system_error> # include <type_traits> +# include <typeinfo> #endif #endif // _LIBCPP_MUTEX
diff --git a/third_party/llvm-project/libcxx/include/new b/third_party/llvm-project/libcxx/include/new index 0c826f4..af396cd 100644 --- a/third_party/llvm-project/libcxx/include/new +++ b/third_party/llvm-project/libcxx/include/new
@@ -89,12 +89,14 @@ #include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__config> +#include <__exception/exception.h> +#include <__type_traits/alignment_of.h> #include <__type_traits/is_function.h> #include <__type_traits/is_same.h> #include <__type_traits/remove_cv.h> +#include <__verbose_abort> #include <cstddef> #include <cstdlib> -#include <exception> #include <version> #if defined(_LIBCPP_ABI_VCRUNTIME) @@ -173,10 +175,10 @@ _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY void __throw_bad_array_new_length() { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw bad_array_new_length(); #else - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("bad_array_new_length was thrown in -fno-exceptions mode"); #endif } @@ -189,14 +191,14 @@ #endif #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // Enable the declaration even if the compiler doesn't support the language // feature. struct destroying_delete_t { explicit destroying_delete_t() = default; }; inline constexpr destroying_delete_t destroying_delete{}; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 } // namespace std @@ -332,46 +334,6 @@ #endif } -#if !defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) -// Low-level helpers to call the aligned allocation and deallocation functions -// on the target platform. This is used to implement libc++'s own memory -// allocation routines -- if you need to allocate memory inside the library, -// chances are that you want to use `__libcpp_allocate` instead. -// -// Returns the allocated memory, or `nullptr` on failure. -inline _LIBCPP_INLINE_VISIBILITY void* __libcpp_aligned_alloc(std::size_t __alignment, std::size_t __size) { -# if defined(_LIBCPP_MSVCRT_LIKE) - return ::_aligned_malloc(__size, __alignment); -# elif _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_C11_ALIGNED_ALLOC) - // aligned_alloc() requires that __size is a multiple of __alignment, - // but for C++ [new.delete.general], only states "if the value of an - // alignment argument passed to any of these functions is not a valid - // alignment value, the behavior is undefined". - // To handle calls such as ::operator new(1, std::align_val_t(128)), we - // round __size up to the next multiple of __alignment. - size_t __rounded_size = (__size + __alignment - 1) & ~(__alignment - 1); - // Rounding up could have wrapped around to zero, so we have to add another - // max() ternary to the actual call site to avoid succeeded in that case. - return ::aligned_alloc(__alignment, __size > __rounded_size ? __size : __rounded_size); -# else - void* __result = nullptr; - (void)::posix_memalign(&__result, __alignment, __size); - // If posix_memalign fails, __result is unmodified so we still return `nullptr`. - return __result; -# endif -} - -inline _LIBCPP_INLINE_VISIBILITY -void __libcpp_aligned_free(void* __ptr) { -#if defined(_LIBCPP_MSVCRT_LIKE) - ::_aligned_free(__ptr); -#else - ::free(__ptr); -#endif -} -#endif // !_LIBCPP_HAS_NO_ALIGNED_ALLOCATION - - template <class _Tp> _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __launder(_Tp* __p) _NOEXCEPT @@ -381,7 +343,7 @@ return __builtin_launder(__p); } -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> _LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_HIDE_FROM_ABI constexpr _Tp* launder(_Tp* __p) noexcept @@ -390,7 +352,7 @@ } #endif -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 #if defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE) @@ -399,11 +361,12 @@ #endif // defined(__GCC_DESTRUCTIVE_SIZE) && defined(__GCC_CONSTRUCTIVE_SIZE) -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <exception> # include <type_traits> #endif
diff --git a/third_party/llvm-project/libcxx/include/numbers b/third_party/llvm-project/libcxx/include/numbers index 72034a6..ec9eea5 100644 --- a/third_party/llvm-project/libcxx/include/numbers +++ b/third_party/llvm-project/libcxx/include/numbers
@@ -63,7 +63,7 @@ #include <__config> #include <version> -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -128,7 +128,7 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <concepts>
diff --git a/third_party/llvm-project/libcxx/include/optional b/third_party/llvm-project/libcxx/include/optional index 6a7e2d2..ddb3f19 100644 --- a/third_party/llvm-project/libcxx/include/optional +++ b/third_party/llvm-project/libcxx/include/optional
@@ -165,16 +165,26 @@ #include <__functional/hash.h> #include <__functional/invoke.h> #include <__functional/unary_function.h> +#include <__memory/addressof.h> #include <__memory/construct_at.h> -#include <__tuple_dir/sfinae_helpers.h> +#include <__tuple/sfinae_helpers.h> +#include <__type_traits/conjunction.h> +#include <__type_traits/disjunction.h> +#include <__type_traits/is_trivially_copy_assignable.h> +#include <__type_traits/is_trivially_copy_constructible.h> +#include <__type_traits/is_trivially_destructible.h> +#include <__type_traits/is_trivially_move_assignable.h> +#include <__type_traits/is_trivially_move_constructible.h> +#include <__type_traits/negation.h> +#include <__utility/declval.h> #include <__utility/forward.h> #include <__utility/in_place.h> #include <__utility/move.h> #include <__utility/swap.h> +#include <__verbose_abort> #include <initializer_list> #include <new> #include <stdexcept> -#include <type_traits> #include <version> // standard-mandated includes @@ -200,7 +210,7 @@ } // namespace std -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -208,10 +218,10 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS void __throw_bad_optional_access() { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw bad_optional_access(); #else - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("bad_optional_access was thrown in -fno-exceptions mode"); #endif } @@ -259,7 +269,7 @@ : __val_(_VSTD::forward<_Args>(__args)...), __engaged_(true) {} -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <class _Fp, class... _Args> _LIBCPP_HIDE_FROM_ABI constexpr __optional_destruct_base(__optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args) @@ -301,7 +311,7 @@ : __val_(_VSTD::forward<_Args>(__args)...), __engaged_(true) {} -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <class _Fp, class... _Args> _LIBCPP_HIDE_FROM_ABI constexpr __optional_destruct_base(__optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args) @@ -357,7 +367,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void __construct(_Args&&... __args) { _LIBCPP_ASSERT(!has_value(), "__construct called for engaged __optional_storage"); -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _VSTD::construct_at(_VSTD::addressof(this->__val_), _VSTD::forward<_Args>(__args)...); #else ::new ((void*)_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Args>(__args)...); @@ -805,7 +815,7 @@ this->__construct_from(_VSTD::move(__v)); } -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template<class _Fp, class... _Args> _LIBCPP_HIDE_FROM_ABI constexpr explicit optional(__optional_construct_from_invoke_tag, _Fp&& __f, _Args&&... __args) @@ -1047,7 +1057,7 @@ static_cast<value_type>(_VSTD::forward<_Up>(__v)); } -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template<class _Func> _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS constexpr auto and_then(_Func&& __f) & { @@ -1171,7 +1181,7 @@ return _VSTD::move(*this); return _VSTD::forward<_Func>(__f)(); } -#endif // _LIBCPP_STD_VER > 20 +#endif // _LIBCPP_STD_VER >= 23 using __base::reset; }; @@ -1572,7 +1582,7 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <atomic> @@ -1583,6 +1593,7 @@ # include <memory> # include <ratio> # include <tuple> +# include <type_traits> # include <typeinfo> # include <utility> # include <variant>
diff --git a/third_party/llvm-project/libcxx/include/ostream b/third_party/llvm-project/libcxx/include/ostream index 4780c76..610a283 100644 --- a/third_party/llvm-project/libcxx/include/ostream +++ b/third_party/llvm-project/libcxx/include/ostream
@@ -165,8 +165,15 @@ #include <__assert> // all public C++ headers provide the assertion handler #include <__config> +#include <__exception/operations.h> #include <__memory/shared_ptr.h> #include <__memory/unique_ptr.h> +#include <__system_error/error_code.h> +#include <__type_traits/conjunction.h> +#include <__type_traits/enable_if.h> +#include <__type_traits/is_base_of.h> +#include <__type_traits/void_t.h> +#include <__utility/declval.h> #include <bitset> #include <ios> #include <locale> @@ -244,7 +251,7 @@ basic_ostream& operator<<(long double __f); basic_ostream& operator<<(const void* __p); -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 _LIBCPP_HIDE_FROM_ABI basic_ostream& operator<<(const volatile void* __p) { return operator<<(const_cast<const void*>(__p)); @@ -253,7 +260,7 @@ basic_ostream& operator<<(basic_streambuf<char_type, traits_type>* __sb); -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 // LWG 2221 - nullptr. This is not backported to older standards modes. // See https://reviews.llvm.org/D127033 for more info on the rationale. _LIBCPP_INLINE_VISIBILITY @@ -314,18 +321,18 @@ if (__os_.rdbuf() && __os_.good() && (__os_.flags() & ios_base::unitbuf) && !uncaught_exception()) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS if (__os_.rdbuf()->pubsync() == -1) __os_.setstate(ios_base::badbit); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } } @@ -352,19 +359,19 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_type>* __sb) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { if (__sb) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS typedef istreambuf_iterator<_CharT, _Traits> _Ip; typedef ostreambuf_iterator<_CharT, _Traits> _Op; _Ip __i(__sb); @@ -379,24 +386,24 @@ } if (__c == 0) this->setstate(ios_base::failbit); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_failbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } else this->setstate(ios_base::badbit); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } @@ -404,10 +411,10 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(bool __n) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { @@ -416,13 +423,13 @@ if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } @@ -430,10 +437,10 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(short __n) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { @@ -446,13 +453,13 @@ static_cast<long>(__n)).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } @@ -460,10 +467,10 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { @@ -472,13 +479,13 @@ if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } @@ -486,10 +493,10 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(int __n) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { @@ -502,13 +509,13 @@ static_cast<long>(__n)).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } @@ -516,10 +523,10 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { @@ -528,13 +535,13 @@ if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } @@ -542,10 +549,10 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long __n) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { @@ -554,13 +561,13 @@ if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } @@ -568,10 +575,10 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { @@ -580,13 +587,13 @@ if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } @@ -594,10 +601,10 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long long __n) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { @@ -606,13 +613,13 @@ if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } @@ -620,10 +627,10 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { @@ -632,13 +639,13 @@ if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } @@ -646,10 +653,10 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(float __n) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { @@ -658,13 +665,13 @@ if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } @@ -672,10 +679,10 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(double __n) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { @@ -684,13 +691,13 @@ if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } @@ -698,10 +705,10 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long double __n) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { @@ -710,13 +717,13 @@ if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } @@ -724,10 +731,10 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(const void* __n) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { @@ -736,13 +743,13 @@ if (__f.put(*this, *this, this->fill(), __n).failed()) this->setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } @@ -751,10 +758,10 @@ __put_character_sequence(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str, size_t __len) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS typename basic_ostream<_CharT, _Traits>::sentry __s(__os); if (__s) { @@ -769,13 +776,13 @@ __os.fill()).failed()) __os.setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __os.__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return __os; } @@ -791,10 +798,10 @@ _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS typename basic_ostream<_CharT, _Traits>::sentry __s(__os); if (__s) { @@ -810,13 +817,13 @@ __os.fill()).failed()) __os.setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __os.__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return __os; } @@ -852,10 +859,10 @@ _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS typename basic_ostream<_CharT, _Traits>::sentry __s(__os); if (__s) { @@ -884,13 +891,13 @@ __os.fill()).failed()) __os.setstate(ios_base::badbit | ios_base::failbit); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __os.__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return __os; } @@ -921,10 +928,10 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::put(char_type __c) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __s(*this); if (__s) { @@ -934,13 +941,13 @@ if (__o.failed()) this->setstate(ios_base::badbit); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } @@ -948,23 +955,23 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS sentry __sen(*this); if (__sen && __n) { if (this->rdbuf()->sputn(__s, __n) != __n) this->setstate(ios_base::badbit); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } @@ -972,10 +979,10 @@ basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::flush() { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS if (this->rdbuf()) { sentry __s(*this); @@ -985,13 +992,13 @@ this->setstate(ios_base::badbit); } } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { this->__set_badbit_and_consider_rethrow(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS return *this; } @@ -1130,7 +1137,7 @@ std::use_facet<ctype<_CharT> >(__os.getloc()).widen('1')); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template <class _Traits> @@ -1179,7 +1186,7 @@ template <class _Traits> basic_ostream<char, _Traits>& operator<<(basic_ostream<char, _Traits>&, const char32_t*) = delete; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 extern template class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<char>; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS @@ -1189,7 +1196,9 @@ _LIBCPP_END_NAMESPACE_STD #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <atomic> # include <concepts> +# include <cstdlib> # include <iterator> # include <type_traits> #endif
diff --git a/third_party/llvm-project/libcxx/include/queue b/third_party/llvm-project/libcxx/include/queue index 6c1b892..9690aaf 100644 --- a/third_party/llvm-project/libcxx/include/queue +++ b/third_party/llvm-project/libcxx/include/queue
@@ -227,7 +227,6 @@ #include <__memory/uses_allocator.h> #include <__utility/forward.h> #include <deque> -#include <type_traits> #include <vector> #include <version> @@ -278,7 +277,7 @@ _LIBCPP_INLINE_VISIBILITY queue(const queue& __q) : c(__q.c) {} -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <class _InputIterator, class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>> _LIBCPP_HIDE_FROM_ABI @@ -363,7 +362,7 @@ void push(value_type&& __v) {c.push_back(_VSTD::move(__v));} template <class... _Args> _LIBCPP_INLINE_VISIBILITY -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 decltype(auto) emplace(_Args&&... __args) { return c.emplace_back(_VSTD::forward<_Args>(__args)...);} #else @@ -397,7 +396,7 @@ operator< (const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y); }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template<class _Container, class = enable_if_t<!__is_allocator<_Container>::value> > @@ -413,7 +412,7 @@ -> queue<typename _Container::value_type, _Container>; #endif -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <class _InputIterator, class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>> queue(_InputIterator, _InputIterator) @@ -964,7 +963,9 @@ #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <concepts> +# include <cstdlib> # include <functional> +# include <type_traits> #endif #endif // _LIBCPP_QUEUE
diff --git a/third_party/llvm-project/libcxx/include/random b/third_party/llvm-project/libcxx/include/random index 5fe4906..02d71ad 100644 --- a/third_party/llvm-project/libcxx/include/random +++ b/third_party/llvm-project/libcxx/include/random
@@ -1734,6 +1734,7 @@ # include <concepts> # include <cstddef> # include <cstdint> +# include <cstdlib> # include <iosfwd> # include <limits> # include <numeric>
diff --git a/third_party/llvm-project/libcxx/include/ranges b/third_party/llvm-project/libcxx/include/ranges index f999fa0..8f3b4b2 100644 --- a/third_party/llvm-project/libcxx/include/ranges +++ b/third_party/llvm-project/libcxx/include/ranges
@@ -49,6 +49,8 @@ using range_reference_t = iter_reference_t<iterator_t<R>>; template<range R> using range_rvalue_reference_t = iter_rvalue_reference_t<iterator_t<R>>; + template <range R> + using range_common_reference_t = iter_common_reference_t<iterator_t<R>>; // [range.sized], sized ranges template<class> @@ -375,7 +377,6 @@ #include <__ranges/view_interface.h> #include <__ranges/views.h> #include <__ranges/zip_view.h> -#include <type_traits> #include <version> #if !defined(_LIBCPP_HAS_NO_LOCALIZATION) @@ -390,11 +391,16 @@ #include <iterator> // [tuple.helper] -#include <__tuple_dir/tuple_element.h> -#include <__tuple_dir/tuple_size.h> +#include <__tuple/tuple_element.h> +#include <__tuple/tuple_size.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <cstdlib> +# include <type_traits> +#endif + #endif // _LIBCPP_RANGES
diff --git a/third_party/llvm-project/libcxx/include/ratio b/third_party/llvm-project/libcxx/include/ratio index 3969a39..327e08c 100644 --- a/third_party/llvm-project/libcxx/include/ratio +++ b/third_party/llvm-project/libcxx/include/ratio
@@ -501,7 +501,7 @@ __static_lcm<_R1::den, _R2::den>::value> type; }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _R1, class _R2> inline constexpr bool ratio_equal_v = ratio_equal<_R1, _R2>::value;
diff --git a/third_party/llvm-project/libcxx/include/regex b/third_party/llvm-project/libcxx/include/regex index 06c017f..f89b828 100644 --- a/third_party/llvm-project/libcxx/include/regex +++ b/third_party/llvm-project/libcxx/include/regex
@@ -225,6 +225,8 @@ int compare(const sub_match& s) const; int compare(const string_type& s) const; int compare(const value_type* s) const; + + void swap(sub_match& s) noexcept(see below); }; typedef sub_match<const char*> csub_match; @@ -770,10 +772,11 @@ #include <__iterator/wrap_iter.h> #include <__locale> #include <__memory_resource/polymorphic_allocator.h> +#include <__type_traits/is_swappable.h> #include <__utility/move.h> #include <__utility/pair.h> #include <__utility/swap.h> -#include <cstring> +#include <__verbose_abort> #include <deque> #include <stdexcept> #include <string> @@ -1012,10 +1015,10 @@ _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY void __throw_regex_error() { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw regex_error(_Ev); #else - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("regex_error was thrown in -fno-exceptions mode"); #endif } @@ -4131,9 +4134,9 @@ { // Found [= // This means =] must exist - value_type _Equal_close[2] = {'=', ']'}; - _ForwardIterator __temp = _VSTD::search(__first, __last, _Equal_close, - _Equal_close+2); + value_type __equal_close[2] = {'=', ']'}; + _ForwardIterator __temp = _VSTD::search(__first, __last, __equal_close, + __equal_close+2); if (__temp == __last) __throw_regex_error<regex_constants::error_brack>(); // [__first, __temp) contains all text in [= ... =] @@ -4173,9 +4176,9 @@ { // Found [: // This means :] must exist - value_type _Colon_close[2] = {':', ']'}; - _ForwardIterator __temp = _VSTD::search(__first, __last, _Colon_close, - _Colon_close+2); + value_type __colon_close[2] = {':', ']'}; + _ForwardIterator __temp = _VSTD::search(__first, __last, __colon_close, + __colon_close+2); if (__temp == __last) __throw_regex_error<regex_constants::error_brack>(); // [__first, __temp) contains all text in [: ... :] @@ -4198,9 +4201,9 @@ { // Found [. // This means .] must exist - value_type _Dot_close[2] = {'.', ']'}; - _ForwardIterator __temp = _VSTD::search(__first, __last, _Dot_close, - _Dot_close+2); + value_type __dot_close[2] = {'.', ']'}; + _ForwardIterator __temp = _VSTD::search(__first, __last, __dot_close, + __dot_close+2); if (__temp == __last) __throw_regex_error<regex_constants::error_brack>(); // [__first, __temp) contains all text in [. ... .] @@ -5009,6 +5012,16 @@ _LIBCPP_INLINE_VISIBILITY int compare(const value_type* __s) const {return str().compare(__s);} + + _LIBCPP_HIDE_FROM_ABI + void swap(sub_match& __s) +#ifndef _LIBCPP_CXX03_LANG + _NOEXCEPT(__is_nothrow_swappable<_BidirectionalIterator>::value) +#endif // _LIBCPP_CXX03_LANG + { + this->pair<_BidirectionalIterator, _BidirectionalIterator>::swap(__s); + std::swap(matched, __s.matched); + } }; template <class _BiIter> @@ -5861,7 +5874,7 @@ { deque<__state> __states; ptrdiff_t __highest_j = 0; - ptrdiff_t _Np = _VSTD::distance(__first, __last); + ptrdiff_t __np = _VSTD::distance(__first, __last); __node* __st = __start_.get(); if (__st) { @@ -5904,7 +5917,7 @@ if (!__matched || __highest_j < __s.__current_ - __s.__first_) __highest_j = __s.__current_ - __s.__first_; __matched = true; - if (__highest_j == _Np) + if (__highest_j == __np) __states.clear(); else __states.pop_back(); @@ -5956,7 +5969,7 @@ vector<__state> __states; __state __best_state; ptrdiff_t __highest_j = 0; - ptrdiff_t _Np = _VSTD::distance(__first, __last); + ptrdiff_t __np = _VSTD::distance(__first, __last); __node* __st = __start_.get(); if (__st) { @@ -6008,7 +6021,7 @@ __best_state = __s; } __matched = true; - if (__highest_j == _Np) + if (__highest_j == __np) __states.clear(); else __states.pop_back(); @@ -6214,7 +6227,7 @@ return __r; } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _ST, class _SA, class _Ap, class _Cp, class _Tp> bool regex_search(const basic_string<_Cp, _ST, _SA>&& __s, @@ -6277,7 +6290,7 @@ return _VSTD::regex_match(__s.begin(), __s.end(), __m, __e, __flags); } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _ST, class _SA, class _Allocator, class _CharT, class _Traits> inline _LIBCPP_INLINE_VISIBILITY bool @@ -6350,7 +6363,7 @@ const regex_type& __re, regex_constants::match_flag_type __m = regex_constants::match_default); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 regex_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b, const regex_type&& __re, regex_constants::match_flag_type __m @@ -6482,7 +6495,7 @@ const regex_type& __re, int __submatch = 0, regex_constants::match_flag_type __m = regex_constants::match_default); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b, const regex_type&& __re, int __submatch = 0, regex_constants::match_flag_type __m = @@ -6493,7 +6506,7 @@ const regex_type& __re, const vector<int>& __submatches, regex_constants::match_flag_type __m = regex_constants::match_default); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b, const regex_type&& __re, const vector<int>& __submatches, regex_constants::match_flag_type __m = @@ -6507,7 +6520,7 @@ regex_constants::match_flag_type __m = regex_constants::match_default); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b, const regex_type&& __re, initializer_list<int> __submatches, @@ -6522,7 +6535,7 @@ const int (&__submatches)[_Np], regex_constants::match_flag_type __m = regex_constants::match_default); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <size_t _Np> regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b, @@ -6844,7 +6857,7 @@ _LIBCPP_END_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD namespace pmr { template <class _BidirT> @@ -6866,9 +6879,11 @@ #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <atomic> # include <concepts> +# include <cstdlib> # include <iosfwd> # include <iterator> # include <new> +# include <type_traits> # include <typeinfo> # include <utility> #endif
diff --git a/third_party/llvm-project/libcxx/include/scoped_allocator b/third_party/llvm-project/libcxx/include/scoped_allocator index 461c67e..f6160b5 100644 --- a/third_party/llvm-project/libcxx/include/scoped_allocator +++ b/third_party/llvm-project/libcxx/include/scoped_allocator
@@ -678,7 +678,7 @@ template <class...> friend class __scoped_allocator_storage; }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template<class _OuterAlloc, class... _InnerAllocs> scoped_allocator_adaptor(_OuterAlloc, _InnerAllocs...) -> scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>;
diff --git a/third_party/llvm-project/libcxx/include/semaphore b/third_party/llvm-project/libcxx/include/semaphore index ddccb28..cfbc247 100644 --- a/third_party/llvm-project/libcxx/include/semaphore +++ b/third_party/llvm-project/libcxx/include/semaphore
@@ -46,12 +46,15 @@ */ #include <__assert> // all public C++ headers provide the assertion handler +#include <__atomic/atomic_base.h> +#include <__atomic/atomic_sync.h> +#include <__atomic/memory_order.h> #include <__availability> #include <__chrono/time_point.h> #include <__config> #include <__thread/timed_backoff_policy.h> #include <__threading_support> -#include <atomic> +#include <cstddef> #include <limits> #include <version> @@ -172,11 +175,11 @@ _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY bool try_acquire_until(chrono::time_point<Clock, Duration> const& __abs_time) { - auto const current = Clock::now(); - if (current >= __abs_time) + auto const __current = Clock::now(); + if (__current >= __abs_time) return try_acquire(); else - return try_acquire_for(__abs_time - current); + return try_acquire_for(__abs_time - __current); } }; @@ -188,4 +191,8 @@ _LIBCPP_POP_MACROS +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <atomic> +#endif + #endif //_LIBCPP_SEMAPHORE
diff --git a/third_party/llvm-project/libcxx/include/set b/third_party/llvm-project/libcxx/include/set index 1154c4e..05bffe6 100644 --- a/third_party/llvm-project/libcxx/include/set +++ b/third_party/llvm-project/libcxx/include/set
@@ -547,7 +547,7 @@ typedef _VSTD::reverse_iterator<iterator> reverse_iterator; typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 typedef __set_node_handle<typename __base::__node, allocator_type> node_type; typedef __insert_return_type<iterator, node_type> insert_return_type; #endif @@ -593,7 +593,7 @@ insert(__f, __l); } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _InputIterator> _LIBCPP_INLINE_VISIBILITY set(_InputIterator __f, _InputIterator __l, const allocator_type& __a) @@ -650,7 +650,7 @@ insert(__il.begin(), __il.end()); } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 _LIBCPP_INLINE_VISIBILITY set(initializer_list<value_type> __il, const allocator_type& __a) : set(__il, key_compare(), __a) {} @@ -767,7 +767,7 @@ _LIBCPP_INLINE_VISIBILITY void clear() _NOEXCEPT {__tree_.clear();} -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_INLINE_VISIBILITY insert_return_type insert(node_type&& __nh) { @@ -844,7 +844,7 @@ iterator find(const key_type& __k) {return __tree_.find(__k);} _LIBCPP_INLINE_VISIBILITY const_iterator find(const key_type& __k) const {return __tree_.find(__k);} -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <typename _K2> _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type @@ -858,21 +858,21 @@ _LIBCPP_INLINE_VISIBILITY size_type count(const key_type& __k) const {return __tree_.__count_unique(__k);} -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <typename _K2> _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type count(const _K2& __k) const {return __tree_.__count_multi(__k);} #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY bool contains(const key_type& __k) const {return find(__k) != end();} template <typename _K2> _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type contains(const _K2& __k) const { return find(__k) != end(); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY iterator lower_bound(const key_type& __k) @@ -880,7 +880,7 @@ _LIBCPP_INLINE_VISIBILITY const_iterator lower_bound(const key_type& __k) const {return __tree_.lower_bound(__k);} -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <typename _K2> _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type @@ -898,7 +898,7 @@ _LIBCPP_INLINE_VISIBILITY const_iterator upper_bound(const key_type& __k) const {return __tree_.upper_bound(__k);} -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <typename _K2> _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type @@ -915,7 +915,7 @@ _LIBCPP_INLINE_VISIBILITY pair<const_iterator,const_iterator> equal_range(const key_type& __k) const {return __tree_.__equal_range_unique(__k);} -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <typename _K2> _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type @@ -1038,7 +1038,7 @@ __x.swap(__y); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Key, class _Compare, class _Allocator, class _Predicate> inline _LIBCPP_INLINE_VISIBILITY typename set<_Key, _Compare, _Allocator>::size_type @@ -1084,7 +1084,7 @@ typedef _VSTD::reverse_iterator<iterator> reverse_iterator; typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 typedef __set_node_handle<typename __base::__node, allocator_type> node_type; #endif @@ -1121,7 +1121,7 @@ insert(__f, __l); } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _InputIterator> _LIBCPP_INLINE_VISIBILITY multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a) @@ -1186,7 +1186,7 @@ insert(__il.begin(), __il.end()); } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 _LIBCPP_INLINE_VISIBILITY multiset(initializer_list<value_type> __il, const allocator_type& __a) : multiset(__il, key_compare(), __a) {} @@ -1302,7 +1302,7 @@ _LIBCPP_INLINE_VISIBILITY void clear() _NOEXCEPT {__tree_.clear();} -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_INLINE_VISIBILITY iterator insert(node_type&& __nh) { @@ -1380,7 +1380,7 @@ iterator find(const key_type& __k) {return __tree_.find(__k);} _LIBCPP_INLINE_VISIBILITY const_iterator find(const key_type& __k) const {return __tree_.find(__k);} -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <typename _K2> _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type @@ -1394,21 +1394,21 @@ _LIBCPP_INLINE_VISIBILITY size_type count(const key_type& __k) const {return __tree_.__count_multi(__k);} -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <typename _K2> _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,size_type>::type count(const _K2& __k) const {return __tree_.__count_multi(__k);} #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY bool contains(const key_type& __k) const {return find(__k) != end();} template <typename _K2> _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value, bool>::type contains(const _K2& __k) const { return find(__k) != end(); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY iterator lower_bound(const key_type& __k) @@ -1416,7 +1416,7 @@ _LIBCPP_INLINE_VISIBILITY const_iterator lower_bound(const key_type& __k) const {return __tree_.lower_bound(__k);} -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <typename _K2> _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type @@ -1434,7 +1434,7 @@ _LIBCPP_INLINE_VISIBILITY const_iterator upper_bound(const key_type& __k) const {return __tree_.upper_bound(__k);} -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <typename _K2> _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type @@ -1451,7 +1451,7 @@ _LIBCPP_INLINE_VISIBILITY pair<const_iterator,const_iterator> equal_range(const key_type& __k) const {return __tree_.__equal_range_multi(__k);} -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <typename _K2> _LIBCPP_INLINE_VISIBILITY typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type @@ -1573,7 +1573,7 @@ __x.swap(__y); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Key, class _Compare, class _Allocator, class _Predicate> inline _LIBCPP_INLINE_VISIBILITY typename multiset<_Key, _Compare, _Allocator>::size_type @@ -1584,7 +1584,7 @@ _LIBCPP_END_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD namespace pmr { template <class _KeyT, class _CompareT = std::less<_KeyT>> @@ -1598,8 +1598,10 @@ #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <concepts> +# include <cstdlib> # include <functional> # include <iterator> +# include <type_traits> #endif #endif // _LIBCPP_SET
diff --git a/third_party/llvm-project/libcxx/include/shared_mutex b/third_party/llvm-project/libcxx/include/shared_mutex index 6919898..db35514 100644 --- a/third_party/llvm-project/libcxx/include/shared_mutex +++ b/third_party/llvm-project/libcxx/include/shared_mutex
@@ -124,16 +124,25 @@ #include <__assert> // all public C++ headers provide the assertion handler #include <__availability> +#include <__chrono/duration.h> +#include <__chrono/steady_clock.h> +#include <__chrono/time_point.h> +#include <__condition_variable/condition_variable.h> #include <__config> +#include <__memory/addressof.h> +#include <__mutex/mutex.h> +#include <__mutex/tag_types.h> +#include <__mutex/unique_lock.h> +#include <__system_error/system_error.h> +#include <__utility/swap.h> +#include <cerrno> #include <version> _LIBCPP_PUSH_MACROS #include <__undef_macros> -#if _LIBCPP_STD_VER > 11 || defined(_LIBCPP_BUILDING_LIBRARY) - -#include <__mutex_base> +#if _LIBCPP_STD_VER >= 14 || defined(_LIBCPP_BUILDING_LIBRARY) #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -177,7 +186,7 @@ }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_SHARED_MUTEX shared_mutex { __shared_mutex_base __base_; @@ -293,11 +302,11 @@ { while (true) { - cv_status status = __base_.__gate1_.wait_until(__lk, __abs_time); + cv_status __status = __base_.__gate1_.wait_until(__lk, __abs_time); if ((__base_.__state_ & __base_.__write_entered_) == 0 && (__base_.__state_ & __base_.__n_readers_) < __base_.__n_readers_) break; - if (status == cv_status::timeout) + if (__status == cv_status::timeout) return false; } } @@ -502,8 +511,12 @@ _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 11 +#endif // _LIBCPP_STD_VER >= 14 _LIBCPP_POP_MACROS +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <system_error> +#endif + #endif // _LIBCPP_SHARED_MUTEX
diff --git a/third_party/llvm-project/libcxx/include/source_location b/third_party/llvm-project/libcxx/include/source_location index 4c4a096..e9e852a 100644 --- a/third_party/llvm-project/libcxx/include/source_location +++ b/third_party/llvm-project/libcxx/include/source_location
@@ -35,7 +35,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER >= 20 && __has_builtin(__builtin_source_location) +#if _LIBCPP_STD_VER >= 20 && __has_builtin(__builtin_source_location) && \ + !(defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER <= 1403) class source_location { // The names source_location::__impl, _M_file_name, _M_function_name, _M_line, and _M_column @@ -78,7 +79,8 @@ } }; -#endif // _LIBCPP_STD_VER >= 20 && __has_builtin(__builtin_source_location) +#endif // _LIBCPP_STD_VER >= 20 && __has_builtin(__builtin_source_location) && !(defined(_LIBCPP_APPLE_CLANG_VER) && + // _LIBCPP_APPLE_CLANG_VER <= 1403) _LIBCPP_END_NAMESPACE_STD
diff --git a/third_party/llvm-project/libcxx/include/span b/third_party/llvm-project/libcxx/include/span index 23af04f..2ef1ea6 100644 --- a/third_party/llvm-project/libcxx/include/span +++ b/third_party/llvm-project/libcxx/include/span
@@ -141,11 +141,14 @@ #include <__ranges/enable_borrowed_range.h> #include <__ranges/enable_view.h> #include <__ranges/size.h> +#include <__type_traits/is_convertible.h> +#include <__type_traits/remove_cvref.h> +#include <__type_traits/remove_reference.h> +#include <__type_traits/type_identity.h> #include <__utility/forward.h> #include <array> // for array #include <cstddef> // for byte #include <limits> -#include <type_traits> // for remove_cv, etc #include <version> // standard-mandated includes @@ -166,7 +169,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Tp> struct __is_std_array : false_type {}; @@ -238,10 +241,12 @@ template <__span_compatible_iterator<element_type> _It, __span_compatible_sentinel_for<_It> _End> _LIBCPP_INLINE_VISIBILITY constexpr explicit span(_It __first, _End __last) : __data_{_VSTD::to_address(__first)} { - (void)__last; - _LIBCPP_ASSERT((__last - __first >= 0), "invalid range in span's constructor (iterator, sentinel)"); - _LIBCPP_ASSERT(__last - __first == _Extent, - "invalid range in span's constructor (iterator, sentinel): last - first != extent"); + // [span.cons]/10 + // Throws: When and what last - first throws. + [[maybe_unused]] auto __dist = __last - __first; + _LIBCPP_ASSERT(__dist >= 0, "invalid range in span's constructor (iterator, sentinel)"); + _LIBCPP_ASSERT( + __dist == _Extent, "invalid range in span's constructor (iterator, sentinel): last - first != extent"); } _LIBCPP_INLINE_VISIBILITY constexpr span(type_identity_t<element_type> (&__arr)[_Extent]) noexcept : __data_{__arr} {} @@ -566,10 +571,10 @@ auto as_writable_bytes(span<_Tp, _Extent> __s) noexcept { return __s.__as_writable_bytes(); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template<contiguous_iterator _It, class _EndOrSize> span(_It, _EndOrSize) -> span<remove_reference_t<iter_reference_t<_It>>>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 template<class _Tp, size_t _Sz> span(_Tp (&)[_Sz]) -> span<_Tp, _Sz>; @@ -583,7 +588,7 @@ template<ranges::contiguous_range _Range> span(_Range&&) -> span<remove_reference_t<ranges::range_reference_t<_Range>>>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD @@ -593,6 +598,7 @@ # include <concepts> # include <functional> # include <iterator> +# include <type_traits> #endif #endif // _LIBCPP_SPAN
diff --git a/third_party/llvm-project/libcxx/include/sstream b/third_party/llvm-project/libcxx/include/sstream index 78cc28a..389bbf6 100644 --- a/third_party/llvm-project/libcxx/include/sstream +++ b/third_party/llvm-project/libcxx/include/sstream
@@ -541,10 +541,10 @@ { if (!(__mode_ & ios_base::out)) return traits_type::eof(); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS ptrdiff_t __nout = this->pptr() - this->pbase(); ptrdiff_t __hm = __hm_ - this->pbase(); __str_.push_back(char_type()); @@ -553,13 +553,13 @@ this->setp(__p, __p + __str_.size()); this->__pbump(__nout); __hm_ = this->pbase() + __hm; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { return traits_type::eof(); } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } __hm_ = _VSTD::max(this->pptr() + 1, __hm_); if (__mode_ & ios_base::in)
diff --git a/third_party/llvm-project/libcxx/include/stack b/third_party/llvm-project/libcxx/include/stack index d653d1b..318c9c7 100644 --- a/third_party/llvm-project/libcxx/include/stack +++ b/third_party/llvm-project/libcxx/include/stack
@@ -102,9 +102,9 @@ #include <__config> #include <__iterator/iterator_traits.h> #include <__memory/uses_allocator.h> +#include <__type_traits/is_same.h> #include <__utility/forward.h> #include <deque> -#include <type_traits> #include <version> // standard-mandated includes @@ -204,7 +204,7 @@ : c(_VSTD::move(__s.c), __a) {} #endif // _LIBCPP_CXX03_LANG -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <class _InputIterator, class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>> _LIBCPP_HIDE_FROM_ABI @@ -235,7 +235,7 @@ template <class... _Args> _LIBCPP_INLINE_VISIBILITY -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 decltype(auto) emplace(_Args&&... __args) { return c.emplace_back(_VSTD::forward<_Args>(__args)...);} #else @@ -268,7 +268,7 @@ operator< (const stack<T1, _C1>& __x, const stack<T1, _C1>& __y); }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template<class _Container, class = enable_if_t<!__is_allocator<_Container>::value> > @@ -284,7 +284,7 @@ -> stack<typename _Container::value_type, _Container>; #endif -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template<class _InputIterator, class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value>> stack(_InputIterator, _InputIterator) @@ -366,6 +366,7 @@ #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <concepts> # include <functional> +# include <type_traits> #endif #endif // _LIBCPP_STACK
diff --git a/third_party/llvm-project/libcxx/include/stdatomic.h b/third_party/llvm-project/libcxx/include/stdatomic.h index ff2a568..9c002e5 100644 --- a/third_party/llvm-project/libcxx/include/stdatomic.h +++ b/third_party/llvm-project/libcxx/include/stdatomic.h
@@ -121,7 +121,7 @@ # pragma GCC system_header #endif -#if defined(__cplusplus) && _LIBCPP_STD_VER > 20 +#if defined(__cplusplus) && _LIBCPP_STD_VER >= 23 #include <atomic> #include <version> @@ -230,6 +230,6 @@ # include_next <stdatomic.h> # endif -#endif // defined(__cplusplus) && _LIBCPP_STD_VER > 20 +#endif // defined(__cplusplus) && _LIBCPP_STD_VER >= 23 #endif // _LIBCPP_STDATOMIC_H
diff --git a/third_party/llvm-project/libcxx/include/stdexcept b/third_party/llvm-project/libcxx/include/stdexcept index 68de6ce..8e2f985 100644 --- a/third_party/llvm-project/libcxx/include/stdexcept +++ b/third_party/llvm-project/libcxx/include/stdexcept
@@ -43,8 +43,8 @@ #include <__assert> // all public C++ headers provide the assertion handler #include <__config> -#include <cstdlib> -#include <exception> +#include <__exception/exception.h> +#include <__verbose_abort> #include <iosfwd> // for string forward decl #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -220,91 +220,88 @@ _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY void __throw_logic_error(const char*__msg) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw logic_error(__msg); #else - ((void)__msg); - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("logic_error was thrown in -fno-exceptions mode with message \"%s\"", __msg); #endif } _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY void __throw_domain_error(const char*__msg) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw domain_error(__msg); #else - ((void)__msg); - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("domain_error was thrown in -fno-exceptions mode with message \"%s\"", __msg); #endif } _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY void __throw_invalid_argument(const char*__msg) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw invalid_argument(__msg); #else - ((void)__msg); - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("invalid_argument was thrown in -fno-exceptions mode with message \"%s\"", __msg); #endif } _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY void __throw_length_error(const char*__msg) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw length_error(__msg); #else - ((void)__msg); - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("length_error was thrown in -fno-exceptions mode with message \"%s\"", __msg); #endif } _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY void __throw_out_of_range(const char*__msg) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw out_of_range(__msg); #else - ((void)__msg); - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("out_of_range was thrown in -fno-exceptions mode with message \"%s\"", __msg); #endif } _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY void __throw_range_error(const char*__msg) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw range_error(__msg); #else - ((void)__msg); - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("range_error was thrown in -fno-exceptions mode with message \"%s\"", __msg); #endif } _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY void __throw_overflow_error(const char*__msg) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw overflow_error(__msg); #else - ((void)__msg); - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("overflow_error was thrown in -fno-exceptions mode with message \"%s\"", __msg); #endif } _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY void __throw_underflow_error(const char*__msg) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw underflow_error(__msg); #else - ((void)__msg); - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("underflow_error was thrown in -fno-exceptions mode with message \"%s\"", __msg); #endif } _LIBCPP_END_NAMESPACE_STD +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <cstdlib> +# include <exception> +#endif + #endif // _LIBCPP_STDEXCEPT
diff --git a/third_party/llvm-project/libcxx/include/string b/third_party/llvm-project/libcxx/include/string index 9f5838d..1de3fb7 100644 --- a/third_party/llvm-project/libcxx/include/string +++ b/third_party/llvm-project/libcxx/include/string
@@ -550,6 +550,7 @@ #include <__iterator/iterator_traits.h> #include <__iterator/reverse_iterator.h> #include <__iterator/wrap_iter.h> +#include <__memory/addressof.h> #include <__memory/allocate_at_least.h> #include <__memory/allocator.h> #include <__memory/allocator_traits.h> @@ -561,7 +562,15 @@ #include <__string/char_traits.h> #include <__string/extern_template_lists.h> #include <__type_traits/is_allocator.h> +#include <__type_traits/is_array.h> +#include <__type_traits/is_convertible.h> +#include <__type_traits/is_nothrow_default_constructible.h> +#include <__type_traits/is_nothrow_move_assignable.h> +#include <__type_traits/is_same.h> +#include <__type_traits/is_standard_layout.h> +#include <__type_traits/is_trivial.h> #include <__type_traits/noexcept_move_assign_container.h> +#include <__type_traits/remove_cvref.h> #include <__utility/auto_cast.h> #include <__utility/move.h> #include <__utility/swap.h> @@ -569,12 +578,10 @@ #include <climits> #include <cstdint> #include <cstdio> // EOF -#include <cstdlib> #include <cstring> #include <limits> #include <stdexcept> #include <string_view> -#include <type_traits> #include <version> #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS @@ -842,8 +849,23 @@ __default_init(); } - _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const basic_string& __str); - _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const basic_string& __str, const allocator_type& __a); + _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const basic_string& __str) + : __r_(__default_init_tag(), __alloc_traits::select_on_container_copy_construction(__str.__alloc())) { + if (!__str.__is_long()) + __r_.first() = __str.__r_.first(); + else + __init_copy_ctor_external(std::__to_address(__str.__get_long_pointer()), __str.__get_long_size()); + std::__debug_db_insert_c(this); + } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const basic_string& __str, const allocator_type& __a) + : __r_(__default_init_tag(), __a) { + if (!__str.__is_long()) + __r_.first() = __str.__r_.first(); + else + __init_copy_ctor_external(std::__to_address(__str.__get_long_pointer()), __str.__get_long_size()); + std::__debug_db_insert_c(this); + } #ifndef _LIBCPP_CXX03_LANG _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(basic_string&& __str) @@ -875,7 +897,7 @@ } #endif // _LIBCPP_CXX03_LANG - template <class = __enable_if_t<__is_allocator<_Allocator>::value, nullptr_t> > + template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s) : __r_(__default_init_tag(), __default_init_tag()) { _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr"); @@ -883,10 +905,15 @@ std::__debug_db_insert_c(this); } - template <class = __enable_if_t<__is_allocator<_Allocator>::value, nullptr_t> > - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, const _Allocator& __a); + template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const _CharT* __s, const _Allocator& __a) + : __r_(__default_init_tag(), __a) { + _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*, allocator) detected nullptr"); + __init(__s, traits_type::length(__s)); + std::__debug_db_insert_c(this); + } -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 basic_string(nullptr_t) = delete; #endif @@ -911,7 +938,7 @@ std::__debug_db_insert_c(this); } -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 _LIBCPP_HIDE_FROM_ABI constexpr basic_string(basic_string&& __str, size_type __pos, const _Allocator& __alloc = _Allocator()) : basic_string(std::move(__str), __pos, npos, __alloc) {} @@ -941,11 +968,22 @@ } #endif - template <class = __enable_if_t<__is_allocator<_Allocator>::value, nullptr_t> > - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(size_type __n, _CharT __c, const _Allocator& __a); + template <__enable_if_t<__is_allocator<_Allocator>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(size_type __n, _CharT __c, const _Allocator& __a) + : __r_(__default_init_tag(), __a) { + __init(__n, __c); + std::__debug_db_insert_c(this); + } _LIBCPP_CONSTEXPR_SINCE_CXX20 - basic_string(const basic_string& __str, size_type __pos, size_type __n, const _Allocator& __a = _Allocator()); + basic_string(const basic_string& __str, size_type __pos, size_type __n, const _Allocator& __a = _Allocator()) + : __r_(__default_init_tag(), __a) { + size_type __str_sz = __str.size(); + if (__pos > __str_sz) + __throw_out_of_range(); + __init(__str.data() + __pos, std::min(__n, __str_sz - __pos)); + std::__debug_db_insert_c(this); + } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(const basic_string& __str, size_type __pos, const _Allocator& __a = _Allocator()) @@ -958,31 +996,49 @@ } template <class _Tp, - class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && - !__is_same_uncvref<_Tp, basic_string>::value> > + __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && + !__is_same_uncvref<_Tp, basic_string>::value, + int> = 0> _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - basic_string(const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a = allocator_type()); + basic_string(const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a = allocator_type()) + : __r_(__default_init_tag(), __a) { + __self_view __sv0 = __t; + __self_view __sv = __sv0.substr(__pos, __n); + __init(__sv.data(), __sv.size()); + std::__debug_db_insert_c(this); + } template <class _Tp, - class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && - !__is_same_uncvref<_Tp, basic_string>::value> > - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string( - const _Tp& __t); + __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && + !__is_same_uncvref<_Tp, basic_string>::value, + int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string(const _Tp& __t) + : __r_(__default_init_tag(), __default_init_tag()) { + __self_view __sv = __t; + __init(__sv.data(), __sv.size()); + std::__debug_db_insert_c(this); + } template <class _Tp, - class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && - !__is_same_uncvref<_Tp, basic_string>::value> > + __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && + !__is_same_uncvref<_Tp, basic_string>::value, + int> = 0> _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit basic_string( - const _Tp& __t, const allocator_type& __a); + const _Tp& __t, const allocator_type& __a) + : __r_(__default_init_tag(), __a) { + __self_view __sv = __t; + __init(__sv.data(), __sv.size()); + std::__debug_db_insert_c(this); + } - template <class _InputIterator, class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value> > + template <class _InputIterator, __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(_InputIterator __first, _InputIterator __last) : __r_(__default_init_tag(), __default_init_tag()) { __init(__first, __last); std::__debug_db_insert_c(this); } - template <class _InputIterator, class = __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value> > + template <class _InputIterator, __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a) : __r_(__default_init_tag(), __a) { @@ -1004,15 +1060,19 @@ } #endif // _LIBCPP_CXX03_LANG - inline _LIBCPP_CONSTEXPR_SINCE_CXX20 ~basic_string(); + inline _LIBCPP_CONSTEXPR_SINCE_CXX20 ~basic_string() { + std::__debug_db_erase_c(this); + if (__is_long()) + __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap()); + } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 operator __self_view() const _NOEXCEPT { return __self_view(data(), size()); } _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(const basic_string& __str); - template <class _Tp, class = __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && - !__is_same_uncvref<_Tp, basic_string>::value> > + template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && + !__is_same_uncvref<_Tp, basic_string>::value, int> = 0> _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(const _Tp& __t) { __self_view __sv = __t; return assign(__sv); @@ -1030,7 +1090,7 @@ #endif _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(const value_type* __s) {return assign(__s);} -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 basic_string& operator=(nullptr_t) = delete; #endif _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator=(value_type __c); @@ -1097,7 +1157,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void reserve(size_type __requested_capacity); -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <class _Op> _LIBCPP_HIDE_FROM_ABI constexpr void resize_and_overwrite(size_type __n, _Op __op) { @@ -1132,14 +1192,11 @@ return append(__str); } - template <class _Tp> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value - && !__is_same_uncvref<_Tp, basic_string >::value, - basic_string& - > + template <class _Tp, + __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && + !__is_same_uncvref<_Tp, basic_string >::value, + int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& operator+=(const _Tp& __t) { __self_view __sv = __t; return append(__sv); } @@ -1162,25 +1219,27 @@ return append(__str.data(), __str.size()); } - template <class _Tp> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t< - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value - && !__is_same_uncvref<_Tp, basic_string>::value, - basic_string& - > - append(const _Tp& __t) { __self_view __sv = __t; return append(__sv.data(), __sv.size()); } + template <class _Tp, + __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && + !__is_same_uncvref<_Tp, basic_string>::value, + int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& + append(const _Tp& __t) { + __self_view __sv = __t; + return append(__sv.data(), __sv.size()); + } + _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const basic_string& __str, size_type __pos, size_type __n=npos); - template <class _Tp> + template <class _Tp, + __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && + !__is_same_uncvref<_Tp, basic_string>::value, + int> = 0> _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value - && !__is_same_uncvref<_Tp, basic_string>::value, - basic_string& - > - append(const _Tp& __t, size_type __pos, size_type __n=npos); + + basic_string& + append(const _Tp& __t, size_type __pos, size_type __n = npos); + _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s, size_type __n); _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(const value_type* __s); _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(size_type __n, value_type __c); @@ -1188,27 +1247,16 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __append_default_init(size_type __n); - template<class _InputIterator> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS - __enable_if_t - < - __is_exactly_cpp17_input_iterator<_InputIterator>::value, - basic_string& - > - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 + template <class _InputIterator, __enable_if_t<__is_exactly_cpp17_input_iterator<_InputIterator>::value, int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(_InputIterator __first, _InputIterator __last) { - const basic_string __temp(__first, __last, __alloc()); - append(__temp.data(), __temp.size()); - return *this; + const basic_string __temp(__first, __last, __alloc()); + append(__temp.data(), __temp.size()); + return *this; } - template<class _ForwardIterator> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS - __enable_if_t - < - __is_cpp17_forward_iterator<_ForwardIterator>::value, - basic_string& - > - _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 + + template <class _ForwardIterator, __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value, int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& append(_ForwardIterator __first, _ForwardIterator __last); #ifndef _LIBCPP_CXX03_LANG @@ -1239,14 +1287,13 @@ return *(data() + size() - 1); } - template <class _Tp> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, - basic_string& - > - assign(const _Tp & __t) { __self_view __sv = __t; return assign(__sv.data(), __sv.size()); } + template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& + assign(const _Tp& __t) { + __self_view __sv = __t; + return assign(__sv.data(), __sv.size()); + } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const basic_string& __str) { return *this = __str; } #ifndef _LIBCPP_CXX03_LANG @@ -1256,34 +1303,25 @@ {*this = std::move(__str); return *this;} #endif _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos); - template <class _Tp> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value - && !__is_same_uncvref<_Tp, basic_string>::value, - basic_string& - > - assign(const _Tp & __t, size_type __pos, size_type __n=npos); + + template <class _Tp, + __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && + !__is_same_uncvref<_Tp, basic_string>::value, + int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& + assign(const _Tp& __t, size_type __pos, size_type __n = npos); + _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s, size_type __n); _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(const value_type* __s); _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(size_type __n, value_type __c); - template<class _InputIterator> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __is_exactly_cpp17_input_iterator<_InputIterator>::value, - basic_string& - > - assign(_InputIterator __first, _InputIterator __last); - template<class _ForwardIterator> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __is_cpp17_forward_iterator<_ForwardIterator>::value, - basic_string& - > - assign(_ForwardIterator __first, _ForwardIterator __last); + template <class _InputIterator, __enable_if_t<__is_exactly_cpp17_input_iterator<_InputIterator>::value, int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& + assign(_InputIterator __first, _InputIterator __last); + + template <class _ForwardIterator, __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value, int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& + assign(_ForwardIterator __first, _ForwardIterator __last); + #ifndef _LIBCPP_CXX03_LANG _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& assign(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());} @@ -1294,30 +1332,26 @@ return insert(__pos1, __str.data(), __str.size()); } - template <class _Tp> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, - basic_string& - > - insert(size_type __pos1, const _Tp& __t) - { __self_view __sv = __t; return insert(__pos1, __sv.data(), __sv.size()); } + template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& + insert(size_type __pos1, const _Tp& __t) { + __self_view __sv = __t; + return insert(__pos1, __sv.data(), __sv.size()); + } - template <class _Tp> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value, - basic_string& - > - insert(size_type __pos1, const _Tp& __t, size_type __pos2, size_type __n=npos); - _LIBCPP_CONSTEXPR_SINCE_CXX20 - basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n=npos); - _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& insert(size_type __pos, const value_type* __s, size_type __n); - _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& insert(size_type __pos, const value_type* __s); - _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& insert(size_type __pos, size_type __n, value_type __c); - _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator insert(const_iterator __pos, value_type __c); + template <class _Tp, + __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && + !__is_same_uncvref<_Tp, basic_string>::value, + int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& + insert(size_type __pos1, const _Tp& __t, size_type __pos2, size_type __n = npos); + + _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& + insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n = npos); + _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& insert(size_type __pos, const value_type* __s, size_type __n); + _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& insert(size_type __pos, const value_type* __s); + _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& insert(size_type __pos, size_type __n, value_type __c); + _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator insert(const_iterator __pos, value_type __c); _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator insert(const_iterator __pos, size_type __n, value_type __c) { @@ -1328,22 +1362,14 @@ return begin() + __p; } - template<class _InputIterator> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __is_exactly_cpp17_input_iterator<_InputIterator>::value, - iterator - > - insert(const_iterator __pos, _InputIterator __first, _InputIterator __last); - template<class _ForwardIterator> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __is_cpp17_forward_iterator<_ForwardIterator>::value, - iterator - > - insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last); + template <class _InputIterator, __enable_if_t<__is_exactly_cpp17_input_iterator<_InputIterator>::value, int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator + insert(const_iterator __pos, _InputIterator __first, _InputIterator __last); + + template <class _ForwardIterator, __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value, int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator + insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last); + #ifndef _LIBCPP_CXX03_LANG _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator insert(const_iterator __pos, initializer_list<value_type> __il) @@ -1361,28 +1387,27 @@ return replace(__pos1, __n1, __str.data(), __str.size()); } - template <class _Tp> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, - basic_string& - > - replace(size_type __pos1, size_type __n1, const _Tp& __t) { __self_view __sv = __t; return replace(__pos1, __n1, __sv.data(), __sv.size()); } - _LIBCPP_CONSTEXPR_SINCE_CXX20 - basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos); - template <class _Tp> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value, - basic_string& - > - replace(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2=npos); - _LIBCPP_CONSTEXPR_SINCE_CXX20 - basic_string& replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2); - _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& replace(size_type __pos, size_type __n1, const value_type* __s); - _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c); + template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& + replace(size_type __pos1, size_type __n1, const _Tp& __t) { + __self_view __sv = __t; + return replace(__pos1, __n1, __sv.data(), __sv.size()); + } + + _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& + replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2 = npos); + + template <class _Tp, + __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && + !__is_same_uncvref<_Tp, basic_string>::value, + int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& + replace(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2 = npos); + + _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& + replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2); + _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& replace(size_type __pos, size_type __n1, const value_type* __s); + _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c); _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& replace(const_iterator __i1, const_iterator __i2, const basic_string& __str) { @@ -1390,14 +1415,12 @@ static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __str.data(), __str.size()); } - template <class _Tp> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, - basic_string& - > - replace(const_iterator __i1, const_iterator __i2, const _Tp& __t) { __self_view __sv = __t; return replace(__i1 - begin(), __i2 - __i1, __sv); } + template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& + replace(const_iterator __i1, const_iterator __i2, const _Tp& __t) { + __self_view __sv = __t; + return replace(__i1 - begin(), __i2 - __i1, __sv); + } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& replace(const_iterator __i1, const_iterator __i2, const value_type* __s, size_type __n) { @@ -1414,14 +1437,10 @@ return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __n, __c); } - template<class _InputIterator> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __is_cpp17_input_iterator<_InputIterator>::value, - basic_string& - > - replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2); + template <class _InputIterator, __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value, int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& + replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2); + #ifndef _LIBCPP_CXX03_LANG _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string& replace(const_iterator __i1, const_iterator __i2, initializer_list<value_type> __il) @@ -1460,7 +1479,7 @@ const value_type* c_str() const _NOEXCEPT {return data();} _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const value_type* data() const _NOEXCEPT {return std::__to_address(__get_pointer());} -#if _LIBCPP_STD_VER > 14 || defined(_LIBCPP_BUILDING_LIBRARY) +#if _LIBCPP_STD_VER >= 17 || defined(_LIBCPP_BUILDING_LIBRARY) _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 value_type* data() _NOEXCEPT {return std::__to_address(__get_pointer());} #endif @@ -1471,16 +1490,11 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT; - template <class _Tp> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, - size_type - > - find(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT; - _LIBCPP_CONSTEXPR_SINCE_CXX20 - size_type find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; + template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type + find(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT; + + _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(const value_type* __s, size_type __pos = 0) const _NOEXCEPT; _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT; @@ -1488,14 +1502,10 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT; - template <class _Tp> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, - size_type - > - rfind(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT; + template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type + rfind(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT; + _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type rfind(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 @@ -1505,14 +1515,10 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find_first_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT; - template <class _Tp> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, - size_type - > - find_first_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT; + template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type + find_first_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT; + _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find_first_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 @@ -1523,14 +1529,10 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT; - template <class _Tp> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, - size_type - > - find_last_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT; + template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type + find_last_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT; + _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find_last_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 @@ -1541,14 +1543,10 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT; - template <class _Tp> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, - size_type - > - find_first_not_of(const _Tp &__t, size_type __pos = 0) const _NOEXCEPT; + template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type + find_first_not_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT; + _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find_first_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 @@ -1559,14 +1557,10 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT; - template <class _Tp> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, - size_type - > - find_last_not_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT; + template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type + find_last_not_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT; + _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find_last_not_of(const value_type* __s, size_type __pos, size_type __n) const _NOEXCEPT; _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 @@ -1577,23 +1571,13 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(const basic_string& __str) const _NOEXCEPT; - template <class _Tp> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, - int - > - compare(const _Tp &__t) const _NOEXCEPT; + template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 int + compare(const _Tp& __t) const _NOEXCEPT; - template <class _Tp> - _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, - int - > - compare(size_type __pos1, size_type __n1, const _Tp& __t) const; + template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> = 0> + _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_CONSTEXPR_SINCE_CXX20 int + compare(size_type __pos1, size_type __n1, const _Tp& __t) const; _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(size_type __pos1, size_type __n1, const basic_string& __str) const; @@ -1601,20 +1585,19 @@ int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2 = npos) const; - template <class _Tp> - inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string>::value, - int - > - compare(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2=npos) const; + template <class _Tp, + __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && + !__is_same_uncvref<_Tp, basic_string>::value, + int> = 0> + inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 int + compare(size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2 = npos) const; + _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(const value_type* __s) const _NOEXCEPT; _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(size_type __pos1, size_type __n1, const value_type* __s) const; _LIBCPP_CONSTEXPR_SINCE_CXX20 int compare(size_type __pos1, size_type __n1, const value_type* __s, size_type __n2) const; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 constexpr _LIBCPP_HIDE_FROM_ABI bool starts_with(__self_view __sv) const noexcept { return __self_view(data(), size()).starts_with(__sv); } @@ -1640,7 +1623,7 @@ { return ends_with(__self_view(__s)); } #endif -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 constexpr _LIBCPP_HIDE_FROM_ABI bool contains(__self_view __sv) const noexcept { return __self_view(data(), size()).contains(__sv); } @@ -1683,7 +1666,7 @@ } static _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __begin_lifetime(pointer __begin, size_type __n) { -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 if (__libcpp_is_constant_evaluated()) { for (size_type __i = 0; __i != __n; ++__i) std::construct_at(std::addressof(__begin[__i])); @@ -1691,7 +1674,7 @@ #else (void)__begin; (void)__n; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __default_init() { @@ -1839,21 +1822,11 @@ // to only inline the fast path code directly in the ctor. _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init_copy_ctor_external(const value_type* __s, size_type __sz); - template <class _InputIterator> - inline _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __is_exactly_cpp17_input_iterator<_InputIterator>::value - > - __init(_InputIterator __first, _InputIterator __last); + template <class _InputIterator, __enable_if_t<__is_exactly_cpp17_input_iterator<_InputIterator>::value, int> = 0> + inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init(_InputIterator __first, _InputIterator __last); - template <class _ForwardIterator> - inline _LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __is_cpp17_forward_iterator<_ForwardIterator>::value - > - __init(_ForwardIterator __first, _ForwardIterator __last); + template <class _ForwardIterator, __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value, int> = 0> + inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void __init(_ForwardIterator __first, _ForwardIterator __last); _LIBCPP_CONSTEXPR_SINCE_CXX20 void __grow_by(size_type __old_cap, size_type __delta_cap, size_type __old_sz, @@ -1918,7 +1891,7 @@ _NOEXCEPT_(__alloc_traits::is_always_equal::value); _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign(basic_string& __str, true_type) -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _NOEXCEPT; #else _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value); @@ -2129,44 +2102,6 @@ } template <class _CharT, class _Traits, class _Allocator> -template <class> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const _Allocator& __a) - : __r_(__default_init_tag(), __a) -{ - _LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*, allocator) detected nullptr"); - __init(__s, traits_type::length(__s)); - std::__debug_db_insert_c(this); -} - -template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str) - : __r_(__default_init_tag(), __alloc_traits::select_on_container_copy_construction(__str.__alloc())) -{ - if (!__str.__is_long()) - __r_.first() = __str.__r_.first(); - else - __init_copy_ctor_external(std::__to_address(__str.__get_long_pointer()), - __str.__get_long_size()); - std::__debug_db_insert_c(this); -} - -template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -basic_string<_CharT, _Traits, _Allocator>::basic_string( - const basic_string& __str, const allocator_type& __a) - : __r_(__default_init_tag(), __a) -{ - if (!__str.__is_long()) - __r_.first() = __str.__r_.first(); - else - __init_copy_ctor_external(std::__to_address(__str.__get_long_pointer()), - __str.__get_long_size()); - std::__debug_db_insert_c(this); -} - -template <class _CharT, class _Traits, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external( const value_type* __s, size_type __sz) { @@ -2220,81 +2155,18 @@ } template <class _CharT, class _Traits, class _Allocator> -template <class> +template <class _InputIterator, __enable_if_t<__is_exactly_cpp17_input_iterator<_InputIterator>::value, int> > _LIBCPP_CONSTEXPR_SINCE_CXX20 -basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c, const _Allocator& __a) - : __r_(__default_init_tag(), __a) -{ - __init(__n, __c); - std::__debug_db_insert_c(this); -} - -template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, - size_type __pos, size_type __n, - const _Allocator& __a) - : __r_(__default_init_tag(), __a) -{ - size_type __str_sz = __str.size(); - if (__pos > __str_sz) - __throw_out_of_range(); - __init(__str.data() + __pos, std::min(__n, __str_sz - __pos)); - std::__debug_db_insert_c(this); -} - -template <class _CharT, class _Traits, class _Allocator> -template <class _Tp, class> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -basic_string<_CharT, _Traits, _Allocator>::basic_string( - const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a) - : __r_(__default_init_tag(), __a) -{ - __self_view __sv0 = __t; - __self_view __sv = __sv0.substr(__pos, __n); - __init(__sv.data(), __sv.size()); - std::__debug_db_insert_c(this); -} - -template <class _CharT, class _Traits, class _Allocator> -template <class _Tp, class> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t) - : __r_(__default_init_tag(), __default_init_tag()) -{ - __self_view __sv = __t; - __init(__sv.data(), __sv.size()); - std::__debug_db_insert_c(this); -} - -template <class _CharT, class _Traits, class _Allocator> -template <class _Tp, class> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t, const _Allocator& __a) - : __r_(__default_init_tag(), __a) -{ - __self_view __sv = __t; - __init(__sv.data(), __sv.size()); - std::__debug_db_insert_c(this); -} - -template <class _CharT, class _Traits, class _Allocator> -template <class _InputIterator> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -__enable_if_t -< - __is_exactly_cpp17_input_iterator<_InputIterator>::value -> -basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _InputIterator __last) +void basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _InputIterator __last) { __default_init(); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS for (; __first != __last; ++__first) push_back(*__first); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -2302,16 +2174,12 @@ __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap()); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } template <class _CharT, class _Traits, class _Allocator> -template <class _ForwardIterator> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -__enable_if_t -< - __is_cpp17_forward_iterator<_ForwardIterator>::value -> +template <class _ForwardIterator, __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value, int> > +_LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _ForwardIterator __last) { if (__libcpp_is_constant_evaluated()) @@ -2335,14 +2203,14 @@ __set_long_size(__sz); } -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS for (; __first != __last; ++__first, (void) ++__p) traits_type::assign(*__p, *__first); traits_type::assign(*__p, value_type()); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -2350,16 +2218,7 @@ __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap()); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS -} - -template <class _CharT, class _Traits, class _Allocator> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -basic_string<_CharT, _Traits, _Allocator>::~basic_string() -{ - std::__debug_db_erase_c(this); - if (__is_long()) - __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap()); +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } template <class _CharT, class _Traits, class _Allocator> @@ -2522,7 +2381,7 @@ basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str) { - if (this != &__str) { + if (this != std::addressof(__str)) { __copy_assign_alloc(__str); if (!__is_long()) { if (!__str.__is_long()) { @@ -2555,7 +2414,7 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, true_type) -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _NOEXCEPT #else _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) @@ -2584,13 +2443,8 @@ #endif template <class _CharT, class _Traits, class _Allocator> -template<class _InputIterator> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -__enable_if_t -< - __is_exactly_cpp17_input_iterator<_InputIterator>::value, - basic_string<_CharT, _Traits, _Allocator>& -> +template<class _InputIterator, __enable_if_t<__is_exactly_cpp17_input_iterator<_InputIterator>::value, int> > +_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::assign(_InputIterator __first, _InputIterator __last) { const basic_string __temp(__first, __last, __alloc()); @@ -2599,13 +2453,8 @@ } template <class _CharT, class _Traits, class _Allocator> -template<class _ForwardIterator> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -__enable_if_t -< - __is_cpp17_forward_iterator<_ForwardIterator>::value, - basic_string<_CharT, _Traits, _Allocator>& -> +template<class _ForwardIterator, __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value, int> > +_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last) { size_type __cap = capacity(); @@ -2647,16 +2496,12 @@ } template <class _CharT, class _Traits, class _Allocator> -template <class _Tp> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -__enable_if_t -< - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value - && !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value, - basic_string<_CharT, _Traits, _Allocator>& -> -basic_string<_CharT, _Traits, _Allocator>::assign(const _Tp & __t, size_type __pos, size_type __n) -{ +template <class _Tp, + __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && + !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value, + int> > +_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>& +basic_string<_CharT, _Traits, _Allocator>::assign(const _Tp& __t, size_type __pos, size_type __n) { __self_view __sv = __t; size_type __sz = __sv.size(); if (__pos > __sz) @@ -2664,7 +2509,6 @@ return assign(__sv.data() + __pos, std::min(__n, __sz - __pos)); } - template <class _CharT, class _Traits, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>& @@ -2786,13 +2630,8 @@ } template <class _CharT, class _Traits, class _Allocator> -template<class _ForwardIterator> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -__enable_if_t -< - __is_cpp17_forward_iterator<_ForwardIterator>::value, - basic_string<_CharT, _Traits, _Allocator>& -> +template<class _ForwardIterator, __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value, int> > +_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::append( _ForwardIterator __first, _ForwardIterator __last) { @@ -2833,15 +2672,12 @@ } template <class _CharT, class _Traits, class _Allocator> -template <class _Tp> -_LIBCPP_CONSTEXPR_SINCE_CXX20 - __enable_if_t - < - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value, - basic_string<_CharT, _Traits, _Allocator>& - > -basic_string<_CharT, _Traits, _Allocator>::append(const _Tp & __t, size_type __pos, size_type __n) -{ +template <class _Tp, + __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && + !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value, + int> > +_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>& +basic_string<_CharT, _Traits, _Allocator>::append(const _Tp& __t, size_type __pos, size_type __n) { __self_view __sv = __t; size_type __sz = __sv.size(); if (__pos > __sz) @@ -2933,13 +2769,8 @@ } template <class _CharT, class _Traits, class _Allocator> -template<class _InputIterator> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -__enable_if_t -< - __is_exactly_cpp17_input_iterator<_InputIterator>::value, - typename basic_string<_CharT, _Traits, _Allocator>::iterator -> +template<class _InputIterator, __enable_if_t<__is_exactly_cpp17_input_iterator<_InputIterator>::value, int> > +_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::iterator basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _InputIterator __first, _InputIterator __last) { _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this, @@ -2950,13 +2781,8 @@ } template <class _CharT, class _Traits, class _Allocator> -template<class _ForwardIterator> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -__enable_if_t -< - __is_cpp17_forward_iterator<_ForwardIterator>::value, - typename basic_string<_CharT, _Traits, _Allocator>::iterator -> +template<class _ForwardIterator, __enable_if_t<__is_cpp17_forward_iterator<_ForwardIterator>::value, int> > +_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::iterator basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last) { _LIBCPP_DEBUG_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this, @@ -2991,16 +2817,12 @@ } template <class _CharT, class _Traits, class _Allocator> -template <class _Tp> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -__enable_if_t -< - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value, - basic_string<_CharT, _Traits, _Allocator>& -> -basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const _Tp& __t, - size_type __pos2, size_type __n) -{ +template <class _Tp, + __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && + !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value, + int> > +_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>& +basic_string<_CharT, _Traits, _Allocator>::insert(size_type __pos1, const _Tp& __t, size_type __pos2, size_type __n) { __self_view __sv = __t; size_type __str_sz = __sv.size(); if (__pos2 > __str_sz) @@ -3135,13 +2957,8 @@ } template <class _CharT, class _Traits, class _Allocator> -template<class _InputIterator> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -__enable_if_t -< - __is_cpp17_input_iterator<_InputIterator>::value, - basic_string<_CharT, _Traits, _Allocator>& -> +template<class _InputIterator, __enable_if_t<__is_cpp17_input_iterator<_InputIterator>::value, int> > +_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>& basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2) { @@ -3162,16 +2979,13 @@ } template <class _CharT, class _Traits, class _Allocator> -template <class _Tp> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -__enable_if_t -< - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value, - basic_string<_CharT, _Traits, _Allocator>& -> -basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos1, size_type __n1, const _Tp& __t, - size_type __pos2, size_type __n2) -{ +template <class _Tp, + __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && + !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value, + int> > +_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>& +basic_string<_CharT, _Traits, _Allocator>::replace( + size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2) { __self_view __sv = __t; size_type __str_sz = __sv.size(); if (__pos2 > __str_sz) @@ -3365,23 +3179,23 @@ } else { - #ifndef _LIBCPP_NO_EXCEPTIONS + #ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { - #endif // _LIBCPP_NO_EXCEPTIONS + #endif // _LIBCPP_HAS_NO_EXCEPTIONS auto __allocation = std::__allocate_at_least(__alloc(), __target_capacity + 1); __new_data = __allocation.ptr; __target_capacity = __allocation.count - 1; - #ifndef _LIBCPP_NO_EXCEPTIONS + #ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { return; } - #else // _LIBCPP_NO_EXCEPTIONS + #else // _LIBCPP_HAS_NO_EXCEPTIONS if (__new_data == nullptr) return; - #endif // _LIBCPP_NO_EXCEPTIONS + #endif // _LIBCPP_HAS_NO_EXCEPTIONS } __begin_lifetime(__new_data, __target_capacity + 1); __now_long = true; @@ -3495,13 +3309,8 @@ } template<class _CharT, class _Traits, class _Allocator> -template <class _Tp> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -__enable_if_t -< - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, - typename basic_string<_CharT, _Traits, _Allocator>::size_type -> +template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> > +_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find(const _Tp &__t, size_type __pos) const _NOEXCEPT { @@ -3556,13 +3365,8 @@ } template<class _CharT, class _Traits, class _Allocator> -template <class _Tp> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -__enable_if_t -< - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, - typename basic_string<_CharT, _Traits, _Allocator>::size_type -> +template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> > +_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::rfind(const _Tp& __t, size_type __pos) const _NOEXCEPT { @@ -3617,13 +3421,8 @@ } template<class _CharT, class _Traits, class _Allocator> -template <class _Tp> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -__enable_if_t -< - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, - typename basic_string<_CharT, _Traits, _Allocator>::size_type -> +template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> > +_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_first_of(const _Tp& __t, size_type __pos) const _NOEXCEPT { @@ -3677,13 +3476,8 @@ } template<class _CharT, class _Traits, class _Allocator> -template <class _Tp> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -__enable_if_t -< - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, - typename basic_string<_CharT, _Traits, _Allocator>::size_type -> +template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> > +_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_last_of(const _Tp& __t, size_type __pos) const _NOEXCEPT { @@ -3737,13 +3531,8 @@ } template<class _CharT, class _Traits, class _Allocator> -template <class _Tp> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -__enable_if_t -< - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, - typename basic_string<_CharT, _Traits, _Allocator>::size_type -> +template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> > +_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(const _Tp& __t, size_type __pos) const _NOEXCEPT { @@ -3798,13 +3587,8 @@ } template<class _CharT, class _Traits, class _Allocator> -template <class _Tp> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -__enable_if_t -< - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, - typename basic_string<_CharT, _Traits, _Allocator>::size_type -> +template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> > +_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::size_type basic_string<_CharT, _Traits, _Allocator>::find_last_not_of(const _Tp& __t, size_type __pos) const _NOEXCEPT { @@ -3837,13 +3621,8 @@ // compare template <class _CharT, class _Traits, class _Allocator> -template <class _Tp> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -__enable_if_t -< - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, - int -> +template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> > +_LIBCPP_CONSTEXPR_SINCE_CXX20 int basic_string<_CharT, _Traits, _Allocator>::compare(const _Tp& __t) const _NOEXCEPT { __self_view __sv = __t; @@ -3893,13 +3672,8 @@ } template <class _CharT, class _Traits, class _Allocator> -template <class _Tp> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -__enable_if_t -< - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, - int -> +template <class _Tp, __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, int> > +_LIBCPP_CONSTEXPR_SINCE_CXX20 int basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type __n1, const _Tp& __t) const @@ -3919,20 +3693,12 @@ } template <class _CharT, class _Traits, class _Allocator> -template <class _Tp> -_LIBCPP_CONSTEXPR_SINCE_CXX20 -__enable_if_t -< - __can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value - && !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value, - int -> -basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, - size_type __n1, - const _Tp& __t, - size_type __pos2, - size_type __n2) const -{ +template <class _Tp, + __enable_if_t<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value && + !__is_same_uncvref<_Tp, basic_string<_CharT, _Traits, _Allocator> >::value, + int> > +_LIBCPP_CONSTEXPR_SINCE_CXX20 int basic_string<_CharT, _Traits, _Allocator>::compare( + size_type __pos1, size_type __n1, const _Tp& __t, size_type __pos2, size_type __n2) const { __self_view __sv = __t; return __self_view(*this).substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2)); } @@ -3982,7 +3748,7 @@ return false; if (data() == nullptr) return false; - if (data()[size()] != value_type()) + if (!_Traits::eq(data()[size()], value_type())) return false; return true; } @@ -4010,7 +3776,7 @@ operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs, const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT { -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 return basic_string_view<_CharT, _Traits>(__lhs) == basic_string_view<_CharT, _Traits>(__rhs); #else size_t __lhs_sz = __lhs.size(); @@ -4060,7 +3826,7 @@ operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs, const _CharT* __rhs) _NOEXCEPT { -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 return basic_string_view<_CharT, _Traits>(__lhs) == basic_string_view<_CharT, _Traits>(__rhs); #else typedef basic_string<_CharT, _Traits, _Allocator> _String; @@ -4071,7 +3837,7 @@ #endif } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _CharT, class _Traits, class _Allocator> _LIBCPP_HIDE_FROM_ABI constexpr auto operator<=>( @@ -4086,7 +3852,7 @@ return basic_string_view<_CharT, _Traits>(__lhs) <=> basic_string_view<_CharT, _Traits>(__rhs); } -#else // _LIBCPP_STD_VER > 17 +#else // _LIBCPP_STD_VER >= 20 template<class _CharT, class _Traits, class _Allocator> inline _LIBCPP_HIDE_FROM_ABI @@ -4230,7 +3996,7 @@ { return !(__lhs < __rhs); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 // operator + @@ -4445,11 +4211,11 @@ basic_string<_CharT, _Traits, _Allocator>::npos; template <class _CharT, class _Allocator> -struct __string_hash : public __unary_function<basic_string<_CharT, char_traits<_CharT>, _Allocator>, size_t> -{ - size_t - operator()(const basic_string<_CharT, char_traits<_CharT>, _Allocator>& __val) const _NOEXCEPT - { return std::__do_string_hash(__val.data(), __val.data() + __val.size()); } +struct __string_hash : public __unary_function<basic_string<_CharT, char_traits<_CharT>, _Allocator>, size_t> { + _LIBCPP_HIDE_FROM_ABI size_t + operator()(const basic_string<_CharT, char_traits<_CharT>, _Allocator>& __val) const _NOEXCEPT { + return std::__do_string_hash(__val.data(), __val.data() + __val.size()); + } }; template <class _Allocator> @@ -4504,7 +4270,7 @@ getline(basic_istream<_CharT, _Traits>&& __is, basic_string<_CharT, _Traits, _Allocator>& __str); -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _CharT, class _Traits, class _Allocator, class _Up> inline _LIBCPP_HIDE_FROM_ABI typename basic_string<_CharT, _Traits, _Allocator>::size_type @@ -4562,7 +4328,7 @@ #endif // _LIBCPP_ENABLE_DEBUG_MODE -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 // Literal suffixes for basic_string [basic.string.literals] inline namespace literals { @@ -4604,7 +4370,7 @@ } // namespace string_literals } // namespace literals -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <> inline constexpr bool __format::__enable_insertable<std::basic_string<char>> = true; #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS @@ -4622,9 +4388,11 @@ #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <algorithm> # include <concepts> +# include <cstdlib> # include <functional> # include <iterator> # include <new> +# include <type_traits> # include <typeinfo> # include <utility> # include <vector>
diff --git a/third_party/llvm-project/libcxx/include/string_view b/third_party/llvm-project/libcxx/include/string_view index ea98e38..f8cecfb 100644 --- a/third_party/llvm-project/libcxx/include/string_view +++ b/third_party/llvm-project/libcxx/include/string_view
@@ -208,6 +208,7 @@ #include <__functional/hash.h> #include <__functional/unary_function.h> #include <__fwd/string_view.h> +#include <__iterator/bounded_iter.h> #include <__iterator/concepts.h> #include <__iterator/readable_traits.h> #include <__iterator/reverse_iterator.h> @@ -218,10 +219,17 @@ #include <__ranges/enable_view.h> #include <__ranges/size.h> #include <__string/char_traits.h> +#include <__type_traits/is_array.h> +#include <__type_traits/is_convertible.h> +#include <__type_traits/is_same.h> +#include <__type_traits/is_standard_layout.h> +#include <__type_traits/is_trivial.h> +#include <__type_traits/remove_cvref.h> +#include <__type_traits/remove_reference.h> +#include <__type_traits/type_identity.h> #include <iosfwd> #include <limits> #include <stdexcept> -#include <type_traits> #include <version> // standard-mandated includes @@ -265,7 +273,11 @@ using const_pointer = const _CharT*; using reference = _CharT&; using const_reference = const _CharT&; +#ifdef _LIBCPP_DEBUG_ITERATOR_BOUNDS_CHECKING + using const_iterator = __bounded_iter<const_pointer>; +#else using const_iterator = const_pointer; // See [string.view.iterators] +#endif using iterator = const_iterator; using const_reverse_iterator = _VSTD::reverse_iterator<const_iterator>; using reverse_iterator = const_reverse_iterator; @@ -293,12 +305,13 @@ basic_string_view(const _CharT* __s, size_type __len) _NOEXCEPT : __data_(__s), __size_(__len) { -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 + _LIBCPP_ASSERT(__len <= static_cast<size_type>(numeric_limits<difference_type>::max()), "string_view::string_view(_CharT *, size_t): length does not fit in difference_type"); _LIBCPP_ASSERT(__len == 0 || __s != nullptr, "string_view::string_view(_CharT *, size_t): received nullptr"); #endif } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <contiguous_iterator _It, sized_sentinel_for<_It> _End> requires (is_same_v<iter_value_t<_It>, _CharT> && !is_convertible_v<_End, size_type>) constexpr _LIBCPP_HIDE_FROM_ABI basic_string_view(_It __begin, _End __end) @@ -306,9 +319,9 @@ { _LIBCPP_ASSERT((__end - __begin) >= 0, "std::string_view::string_view(iterator, sentinel) received invalid range"); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <class _Range> requires ( !is_same_v<remove_cvref_t<_Range>, basic_string_view> && @@ -318,20 +331,17 @@ !is_convertible_v<_Range, const _CharT*> && (!requires(remove_cvref_t<_Range>& __d) { __d.operator _VSTD::basic_string_view<_CharT, _Traits>(); - }) && - (!requires { - typename remove_reference_t<_Range>::traits_type; - } || is_same_v<typename remove_reference_t<_Range>::traits_type, _Traits>) + }) ) constexpr explicit _LIBCPP_HIDE_FROM_ABI basic_string_view(_Range&& __r) : __data_(ranges::data(__r)), __size_(ranges::size(__r)) {} -#endif // _LIBCPP_STD_VER > 20 +#endif // _LIBCPP_STD_VER >= 23 _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY basic_string_view(const _CharT* __s) : __data_(__s), __size_(_VSTD::__char_traits_length_checked<_Traits>(__s)) {} -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 basic_string_view(nullptr_t) = delete; #endif @@ -343,10 +353,22 @@ const_iterator end() const _NOEXCEPT { return cend(); } _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - const_iterator cbegin() const _NOEXCEPT { return __data_; } + const_iterator cbegin() const _NOEXCEPT { +#ifdef _LIBCPP_DEBUG_ITERATOR_BOUNDS_CHECKING + return std::__make_bounded_iter(data(), data(), data() + size()); +#else + return __data_; +#endif + } _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY - const_iterator cend() const _NOEXCEPT { return __data_ + __size_; } + const_iterator cend() const _NOEXCEPT { +#ifdef _LIBCPP_DEBUG_ITERATOR_BOUNDS_CHECKING + return std::__make_bounded_iter(data() + size(), data(), data() + size()); +#else + return __data_ + __size_; +#endif + } _LIBCPP_CONSTEXPR_SINCE_CXX17 _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); } @@ -674,7 +696,7 @@ (data(), size(), __s, __pos, traits_type::length(__s)); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 constexpr _LIBCPP_INLINE_VISIBILITY bool starts_with(basic_string_view __s) const noexcept { return size() >= __s.size() && compare(0, __s.size(), __s) == 0; } @@ -700,7 +722,7 @@ { return ends_with(basic_string_view(__s)); } #endif -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 constexpr _LIBCPP_INLINE_VISIBILITY bool contains(basic_string_view __sv) const noexcept { return find(__sv) != npos; } @@ -720,23 +742,23 @@ }; _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(basic_string_view); -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _CharT, class _Traits> inline constexpr bool ranges::enable_view<basic_string_view<_CharT, _Traits>> = true; template <class _CharT, class _Traits> inline constexpr bool ranges::enable_borrowed_range<basic_string_view<_CharT, _Traits> > = true; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 // [string.view.deduct] -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <contiguous_iterator _It, sized_sentinel_for<_It> _End> basic_string_view(_It, _End) -> basic_string_view<iter_value_t<_It>>; -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <ranges::contiguous_range _Range> basic_string_view(_Range) -> basic_string_view<ranges::range_value_t<_Range>>; #endif @@ -773,11 +795,11 @@ if (__lhs.size() != __rhs.size()) return false; return __lhs.compare(__rhs) == 0; } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 // operator <=> -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _CharT, class _Traits> _LIBCPP_HIDE_FROM_ABI constexpr auto @@ -807,7 +829,7 @@ } } -#else // _LIBCPP_STD_VER > 17 +#else // _LIBCPP_STD_VER >= 20 // operator != template<class _CharT, class _Traits> @@ -940,7 +962,7 @@ return __lhs.compare(__rhs) >= 0; } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 template<class _CharT, class _Traits> _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& @@ -976,7 +998,7 @@ struct hash<basic_string_view<wchar_t, char_traits<wchar_t> > > : __string_view_hash<wchar_t> {}; #endif -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 inline namespace literals { inline namespace string_view_literals @@ -1024,8 +1046,10 @@ #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <algorithm> # include <concepts> +# include <cstdlib> # include <functional> # include <iterator> +# include <type_traits> #endif #endif // _LIBCPP_STRING_VIEW
diff --git a/third_party/llvm-project/libcxx/include/system_error b/third_party/llvm-project/libcxx/include/system_error index 9891992..a60c984 100644 --- a/third_party/llvm-project/libcxx/include/system_error +++ b/third_party/llvm-project/libcxx/include/system_error
@@ -146,13 +146,11 @@ #include <__assert> // all public C++ headers provide the assertion handler #include <__config> -#include <__errc> -#include <__functional/hash.h> -#include <__functional/unary_function.h> -#include <__memory/addressof.h> -#include <stdexcept> -#include <string> -#include <type_traits> +#include <__system_error/errc.h> +#include <__system_error/error_category.h> +#include <__system_error/error_code.h> +#include <__system_error/error_condition.h> +#include <__system_error/system_error.h> #include <version> // standard-mandated includes @@ -164,385 +162,11 @@ # pragma GCC system_header #endif -_LIBCPP_BEGIN_NAMESPACE_STD - -// is_error_code_enum - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_error_code_enum - : public false_type {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_error_code_enum_v = is_error_code_enum<_Tp>::value; +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <cstdint> +# include <cstring> +# include <limits> +# include <type_traits> #endif -// is_error_condition_enum - -template <class _Tp> -struct _LIBCPP_TEMPLATE_VIS is_error_condition_enum - : public false_type {}; - -#if _LIBCPP_STD_VER > 14 -template <class _Tp> -inline constexpr bool is_error_condition_enum_v = is_error_condition_enum<_Tp>::value; -#endif - -template <> -struct _LIBCPP_TEMPLATE_VIS is_error_condition_enum<errc> - : true_type { }; - -#ifdef _LIBCPP_CXX03_LANG -template <> -struct _LIBCPP_TEMPLATE_VIS is_error_condition_enum<errc::__lx> - : true_type { }; -#endif - -class _LIBCPP_TYPE_VIS error_condition; -class _LIBCPP_TYPE_VIS error_code; - -// class error_category - -class _LIBCPP_HIDDEN __do_message; - -class _LIBCPP_TYPE_VIS error_category -{ -public: - virtual ~error_category() _NOEXCEPT; - -#if defined(_LIBCPP_ERROR_CATEGORY_DEFINE_LEGACY_INLINE_FUNCTIONS) - error_category() noexcept; -#else - _LIBCPP_INLINE_VISIBILITY - _LIBCPP_CONSTEXPR_SINCE_CXX14 error_category() _NOEXCEPT = default; -#endif - error_category(const error_category&) = delete; - error_category& operator=(const error_category&) = delete; - - virtual const char* name() const _NOEXCEPT = 0; - virtual error_condition default_error_condition(int __ev) const _NOEXCEPT; - virtual bool equivalent(int __code, const error_condition& __condition) const _NOEXCEPT; - virtual bool equivalent(const error_code& __code, int __condition) const _NOEXCEPT; - virtual string message(int __ev) const = 0; - - _LIBCPP_INLINE_VISIBILITY - bool operator==(const error_category& __rhs) const _NOEXCEPT {return this == &__rhs;} - -#if _LIBCPP_STD_VER > 17 - - _LIBCPP_HIDE_FROM_ABI - strong_ordering operator<=>(const error_category& __rhs) const noexcept {return compare_three_way()(this, std::addressof(__rhs));} - -#else // _LIBCPP_STD_VER > 17 - - _LIBCPP_INLINE_VISIBILITY - bool operator!=(const error_category& __rhs) const _NOEXCEPT {return !(*this == __rhs);} - - _LIBCPP_INLINE_VISIBILITY - bool operator< (const error_category& __rhs) const _NOEXCEPT {return this < &__rhs;} - -#endif // _LIBCPP_STD_VER > 17 - - friend class _LIBCPP_HIDDEN __do_message; -}; - -class _LIBCPP_HIDDEN __do_message - : public error_category -{ -public: - string message(int __ev) const override; -}; - -_LIBCPP_FUNC_VIS const error_category& generic_category() _NOEXCEPT; -_LIBCPP_FUNC_VIS const error_category& system_category() _NOEXCEPT; - -namespace __adl_only { - // Those cause ADL to trigger but they are not viable candidates, - // so they are never actually selected. - void make_error_condition() = delete; - void make_error_code() = delete; -} // namespace __adl_only - -class _LIBCPP_TYPE_VIS error_condition -{ - int __val_; - const error_category* __cat_; -public: - _LIBCPP_INLINE_VISIBILITY - error_condition() _NOEXCEPT : __val_(0), __cat_(&generic_category()) {} - - _LIBCPP_INLINE_VISIBILITY - error_condition(int __val, const error_category& __cat) _NOEXCEPT - : __val_(__val), __cat_(&__cat) {} - - template <class _Ep> - _LIBCPP_INLINE_VISIBILITY - error_condition(_Ep __e, - typename enable_if<is_error_condition_enum<_Ep>::value>::type* = nullptr - ) _NOEXCEPT - { - using __adl_only::make_error_condition; - *this = make_error_condition(__e); - } - - _LIBCPP_INLINE_VISIBILITY - void assign(int __val, const error_category& __cat) _NOEXCEPT - { - __val_ = __val; - __cat_ = &__cat; - } - - template <class _Ep> - _LIBCPP_INLINE_VISIBILITY - typename enable_if - < - is_error_condition_enum<_Ep>::value, - error_condition& - >::type - operator=(_Ep __e) _NOEXCEPT - { - using __adl_only::make_error_condition; - *this = make_error_condition(__e); - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - void clear() _NOEXCEPT - { - __val_ = 0; - __cat_ = &generic_category(); - } - - _LIBCPP_INLINE_VISIBILITY - int value() const _NOEXCEPT {return __val_;} - - _LIBCPP_INLINE_VISIBILITY - const error_category& category() const _NOEXCEPT {return *__cat_;} - string message() const; - - _LIBCPP_INLINE_VISIBILITY - explicit operator bool() const _NOEXCEPT {return __val_ != 0;} -}; - -inline _LIBCPP_INLINE_VISIBILITY -error_condition -make_error_condition(errc __e) _NOEXCEPT -{ - return error_condition(static_cast<int>(__e), generic_category()); -} - -// error_code - -class _LIBCPP_TYPE_VIS error_code -{ - int __val_; - const error_category* __cat_; -public: - _LIBCPP_INLINE_VISIBILITY - error_code() _NOEXCEPT : __val_(0), __cat_(&system_category()) {} - - _LIBCPP_INLINE_VISIBILITY - error_code(int __val, const error_category& __cat) _NOEXCEPT - : __val_(__val), __cat_(&__cat) {} - - template <class _Ep> - _LIBCPP_INLINE_VISIBILITY - error_code(_Ep __e, - typename enable_if<is_error_code_enum<_Ep>::value>::type* = nullptr - ) _NOEXCEPT - { - using __adl_only::make_error_code; - *this = make_error_code(__e); - } - - _LIBCPP_INLINE_VISIBILITY - void assign(int __val, const error_category& __cat) _NOEXCEPT - { - __val_ = __val; - __cat_ = &__cat; - } - - template <class _Ep> - _LIBCPP_INLINE_VISIBILITY - typename enable_if - < - is_error_code_enum<_Ep>::value, - error_code& - >::type - operator=(_Ep __e) _NOEXCEPT - { - using __adl_only::make_error_code; - *this = make_error_code(__e); - return *this; - } - - _LIBCPP_INLINE_VISIBILITY - void clear() _NOEXCEPT - { - __val_ = 0; - __cat_ = &system_category(); - } - - _LIBCPP_INLINE_VISIBILITY - int value() const _NOEXCEPT {return __val_;} - - _LIBCPP_INLINE_VISIBILITY - const error_category& category() const _NOEXCEPT {return *__cat_;} - - _LIBCPP_INLINE_VISIBILITY - error_condition default_error_condition() const _NOEXCEPT - {return __cat_->default_error_condition(__val_);} - - string message() const; - - _LIBCPP_INLINE_VISIBILITY - explicit operator bool() const _NOEXCEPT {return __val_ != 0;} -}; - -inline _LIBCPP_INLINE_VISIBILITY -error_code -make_error_code(errc __e) _NOEXCEPT -{ - return error_code(static_cast<int>(__e), generic_category()); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool -operator==(const error_code& __x, const error_code& __y) _NOEXCEPT -{ - return __x.category() == __y.category() && __x.value() == __y.value(); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool -operator==(const error_code& __x, const error_condition& __y) _NOEXCEPT -{ - return __x.category().equivalent(__x.value(), __y) - || __y.category().equivalent(__x, __y.value()); -} - -#if _LIBCPP_STD_VER <= 17 -inline _LIBCPP_INLINE_VISIBILITY -bool -operator==(const error_condition& __x, const error_code& __y) _NOEXCEPT -{ - return __y == __x; -} -#endif - -inline _LIBCPP_INLINE_VISIBILITY -bool -operator==(const error_condition& __x, const error_condition& __y) _NOEXCEPT -{ - return __x.category() == __y.category() && __x.value() == __y.value(); -} - -#if _LIBCPP_STD_VER <= 17 - -inline _LIBCPP_INLINE_VISIBILITY -bool -operator!=(const error_code& __x, const error_code& __y) _NOEXCEPT -{return !(__x == __y);} - -inline _LIBCPP_INLINE_VISIBILITY -bool -operator!=(const error_code& __x, const error_condition& __y) _NOEXCEPT -{return !(__x == __y);} - -inline _LIBCPP_INLINE_VISIBILITY -bool -operator!=(const error_condition& __x, const error_code& __y) _NOEXCEPT -{return !(__x == __y);} - -inline _LIBCPP_INLINE_VISIBILITY -bool -operator!=(const error_condition& __x, const error_condition& __y) _NOEXCEPT -{return !(__x == __y);} - -inline _LIBCPP_INLINE_VISIBILITY -bool -operator<(const error_condition& __x, const error_condition& __y) _NOEXCEPT -{ - return __x.category() < __y.category() - || (__x.category() == __y.category() && __x.value() < __y.value()); -} - -inline _LIBCPP_INLINE_VISIBILITY -bool -operator<(const error_code& __x, const error_code& __y) _NOEXCEPT -{ - return __x.category() < __y.category() - || (__x.category() == __y.category() && __x.value() < __y.value()); -} - -#else // _LIBCPP_STD_VER <= 17 - -inline _LIBCPP_HIDE_FROM_ABI strong_ordering -operator<=>(const error_code& __x, const error_code& __y) noexcept -{ - if (auto __c = __x.category() <=> __y.category(); __c != 0) - return __c; - return __x.value() <=> __y.value(); -} - -inline _LIBCPP_HIDE_FROM_ABI strong_ordering -operator<=>(const error_condition& __x, const error_condition& __y) noexcept -{ - if (auto __c = __x.category() <=> __y.category(); __c != 0) - return __c; - return __x.value() <=> __y.value(); -} - -#endif // _LIBCPP_STD_VER <= 17 - -template <> -struct _LIBCPP_TEMPLATE_VIS hash<error_code> - : public __unary_function<error_code, size_t> -{ - _LIBCPP_INLINE_VISIBILITY - size_t operator()(const error_code& __ec) const _NOEXCEPT - { - return static_cast<size_t>(__ec.value()); - } -}; - -template <> -struct _LIBCPP_TEMPLATE_VIS hash<error_condition> - : public __unary_function<error_condition, size_t> -{ - _LIBCPP_INLINE_VISIBILITY - size_t operator()(const error_condition& __ec) const _NOEXCEPT - { - return static_cast<size_t>(__ec.value()); - } -}; - -// system_error - -class _LIBCPP_TYPE_VIS system_error - : public runtime_error -{ - error_code __ec_; -public: - system_error(error_code __ec, const string& __what_arg); - system_error(error_code __ec, const char* __what_arg); - system_error(error_code __ec); - system_error(int __ev, const error_category& __ecat, const string& __what_arg); - system_error(int __ev, const error_category& __ecat, const char* __what_arg); - system_error(int __ev, const error_category& __ecat); - system_error(const system_error&) _NOEXCEPT = default; - ~system_error() _NOEXCEPT override; - - _LIBCPP_INLINE_VISIBILITY - const error_code& code() const _NOEXCEPT {return __ec_;} - -private: - static string __init(const error_code&, string); -}; - -_LIBCPP_NORETURN _LIBCPP_FUNC_VIS -void __throw_system_error(int __ev, const char* __what_arg); - -_LIBCPP_END_NAMESPACE_STD - #endif // _LIBCPP_SYSTEM_ERROR
diff --git a/third_party/llvm-project/libcxx/include/thread b/third_party/llvm-project/libcxx/include/thread index 7a1117f..e071476 100644 --- a/third_party/llvm-project/libcxx/include/thread +++ b/third_party/llvm-project/libcxx/include/thread
@@ -64,6 +64,9 @@ basic_ostream<charT, traits>& operator<<(basic_ostream<charT, traits>& out, thread::id id); +template<class charT> +struct formatter<thread::id, charT>; + namespace this_thread { @@ -84,19 +87,33 @@ */ #include <__assert> // all public C++ headers provide the assertion handler +#include <__availability> +#include <__chrono/steady_clock.h> +#include <__chrono/time_point.h> +#include <__concepts/arithmetic.h> +#include <__condition_variable/condition_variable.h> #include <__config> +#include <__exception/terminate.h> +#include <__format/concepts.h> +#include <__format/format_parse_context.h> +#include <__format/formatter.h> +#include <__format/formatter_integral.h> +#include <__format/parser_std_format_spec.h> #include <__functional/hash.h> +#include <__functional/unary_function.h> +#include <__memory/addressof.h> #include <__memory/unique_ptr.h> -#include <__mutex_base> +#include <__mutex/mutex.h> +#include <__mutex/unique_lock.h> +#include <__system_error/system_error.h> #include <__thread/poll_with_backoff.h> #include <__thread/timed_backoff_policy.h> #include <__threading_support> #include <__utility/forward.h> #include <cstddef> +#include <cstdint> #include <iosfwd> -#include <system_error> #include <tuple> -#include <type_traits> #include <version> // standard-mandated includes @@ -219,6 +236,45 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id) {return __os << __id.__id_;} +#if _LIBCPP_STD_VER >= 23 +template <__fmt_char_type _CharT> +struct _LIBCPP_TEMPLATE_VIS formatter<__thread_id, _CharT> { + public: + _LIBCPP_HIDE_FROM_ABI constexpr auto parse(basic_format_parse_context<_CharT>& __parse_ctx) + -> decltype(__parse_ctx.begin()) { + return __parser_.__parse(__parse_ctx, __format_spec::__fields_fill_align_width); + } + + _LIBCPP_HIDE_FROM_ABI auto format(__thread_id __id, auto& __ctx) const -> decltype(__ctx.out()) { + // In __threading_support __libcpp_thread_id is either a + // unsigned long long or a pthread_t. + // + // The type of pthread_t is left unspecified in POSIX so it can be any + // type. The most logical types are an integral or pointer. + // On Linux systems pthread_t is an unsigned long long. + // On Apple systems pthread_t is a pointer type. + // + // Note the output should match what the stream operator does. Since + // the ostream operator has been shipped years before this formatter + // was added to the Standard, this formatter does what the stream + // operator does. This may require platform specific changes. + + using _Tp = decltype(__get_underlying_id(__id)); + using _Cp = conditional_t<integral<_Tp>, _Tp, conditional_t<is_pointer_v<_Tp>, uintptr_t, void>>; + static_assert(!is_same_v<_Cp, void>, "unsupported thread::id type, please file a bug report"); + + __format_spec::__parsed_specifications<_CharT> __specs = __parser_.__get_parsed_std_specifications(__ctx); + if constexpr (is_pointer_v<_Tp>) { + __specs.__std_.__alternate_form_ = true; + __specs.__std_.__type_ = __format_spec::__type::__hexadecimal_lower_case; + } + return __formatter::__format_integer(reinterpret_cast<_Cp>(__get_underlying_id(__id)), __ctx, __specs); + } + + __format_spec::__parser<_CharT> __parser_{.__alignment_ = __format_spec::__alignment::__right}; +}; +#endif // _LIBCPP_STD_VER >= 23 + class _LIBCPP_TYPE_VIS thread { __libcpp_thread_t __t_; @@ -301,7 +357,7 @@ { typedef unique_ptr<__thread_struct> _TSPtr; _TSPtr __tsp(new __thread_struct); - typedef tuple<_TSPtr, typename decay<_Fp>::type, typename decay<_Args>::type...> _Gp; + typedef tuple<_TSPtr, __decay_t<_Fp>, __decay_t<_Args>...> _Gp; unique_ptr<_Gp> __p( new _Gp(_VSTD::move(__tsp), _VSTD::forward<_Fp>(__f), @@ -367,10 +423,10 @@ // The standard guarantees a 64bit signed integer resolution for nanoseconds, // so use INT64_MAX / 1e9 as cut-off point. Use a constant to avoid <climits> // and issues with long double folding on PowerPC with GCC. - _LIBCPP_CONSTEXPR chrono::duration<long double> _Max = + _LIBCPP_CONSTEXPR chrono::duration<long double> __max = chrono::duration<long double>(9223372036.0L); chrono::nanoseconds __ns; - if (__d < _Max) + if (__d < __max) { __ns = chrono::duration_cast<chrono::nanoseconds>(__d); if (__ns < __d) @@ -415,7 +471,10 @@ #endif #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <cstring> # include <functional> +# include <new> +# include <system_error> #endif #endif // _LIBCPP_THREAD
diff --git a/third_party/llvm-project/libcxx/include/tuple b/third_party/llvm-project/libcxx/include/tuple index b0616bd..abfd441 100644 --- a/third_party/llvm-project/libcxx/include/tuple +++ b/third_party/llvm-project/libcxx/include/tuple
@@ -865,7 +865,7 @@ : __base_(allocator_arg_t(), __a, __t) { } -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 // tuple(tuple<U...>&) constructors (including allocator_arg_t variants) template <class... _Up, enable_if_t< @@ -879,7 +879,7 @@ _LIBCPP_HIDE_FROM_ABI constexpr explicit(!(is_convertible_v<_Up&, _Tp> && ...)) tuple(allocator_arg_t, const _Alloc& __alloc, tuple<_Up...>& __t) : __base_(allocator_arg_t(), __alloc, __t) {} -#endif // _LIBCPP_STD_VER > 20 +#endif // _LIBCPP_STD_VER >= 23 // tuple(tuple<U...>&&) constructors (including allocator_arg_t variants) @@ -929,7 +929,7 @@ : __base_(allocator_arg_t(), __a, _VSTD::move(__t)) { } -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 // tuple(const tuple<U...>&&) constructors (including allocator_arg_t variants) template <class... _Up, enable_if_t< @@ -944,7 +944,7 @@ explicit(!(is_convertible_v<const _Up&&, _Tp> && ...)) tuple(allocator_arg_t, const _Alloc& __alloc, const tuple<_Up...>&& __t) : __base_(allocator_arg_t(), __alloc, std::move(__t)) {} -#endif // _LIBCPP_STD_VER > 20 +#endif // _LIBCPP_STD_VER >= 23 // tuple(const pair<U1, U2>&) constructors (including allocator_arg_t variants) @@ -1018,7 +1018,7 @@ : __base_(allocator_arg_t(), __a, __p) { } -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 // tuple(pair<U1, U2>&) constructors (including allocator_arg_t variants) template <class _U1, class _U2, enable_if_t< @@ -1082,7 +1082,7 @@ : __base_(allocator_arg_t(), __a, _VSTD::move(__p)) { } -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 // tuple(const pair<U1, U2>&&) constructors (including allocator_arg_t variants) template <class _U1, class _U2, enable_if_t< @@ -1097,7 +1097,7 @@ explicit(!_BothImplicitlyConvertible<const pair<_U1, _U2>&&>::value) tuple(allocator_arg_t, const _Alloc& __alloc, const pair<_U1, _U2>&& __p) : __base_(allocator_arg_t(), __alloc, std::move(__p)) {} -#endif // _LIBCPP_STD_VER > 20 +#endif // _LIBCPP_STD_VER >= 23 // [tuple.assign] _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 @@ -1109,7 +1109,7 @@ return *this; } -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 _LIBCPP_HIDE_FROM_ABI constexpr const tuple& operator=(tuple const& __tuple) const requires (_And<is_copy_assignable<const _Tp>...>::value) { @@ -1126,7 +1126,7 @@ typename __make_tuple_indices<sizeof...(_Tp)>::type()); return *this; } -#endif // _LIBCPP_STD_VER > 20 +#endif // _LIBCPP_STD_VER >= 23 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 tuple& operator=(_If<_And<is_move_assignable<_Tp>...>::value, tuple, __nat>&& __tuple) @@ -1170,7 +1170,7 @@ } -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <class... _UTypes, enable_if_t< _And<_BoolConstant<sizeof...(_Tp) == sizeof...(_UTypes)>, is_assignable<const _Tp&, const _UTypes&>...>::value>* = nullptr> @@ -1193,7 +1193,7 @@ typename __make_tuple_indices<sizeof...(_Tp)>::type()); return *this; } -#endif // _LIBCPP_STD_VER > 20 +#endif // _LIBCPP_STD_VER >= 23 template <template<class...> class Pred, bool _Const, class _Pair, class _DecayedPair = __remove_cvref_t<_Pair>, class _Tuple = tuple> @@ -1212,7 +1212,7 @@ template <bool _Const, class _Pair> struct _NothrowAssignFromPair : _AssignPredicateFromPair<is_nothrow_assignable, _Const, _Pair> {}; -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <class _U1, class _U2, enable_if_t< _EnableAssignFromPair<true, const pair<_U1, _U2>&>::value>* = nullptr> _LIBCPP_HIDE_FROM_ABI constexpr @@ -1232,7 +1232,7 @@ std::get<1>(*this) = std::move(__pair.second); return *this; } -#endif // _LIBCPP_STD_VER > 20 +#endif // _LIBCPP_STD_VER >= 23 template<class _Up1, class _Up2, __enable_if_t< _EnableAssignFromPair<false, pair<_Up1, _Up2> const&>::value @@ -1296,12 +1296,12 @@ void swap(tuple& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) {__base_.swap(__t.__base_);} -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 _LIBCPP_HIDE_FROM_ABI constexpr void swap(const tuple& __t) const noexcept(__all<is_nothrow_swappable_v<const _Tp&>...>::value) { __base_.swap(__t.__base_); } -#endif // _LIBCPP_STD_VER > 20 +#endif // _LIBCPP_STD_VER >= 23 }; template <> @@ -1324,12 +1324,12 @@ tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 void swap(tuple&) _NOEXCEPT {} -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 _LIBCPP_HIDE_FROM_ABI constexpr void swap(const tuple&) const noexcept {} #endif }; -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <class... _TTypes, class... _UTypes, template<class> class _TQual, template<class> class _UQual> requires requires { typename tuple<common_reference_t<_TQual<_TTypes>, _UQual<_UTypes>>...>; } struct basic_common_reference<tuple<_TTypes...>, tuple<_UTypes...>, _TQual, _UQual> { @@ -1341,9 +1341,9 @@ struct common_type<tuple<_TTypes...>, tuple<_UTypes...>> { using type = tuple<common_type_t<_TTypes, _UTypes>...>; }; -#endif // _LIBCPP_STD_VER > 20 +#endif // _LIBCPP_STD_VER >= 23 -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class ..._Tp> tuple(_Tp...) -> tuple<_Tp...>; template <class _Tp1, class _Tp2> @@ -1363,7 +1363,7 @@ _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) {__t.swap(__u);} -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <class... _Tp> _LIBCPP_HIDE_FROM_ABI constexpr enable_if_t<__all<is_swappable_v<const _Tp>...>::value, void> @@ -1413,7 +1413,7 @@ static_cast<const __tuple_leaf<_Ip, type>&&>(__t.__base_).get()); } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 namespace __find_detail { @@ -1552,7 +1552,7 @@ return __tuple_equal<sizeof...(_Tp)>()(__x, __y); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 // operator<=> @@ -1574,7 +1574,7 @@ return _VSTD::__tuple_compare_three_way(__x, __y, index_sequence_for<_Tp...>{}); } -#else // _LIBCPP_STD_VER > 17 +#else // _LIBCPP_STD_VER >= 20 template <class ..._Tp, class ..._Up> inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 @@ -1644,7 +1644,7 @@ return !(__y < __x); } -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 // tuple_cat @@ -1803,7 +1803,7 @@ { } -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class _Tp> inline constexpr size_t tuple_size_v = tuple_size<_Tp>::value; @@ -1845,7 +1845,7 @@ #undef _LIBCPP_NOEXCEPT_RETURN -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 #endif // !defined(_LIBCPP_CXX03_LANG)
diff --git a/third_party/llvm-project/libcxx/include/typeindex b/third_party/llvm-project/libcxx/include/typeindex index e3132c8..251aa43 100644 --- a/third_party/llvm-project/libcxx/include/typeindex +++ b/third_party/llvm-project/libcxx/include/typeindex
@@ -87,7 +87,7 @@ _LIBCPP_INLINE_VISIBILITY bool operator>=(const type_index& __y) const _NOEXCEPT {return !__t_->before(*__y.__t_);} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_HIDE_FROM_ABI strong_ordering operator<=>(const type_index& __y) const noexcept { if (*__t_ == *__y.__t_)
diff --git a/third_party/llvm-project/libcxx/include/typeinfo b/third_party/llvm-project/libcxx/include/typeinfo index 4431039..4691765 100644 --- a/third_party/llvm-project/libcxx/include/typeinfo +++ b/third_party/llvm-project/libcxx/include/typeinfo
@@ -21,7 +21,7 @@ public: virtual ~type_info(); - bool operator==(const type_info& rhs) const noexcept; + bool operator==(const type_info& rhs) const noexcept; // constexpr since C++23 bool operator!=(const type_info& rhs) const noexcept; // removed in C++20 bool before(const type_info& rhs) const noexcept; @@ -59,11 +59,11 @@ #include <__assert> // all public C++ headers provide the assertion handler #include <__availability> #include <__config> +#include <__exception/exception.h> +#include <__type_traits/is_constant_evaluated.h> +#include <__verbose_abort> #include <cstddef> #include <cstdint> -#include <cstdlib> -#include <exception> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -104,8 +104,13 @@ size_t hash_code() const _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator==(const type_info& __arg) const _NOEXCEPT { + // When evaluated in a constant expression, both type infos simply can't come + // from different translation units, so it is sufficient to compare their addresses. + if (__libcpp_is_constant_evaluated()) { + return this == &__arg; + } return __compare(__arg) == 0; } @@ -330,9 +335,14 @@ return __impl::__hash(__type_name); } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator==(const type_info& __arg) const _NOEXCEPT { + // When evaluated in a constant expression, both type infos simply can't come + // from different translation units, so it is sufficient to compare their addresses. + if (__libcpp_is_constant_evaluated()) { + return this == &__arg; + } return __impl::__eq(__type_name, __arg.__type_name); } @@ -395,12 +405,18 @@ _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY void __throw_bad_cast() { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw bad_cast(); #else - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("bad_cast was thrown in -fno-exceptions mode"); #endif } _LIBCPP_END_NAMESPACE_STD +#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <cstdlib> +# include <exception> +# include <type_traits> +#endif + #endif // __LIBCPP_TYPEINFO
diff --git a/third_party/llvm-project/libcxx/include/unordered_map b/third_party/llvm-project/libcxx/include/unordered_map index 14f93ba..238aa44 100644 --- a/third_party/llvm-project/libcxx/include/unordered_map +++ b/third_party/llvm-project/libcxx/include/unordered_map
@@ -575,7 +575,7 @@ _LIBCPP_INLINE_VISIBILITY size_t operator()(const _Key& __x) const {return static_cast<const _Hash&>(*this)(__x);} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <typename _K2> _LIBCPP_INLINE_VISIBILITY size_t operator()(const _K2& __x) const @@ -611,7 +611,7 @@ _LIBCPP_INLINE_VISIBILITY size_t operator()(const _Key& __x) const {return __hash_(__x);} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <typename _K2> _LIBCPP_INLINE_VISIBILITY size_t operator()(const _K2& __x) const @@ -661,7 +661,7 @@ _LIBCPP_INLINE_VISIBILITY bool operator()(const _Key& __x, const _Cp& __y) const {return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <typename _K2> _LIBCPP_INLINE_VISIBILITY bool operator()(const _Cp& __x, const _K2& __y) const @@ -712,7 +712,7 @@ _LIBCPP_INLINE_VISIBILITY bool operator()(const _Key& __x, const _Cp& __y) const {return __pred_(__x, __y.__get_value().first);} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <typename _K2> _LIBCPP_INLINE_VISIBILITY bool operator()(const _Cp& __x, const _K2& __y) const @@ -825,7 +825,7 @@ _LIBCPP_INLINE_VISIBILITY value_type& __get_value() { -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 return *_VSTD::launder(_VSTD::addressof(__cc_)); #else return __cc_; @@ -835,7 +835,7 @@ _LIBCPP_INLINE_VISIBILITY const value_type& __get_value() const { -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 return *_VSTD::launder(_VSTD::addressof(__cc_)); #else return __cc_; @@ -1035,7 +1035,7 @@ typedef value_type& reference; typedef const value_type& const_reference; static_assert((is_same<value_type, typename allocator_type::value_type>::value), - "Invalid allocator::value_type"); + "Allocator::value_type must be same type as value_type"); private: typedef __hash_value_type<key_type, mapped_type> __value_type; @@ -1075,7 +1075,7 @@ typedef __hash_map_iterator<typename __table::local_iterator> local_iterator; typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 typedef __map_node_handle<__node, allocator_type> node_type; typedef __insert_return_type<iterator, node_type> insert_return_type; #endif @@ -1123,7 +1123,7 @@ const hasher& __hf, const key_equal& __eql, const allocator_type& __a); #endif // _LIBCPP_CXX03_LANG -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 _LIBCPP_INLINE_VISIBILITY unordered_map(size_type __n, const allocator_type& __a) : unordered_map(__n, hasher(), key_equal(), __a) {} @@ -1270,7 +1270,7 @@ #endif // _LIBCPP_CXX03_LANG -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template <class... _Args> _LIBCPP_INLINE_VISIBILITY pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args) @@ -1350,7 +1350,7 @@ // FIXME: Add debug mode checking for the iterator input return insert_or_assign(_VSTD::move(__k), _VSTD::forward<_Vp>(__v)).first; } -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);} @@ -1364,7 +1364,7 @@ _LIBCPP_INLINE_VISIBILITY void clear() _NOEXCEPT {__table_.clear();} -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_INLINE_VISIBILITY insert_return_type insert(node_type&& __nh) { @@ -1443,31 +1443,31 @@ iterator find(const key_type& __k) {return __table_.find(__k);} _LIBCPP_INLINE_VISIBILITY const_iterator find(const key_type& __k) const {return __table_.find(__k);} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> _LIBCPP_INLINE_VISIBILITY iterator find(const _K2& __k) {return __table_.find(__k);} template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> _LIBCPP_INLINE_VISIBILITY const_iterator find(const _K2& __k) const {return __table_.find(__k);} -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY size_type count(const key_type& __k) const {return __table_.__count_unique(__k);} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> _LIBCPP_INLINE_VISIBILITY size_type count(const _K2& __k) const {return __table_.__count_unique(__k);} -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY bool contains(const key_type& __k) const {return find(__k) != end();} template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> _LIBCPP_INLINE_VISIBILITY bool contains(const _K2& __k) const {return find(__k) != end();} -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY pair<iterator, iterator> equal_range(const key_type& __k) @@ -1475,7 +1475,7 @@ _LIBCPP_INLINE_VISIBILITY pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {return __table_.__equal_range_unique(__k);} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> _LIBCPP_INLINE_VISIBILITY pair<iterator, iterator> equal_range(const _K2& __k) @@ -1484,7 +1484,7 @@ _LIBCPP_INLINE_VISIBILITY pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {return __table_.__equal_range_unique(__k);} -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 mapped_type& operator[](const key_type& __k); #ifndef _LIBCPP_CXX03_LANG @@ -1874,7 +1874,7 @@ __x.swap(__y); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc, class _Predicate> inline _LIBCPP_INLINE_VISIBILITY @@ -1928,7 +1928,7 @@ typedef value_type& reference; typedef const value_type& const_reference; static_assert((is_same<value_type, typename allocator_type::value_type>::value), - "Invalid allocator::value_type"); + "Allocator::value_type must be same type as value_type"); private: typedef __hash_value_type<key_type, mapped_type> __value_type; @@ -1967,7 +1967,7 @@ typedef __hash_map_iterator<typename __table::local_iterator> local_iterator; typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 typedef __map_node_handle<__node, allocator_type> node_type; #endif @@ -2015,7 +2015,7 @@ const hasher& __hf, const key_equal& __eql, const allocator_type& __a); #endif // _LIBCPP_CXX03_LANG -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 _LIBCPP_INLINE_VISIBILITY unordered_multimap(size_type __n, const allocator_type& __a) : unordered_multimap(__n, hasher(), key_equal(), __a) {} @@ -2151,7 +2151,7 @@ _LIBCPP_INLINE_VISIBILITY void clear() _NOEXCEPT {__table_.clear();} -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_INLINE_VISIBILITY iterator insert(node_type&& __nh) { @@ -2230,31 +2230,31 @@ iterator find(const key_type& __k) {return __table_.find(__k);} _LIBCPP_INLINE_VISIBILITY const_iterator find(const key_type& __k) const {return __table_.find(__k);} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> _LIBCPP_INLINE_VISIBILITY iterator find(const _K2& __k) {return __table_.find(__k);} template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> _LIBCPP_INLINE_VISIBILITY const_iterator find(const _K2& __k) const {return __table_.find(__k);} -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY size_type count(const key_type& __k) const {return __table_.__count_multi(__k);} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> _LIBCPP_INLINE_VISIBILITY size_type count(const _K2& __k) const {return __table_.__count_multi(__k);} -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY bool contains(const key_type& __k) const {return find(__k) != end();} template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> _LIBCPP_INLINE_VISIBILITY bool contains(const _K2& __k) const {return find(__k) != end();} -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY pair<iterator, iterator> equal_range(const key_type& __k) @@ -2262,7 +2262,7 @@ _LIBCPP_INLINE_VISIBILITY pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {return __table_.__equal_range_multi(__k);} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> _LIBCPP_INLINE_VISIBILITY pair<iterator, iterator> equal_range(const _K2& __k) @@ -2271,7 +2271,7 @@ _LIBCPP_INLINE_VISIBILITY pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {return __table_.__equal_range_multi(__k);} -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} @@ -2584,7 +2584,7 @@ __x.swap(__y); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc, class _Predicate> inline _LIBCPP_INLINE_VISIBILITY @@ -2629,7 +2629,7 @@ _LIBCPP_END_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD namespace pmr { template <class _KeyT, class _ValueT, class _HashT = std::hash<_KeyT>, class _PredT = std::equal_to<_KeyT>> @@ -2647,7 +2647,9 @@ # include <algorithm> # include <bit> # include <concepts> +# include <cstdlib> # include <iterator> +# include <type_traits> #endif #endif // _LIBCPP_UNORDERED_MAP
diff --git a/third_party/llvm-project/libcxx/include/unordered_set b/third_party/llvm-project/libcxx/include/unordered_set index b4203c0..a6afb74 100644 --- a/third_party/llvm-project/libcxx/include/unordered_set +++ b/third_party/llvm-project/libcxx/include/unordered_set
@@ -513,7 +513,7 @@ typedef value_type& reference; typedef const value_type& const_reference; static_assert((is_same<value_type, typename allocator_type::value_type>::value), - "Invalid allocator::value_type"); + "Allocator::value_type must be same type as value_type"); static_assert(is_same<allocator_type, __rebind_alloc<allocator_traits<allocator_type>, value_type> >::value, "[allocator.requirements] states that rebinding an allocator to the same type should result in the " @@ -535,7 +535,7 @@ typedef typename __table::const_local_iterator local_iterator; typedef typename __table::const_local_iterator const_local_iterator; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 typedef __set_node_handle<typename __table::__node, allocator_type> node_type; typedef __insert_return_type<iterator, node_type> insert_return_type; #endif @@ -553,7 +553,7 @@ } explicit unordered_set(size_type __n, const hasher& __hf = hasher(), const key_equal& __eql = key_equal()); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 inline _LIBCPP_INLINE_VISIBILITY unordered_set(size_type __n, const allocator_type& __a) : unordered_set(__n, hasher(), key_equal(), __a) {} @@ -573,7 +573,7 @@ unordered_set(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _InputIterator> inline _LIBCPP_INLINE_VISIBILITY unordered_set(_InputIterator __first, _InputIterator __last, @@ -600,7 +600,7 @@ unordered_set(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 inline _LIBCPP_INLINE_VISIBILITY unordered_set(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) @@ -711,7 +711,7 @@ _LIBCPP_INLINE_VISIBILITY void clear() _NOEXCEPT {__table_.clear();} -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_INLINE_VISIBILITY insert_return_type insert(node_type&& __nh) { @@ -787,31 +787,31 @@ iterator find(const key_type& __k) {return __table_.find(__k);} _LIBCPP_INLINE_VISIBILITY const_iterator find(const key_type& __k) const {return __table_.find(__k);} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> _LIBCPP_INLINE_VISIBILITY iterator find(const _K2& __k) {return __table_.find(__k);} template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> _LIBCPP_INLINE_VISIBILITY const_iterator find(const _K2& __k) const {return __table_.find(__k);} -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY size_type count(const key_type& __k) const {return __table_.__count_unique(__k);} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> _LIBCPP_INLINE_VISIBILITY size_type count(const _K2& __k) const {return __table_.__count_unique(__k);} -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY bool contains(const key_type& __k) const {return find(__k) != end();} template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> _LIBCPP_INLINE_VISIBILITY bool contains(const _K2& __k) const {return find(__k) != end();} -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY pair<iterator, iterator> equal_range(const key_type& __k) @@ -819,7 +819,7 @@ _LIBCPP_INLINE_VISIBILITY pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {return __table_.__equal_range_unique(__k);} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> _LIBCPP_INLINE_VISIBILITY pair<iterator, iterator> equal_range(const _K2& __k) @@ -828,7 +828,7 @@ _LIBCPP_INLINE_VISIBILITY pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {return __table_.__equal_range_unique(__k);} -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} @@ -1120,7 +1120,7 @@ __x.swap(__y); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Value, class _Hash, class _Pred, class _Alloc, class _Predicate> inline _LIBCPP_INLINE_VISIBILITY @@ -1173,7 +1173,7 @@ typedef value_type& reference; typedef const value_type& const_reference; static_assert((is_same<value_type, typename allocator_type::value_type>::value), - "Invalid allocator::value_type"); + "Allocator::value_type must be same type as value_type"); private: typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table; @@ -1191,7 +1191,7 @@ typedef typename __table::const_local_iterator local_iterator; typedef typename __table::const_local_iterator const_local_iterator; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 typedef __set_node_handle<typename __table::__node, allocator_type> node_type; #endif @@ -1210,7 +1210,7 @@ const key_equal& __eql = key_equal()); unordered_multiset(size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 inline _LIBCPP_INLINE_VISIBILITY unordered_multiset(size_type __n, const allocator_type& __a) : unordered_multiset(__n, hasher(), key_equal(), __a) {} @@ -1228,7 +1228,7 @@ unordered_multiset(_InputIterator __first, _InputIterator __last, size_type __n , const hasher& __hf, const key_equal& __eql, const allocator_type& __a); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _InputIterator> inline _LIBCPP_INLINE_VISIBILITY unordered_multiset(_InputIterator __first, _InputIterator __last, @@ -1256,7 +1256,7 @@ unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const key_equal& __eql, const allocator_type& __a); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 inline _LIBCPP_INLINE_VISIBILITY unordered_multiset(initializer_list<value_type> __il, size_type __n, const allocator_type& __a) : unordered_multiset(__il, __n, hasher(), key_equal(), __a) {} @@ -1338,7 +1338,7 @@ _LIBCPP_INLINE_VISIBILITY void insert(_InputIterator __first, _InputIterator __last); -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_INLINE_VISIBILITY iterator insert(node_type&& __nh) { @@ -1425,31 +1425,31 @@ iterator find(const key_type& __k) {return __table_.find(__k);} _LIBCPP_INLINE_VISIBILITY const_iterator find(const key_type& __k) const {return __table_.find(__k);} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> _LIBCPP_INLINE_VISIBILITY iterator find(const _K2& __k) {return __table_.find(__k);} template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> _LIBCPP_INLINE_VISIBILITY const_iterator find(const _K2& __k) const {return __table_.find(__k);} -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY size_type count(const key_type& __k) const {return __table_.__count_multi(__k);} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> _LIBCPP_INLINE_VISIBILITY size_type count(const _K2& __k) const {return __table_.__count_multi(__k);} -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY bool contains(const key_type& __k) const {return find(__k) != end();} template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> _LIBCPP_INLINE_VISIBILITY bool contains(const _K2& __k) const {return find(__k) != end();} -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY pair<iterator, iterator> equal_range(const key_type& __k) @@ -1457,7 +1457,7 @@ _LIBCPP_INLINE_VISIBILITY pair<const_iterator, const_iterator> equal_range(const key_type& __k) const {return __table_.__equal_range_multi(__k);} -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template<class _K2, enable_if_t<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value>* = nullptr> _LIBCPP_INLINE_VISIBILITY pair<iterator, iterator> equal_range(const _K2& __k) @@ -1466,7 +1466,7 @@ _LIBCPP_INLINE_VISIBILITY pair<const_iterator, const_iterator> equal_range(const _K2& __k) const {return __table_.__equal_range_multi(__k);} -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 _LIBCPP_INLINE_VISIBILITY size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();} @@ -1758,7 +1758,7 @@ __x.swap(__y); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Value, class _Hash, class _Pred, class _Alloc, class _Predicate> inline _LIBCPP_INLINE_VISIBILITY @@ -1803,7 +1803,7 @@ _LIBCPP_END_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD namespace pmr { template <class _KeyT, class _HashT = std::hash<_KeyT>, class _PredT = std::equal_to<_KeyT>> @@ -1817,8 +1817,10 @@ #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <concepts> +# include <cstdlib> # include <functional> # include <iterator> +# include <type_traits> #endif #endif // _LIBCPP_UNORDERED_SET
diff --git a/third_party/llvm-project/libcxx/include/utility b/third_party/llvm-project/libcxx/include/utility index a4d8cf8..1dc16b1 100644 --- a/third_party/llvm-project/libcxx/include/utility +++ b/third_party/llvm-project/libcxx/include/utility
@@ -117,24 +117,30 @@ template<class T1, class T2> pair(T1, T2) -> pair<T1, T2>; -template <class T1, class T2> bool operator==(const pair<T1,T2>&, const pair<T1,T2>&); // constexpr in C++14 -template <class T1, class T2> bool operator!=(const pair<T1,T2>&, const pair<T1,T2>&); // constexpr in C++14, removed in C++20 -template <class T1, class T2> bool operator< (const pair<T1,T2>&, const pair<T1,T2>&); // constexpr in C++14, removed in C++20 -template <class T1, class T2> bool operator> (const pair<T1,T2>&, const pair<T1,T2>&); // constexpr in C++14, removed in C++20 -template <class T1, class T2> bool operator>=(const pair<T1,T2>&, const pair<T1,T2>&); // constexpr in C++14, removed in C++20 -template <class T1, class T2> bool operator<=(const pair<T1,T2>&, const pair<T1,T2>&); // constexpr in C++14, removed in C++20 -template <class T1, class T2> - constexpr common_comparison_type_t<synth-three-way-result<T1>, - synth-three-way-result<T2>> - operator<=>(const pair<T1,T2>&, const pair<T1,T2>&); // C++20 +template <class T1, class T2, class U1, class U2> +bool operator==(const pair<T1,T2>&, const pair<U1,U2>&); // constexpr in C++14 +template <class T1, class T2, class U1, class U2> +bool operator!=(const pair<T1,T2>&, const pair<U1,U2>&); // constexpr in C++14, removed in C++20 +template <class T1, class T2, class U1, class U2> +bool operator< (const pair<T1,T2>&, const pair<U1,U2>&); // constexpr in C++14, removed in C++20 +template <class T1, class T2, class U1, class U2> +bool operator> (const pair<T1,T2>&, const pair<U1,U2>&); // constexpr in C++14, removed in C++20 +template <class T1, class T2, class U1, class U2> +bool operator>=(const pair<T1,T2>&, const pair<U1,U2>&); // constexpr in C++14, removed in C++20 +template <class T1, class T2, class U1, class U2> +bool operator<=(const pair<T1,T2>&, const pair<U1,U2>&); // constexpr in C++14, removed in C++20 +template <class T1, class T2, class U1, class U2> + constexpr common_comparison_type_t<synth-three-way-result<T1,U1>, + synth-three-way-result<T2,U2>> + operator<=>(const pair<T1,T2>&, const pair<U1,U2>&); // C++20 template <class T1, class T2> pair<V1, V2> make_pair(T1&&, T2&&); // constexpr in C++14 template <class T1, class T2> void swap(pair<T1, T2>& x, pair<T1, T2>& y) noexcept(noexcept(x.swap(y))); // constexpr in C++20 -template<class T1, class T2> -constexpr void swap(const pair<T1, T2>& x, const pair<T1, T2>& y) noexcept(noexcept(x.swap(y))); // since C++23 +template<class T1, class T2> // since C++23 +constexpr void swap(const pair<T1, T2>& x, const pair<T1, T2>& y) noexcept(noexcept(x.swap(y))); struct piecewise_construct_t { explicit piecewise_construct_t() = default; }; inline constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t(); @@ -208,8 +214,8 @@ using index_sequence_for = make_index_sequence<sizeof...(T)>; template<class T, class U=T> - constexpr T exchange(T& obj, U&& new_value) - noexcept(is_nothrow_move_constructible<T>::value && is_nothrow_assignable<T&, U>::value); // constexpr in C++17, noexcept in C++23 + constexpr T exchange(T& obj, U&& new_value) // constexpr in C++17, noexcept in C++23 + noexcept(is_nothrow_move_constructible<T>::value && is_nothrow_assignable<T&, U>::value); // 20.2.7, in-place construction // C++17 struct in_place_t { @@ -266,8 +272,8 @@ #include <initializer_list> // [tuple.helper] -#include <__tuple_dir/tuple_element.h> -#include <__tuple_dir/tuple_size.h> +#include <__tuple/tuple_element.h> +#include <__tuple/tuple_size.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header
diff --git a/third_party/llvm-project/libcxx/include/valarray b/third_party/llvm-project/libcxx/include/valarray index 92521ed..c5ed152 100644 --- a/third_party/llvm-project/libcxx/include/valarray +++ b/third_party/llvm-project/libcxx/include/valarray
@@ -351,8 +351,10 @@ #include <__assert> // all public C++ headers provide the assertion handler #include <__config> #include <__functional/operations.h> +#include <__memory/addressof.h> #include <__memory/allocator.h> #include <__memory/uninitialized_algorithms.h> +#include <__type_traits/decay.h> #include <__type_traits/remove_reference.h> #include <__utility/move.h> #include <__utility/swap.h> @@ -432,7 +434,7 @@ struct _UnaryOp { typedef typename _Op::__result_type __result_type; - typedef typename decay<__result_type>::type value_type; + using value_type = __decay_t<__result_type>; _Op __op_; _A0 __a0_; @@ -451,7 +453,7 @@ struct _BinaryOp { typedef typename _Op::__result_type __result_type; - typedef typename decay<__result_type>::type value_type; + using value_type = __decay_t<__result_type>; _Op __op_; _A0 __a0_; @@ -1104,7 +1106,7 @@ valarray& __assign_range(const value_type* __f, const value_type* __l); }; -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 template<class _Tp, size_t _Size> valarray(const _Tp(&)[_Size], size_t) -> valarray<_Tp>; #endif @@ -1115,7 +1117,7 @@ struct _UnaryOp<_Op, valarray<_Tp> > { typedef typename _Op::__result_type __result_type; - typedef typename decay<__result_type>::type value_type; + using value_type = __decay_t<__result_type>; _Op __op_; const valarray<_Tp>& __a0_; @@ -1134,7 +1136,7 @@ struct _BinaryOp<_Op, valarray<_Tp>, _A1> { typedef typename _Op::__result_type __result_type; - typedef typename decay<__result_type>::type value_type; + using value_type = __decay_t<__result_type>; _Op __op_; const valarray<_Tp>& __a0_; @@ -1155,7 +1157,7 @@ struct _BinaryOp<_Op, _A0, valarray<_Tp> > { typedef typename _Op::__result_type __result_type; - typedef typename decay<__result_type>::type value_type; + using value_type = __decay_t<__result_type>; _Op __op_; _A0 __a0_; @@ -1176,7 +1178,7 @@ struct _BinaryOp<_Op, valarray<_Tp>, valarray<_Tp> > { typedef typename _Op::__result_type __result_type; - typedef typename decay<__result_type>::type value_type; + using value_type = __decay_t<__result_type>; _Op __op_; const valarray<_Tp>& __a0_; @@ -2818,20 +2820,20 @@ if (__n) { __begin_ = __end_ = allocator<value_type>().allocate(__n); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS for (size_t __n_left = __n; __n_left; --__n_left, ++__end_) ::new ((void*)__end_) value_type(); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __clear(__n); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } } @@ -2852,20 +2854,20 @@ if (__n) { __begin_ = __end_ = allocator<value_type>().allocate(__n); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS for (size_t __n_left = __n; __n_left; ++__end_, ++__p, --__n_left) ::new ((void*)__end_) value_type(*__p); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __clear(__n); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } } @@ -2877,20 +2879,20 @@ if (__v.size()) { __begin_ = __end_ = allocator<value_type>().allocate(__v.size()); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS for (value_type* __p = __v.__begin_; __p != __v.__end_; ++__end_, ++__p) ::new ((void*)__end_) value_type(*__p); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __clear(__v.size()); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } } @@ -2914,21 +2916,21 @@ if (__n) { __begin_ = __end_ = allocator<value_type>().allocate(__n); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS size_t __n_left = __n; for (const value_type* __p = __il.begin(); __n_left; ++__end_, ++__p, --__n_left) ::new ((void*)__end_) value_type(*__p); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __clear(__n); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } } @@ -2943,21 +2945,21 @@ if (__n) { __begin_ = __end_ = allocator<value_type>().allocate(__n); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS size_t __n_left = __n; for (const value_type* __p = __sa.__vp_; __n_left; ++__end_, __p += __sa.__stride_, --__n_left) ::new ((void*)__end_) value_type(*__p); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __clear(__n); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } } @@ -2970,23 +2972,23 @@ if (__n) { __begin_ = __end_ = allocator<value_type>().allocate(__n); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS typedef const size_t* _Ip; const value_type* __s = __ga.__vp_; for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_; __i != __e; ++__i, ++__end_) ::new ((void*)__end_) value_type(__s[*__i]); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __clear(__n); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } } @@ -2999,23 +3001,23 @@ if (__n) { __begin_ = __end_ = allocator<value_type>().allocate(__n); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS typedef const size_t* _Ip; const value_type* __s = __ma.__vp_; for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_; __i != __e; ++__i, ++__end_) ::new ((void*)__end_) value_type(__s[*__i]); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __clear(__n); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } } @@ -3028,23 +3030,23 @@ if (__n) { __begin_ = __end_ = allocator<value_type>().allocate(__n); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS typedef const size_t* _Ip; const value_type* __s = __ia.__vp_; for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_; __i != __e; ++__i, ++__end_) ::new ((void*)__end_) value_type(__s[*__i]); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __clear(__n); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } } @@ -3753,20 +3755,20 @@ if (__n) { __begin_ = __end_ = allocator<value_type>().allocate(__n); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS for (size_t __n_left = __n; __n_left; --__n_left, ++__end_) ::new ((void*)__end_) value_type(__x); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { __clear(__n); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } } @@ -4933,8 +4935,10 @@ #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 # include <algorithm> # include <concepts> +# include <cstdlib> # include <cstring> # include <functional> +# include <type_traits> #endif #endif // _LIBCPP_VALARRAY
diff --git a/third_party/llvm-project/libcxx/include/variant b/third_party/llvm-project/libcxx/include/variant index 13c8982..425fead 100644 --- a/third_party/llvm-project/libcxx/include/variant +++ b/third_party/llvm-project/libcxx/include/variant
@@ -210,10 +210,12 @@ #include <__compare/compare_three_way_result.h> #include <__compare/three_way_comparable.h> #include <__config> +#include <__exception/exception.h> #include <__functional/hash.h> #include <__functional/invoke.h> #include <__functional/operations.h> #include <__functional/unary_function.h> +#include <__memory/addressof.h> #include <__type_traits/add_const.h> #include <__type_traits/add_cv.h> #include <__type_traits/add_pointer.h> @@ -231,12 +233,13 @@ #include <__type_traits/remove_const.h> #include <__type_traits/type_identity.h> #include <__type_traits/void_t.h> +#include <__utility/declval.h> #include <__utility/forward.h> #include <__utility/in_place.h> #include <__utility/move.h> #include <__utility/swap.h> #include <__variant/monostate.h> -#include <exception> +#include <__verbose_abort> #include <initializer_list> #include <limits> #include <new> @@ -266,7 +269,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 // Light N-dimensional array of function pointers. Used in place of std::array to avoid // adding a dependency. @@ -285,10 +288,10 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS void __throw_bad_variant_access() { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS throw bad_variant_access(); #else - _VSTD::abort(); + _LIBCPP_VERBOSE_ABORT("bad_variant_access was thrown in -fno-exceptions mode"); #endif } @@ -594,9 +597,9 @@ template <class _Fp, class _Vp, class... _Vs> _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_fdiagonal() { - constexpr size_t _Np = __remove_cvref_t<_Vp>::__size(); - static_assert(__all<(_Np == __remove_cvref_t<_Vs>::__size())...>::value); - return __make_fdiagonal_impl<_Fp, _Vp, _Vs...>(make_index_sequence<_Np>{}); + constexpr size_t __np = __remove_cvref_t<_Vp>::__size(); + static_assert(__all<(__np == __remove_cvref_t<_Vs>::__size())...>::value); + return __make_fdiagonal_impl<_Fp, _Vp, _Vs...>(make_index_sequence<__np>{}); } template <class _Fp, class... _Vs, size_t... _Is> @@ -660,7 +663,7 @@ _VSTD::forward<_Vs>(__vs)...); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Rp, class _Visitor, class... _Vs> _LIBCPP_HIDE_FROM_ABI static constexpr _Rp __visit_value(_Visitor&& __visitor, @@ -692,7 +695,7 @@ _Visitor&& __visitor; }; -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Rp, class _Visitor> struct __value_visitor_return_type { template <class... _Alts> @@ -721,7 +724,7 @@ return __value_visitor<_Visitor>{_VSTD::forward<_Visitor>(__visitor)}; } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Rp, class _Visitor> _LIBCPP_HIDE_FROM_ABI static constexpr auto __make_value_visitor(_Visitor&& __visitor) { @@ -1187,7 +1190,7 @@ _VSTD::swap(__lhs, __rhs); } __impl __tmp(_VSTD::move(*__rhs)); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS if constexpr (__all<is_nothrow_move_constructible_v<_Types>...>::value) { this->__generic_construct(*__rhs, _VSTD::move(*__lhs)); } else { @@ -1652,7 +1655,7 @@ return __variant::__visit_value_at(__lhs.index(), __convert_to_bool<equal_to<>>{}, __lhs, __rhs); } -# if _LIBCPP_STD_VER > 17 +# if _LIBCPP_STD_VER >= 20 template <class... _Types> requires (three_way_comparable<_Types> && ...) _LIBCPP_HIDE_FROM_ABI constexpr common_comparison_category_t<compare_three_way_result_t<_Types>...> @@ -1671,7 +1674,7 @@ return __variant::__visit_value_at(__lhs.index(), __three_way, __lhs, __rhs); } -# endif // _LIBCPP_STD_VER > 17 +# endif // _LIBCPP_STD_VER >= 20 template <class... _Types> _LIBCPP_HIDE_FROM_ABI @@ -1757,7 +1760,7 @@ _VSTD::forward<_Vs>(__vs)...); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template < class _Rp, class _Visitor, class... _Vs, typename = void_t<decltype(_VSTD::__as_variant(std::declval<_Vs>()))...> > @@ -1824,13 +1827,14 @@ return std::__unchecked_get<__find_exactly_one_t<_Tp, _Types...>::value>(__v); } -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 +# include <exception> # include <type_traits> # include <typeinfo> # include <utility>
diff --git a/third_party/llvm-project/libcxx/include/vector b/third_party/llvm-project/libcxx/include/vector index 4b7ae13..40f73b8 100644 --- a/third_party/llvm-project/libcxx/include/vector +++ b/third_party/llvm-project/libcxx/include/vector
@@ -299,6 +299,7 @@ #include <__iterator/iterator_traits.h> #include <__iterator/reverse_iterator.h> #include <__iterator/wrap_iter.h> +#include <__memory/addressof.h> #include <__memory/allocate_at_least.h> #include <__memory/pointer_traits.h> #include <__memory/swap_allocator.h> @@ -307,18 +308,19 @@ #include <__memory_resource/polymorphic_allocator.h> #include <__split_buffer> #include <__type_traits/is_allocator.h> +#include <__type_traits/is_constructible.h> +#include <__type_traits/is_nothrow_move_assignable.h> #include <__type_traits/noexcept_move_assign_container.h> +#include <__type_traits/type_identity.h> #include <__utility/exception_guard.h> #include <__utility/forward.h> #include <__utility/move.h> #include <__utility/swap.h> #include <climits> -#include <cstdlib> #include <cstring> #include <iosfwd> // for forward declaration of vector #include <limits> #include <stdexcept> -#include <type_traits> #include <version> // standard-mandated includes @@ -389,7 +391,7 @@ std::__debug_db_insert_c(this); } _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI explicit vector(size_type __n, const allocator_type& __a); #endif _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(size_type __n, const value_type& __x); @@ -474,7 +476,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI vector(vector&& __x) -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 noexcept; #else _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value); @@ -594,7 +596,7 @@ template <class... _Args> _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 reference emplace_back(_Args&&... __args); #else void emplace_back(_Args&&... __args); @@ -1083,7 +1085,7 @@ __guard.__complete(); } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Tp, class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a) @@ -1216,7 +1218,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI vector<_Tp, _Allocator>::vector(vector&& __x) -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 noexcept #else _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) @@ -1512,19 +1514,19 @@ { if (capacity() > size()) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS allocator_type& __a = this->__alloc(); __split_buffer<value_type, allocator_type&> __v(size(), size(), __a); __swap_out_circular_buffer(__v); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } } @@ -1588,7 +1590,7 @@ template <class... _Args> _LIBCPP_CONSTEXPR_SINCE_CXX20 inline -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 typename vector<_Tp, _Allocator>::reference #else void @@ -1601,7 +1603,7 @@ } else __emplace_back_slow_path(std::forward<_Args>(__args)...); -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 return this->back(); #endif } @@ -1831,24 +1833,24 @@ __split_buffer<value_type, allocator_type&> __v(__a); if (__first != __last) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __v.__construct_at_end(__first, __last); difference_type __old_size = __old_last - this->__begin_; difference_type __old_p = __p - this->__begin_; reserve(__recommend(size() + __v.size())); __p = this->__begin_ + __old_p; __old_last = this->__begin_ + __old_size; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { erase(__make_iter(__old_last), end()); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } __p = std::rotate(__p, __old_last, this->__end_); insert(__make_iter(__p), std::make_move_iterator(__v.begin()), @@ -2123,7 +2125,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 ~vector() { __destroy_vector(*this)(); } _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(size_type __n); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit vector(size_type __n, const allocator_type& __a); #endif _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(size_type __n, const value_type& __v); @@ -2157,7 +2159,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector(vector&& __v) -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 noexcept; #else _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value); @@ -2254,16 +2256,16 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const_reference back() const {return __make_ref(__size_ - 1);} _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void push_back(const value_type& __x); -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class... _Args> -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 reference emplace_back(_Args&&... __args) #else _LIBCPP_HIDE_FROM_ABI void emplace_back(_Args&&... __args) #endif { push_back ( value_type ( std::forward<_Args>(__args)... )); -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 return this->back(); #endif } @@ -2271,7 +2273,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void pop_back() {--__size_;} -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class... _Args> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator emplace(const_iterator __position, _Args&&... __args) { return insert ( __position, value_type ( std::forward<_Args>(__args)... )); } @@ -2550,7 +2552,7 @@ } } -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 template <class _Allocator> _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(size_type __n, const allocator_type& __a) @@ -2603,13 +2605,13 @@ __size_(0), __cap_alloc_(0, __default_init_tag()) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS for (; __first != __last; ++__first) push_back(*__first); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -2618,7 +2620,7 @@ std::__debug_db_invalidate_all(this); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } template <class _Allocator> @@ -2630,13 +2632,13 @@ __size_(0), __cap_alloc_(0, static_cast<__storage_allocator>(__a)) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS for (; __first != __last; ++__first) push_back(*__first); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { @@ -2645,7 +2647,7 @@ std::__debug_db_invalidate_all(this); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } template <class _Allocator> @@ -2772,7 +2774,7 @@ template <class _Allocator> inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 vector<bool, _Allocator>::vector(vector&& __v) -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _NOEXCEPT #else _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) @@ -2923,17 +2925,17 @@ { if (__external_cap_to_internal(size()) > __cap()) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS vector(*this, allocator_type(__alloc())).swap(*this); -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } } @@ -3034,24 +3036,24 @@ vector __v(get_allocator()); if (__first != __last) { -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS __v.assign(__first, __last); difference_type __old_size = static_cast<difference_type>(__old_end - begin()); difference_type __old_p = __p - begin(); reserve(__recommend(size() + __v.size())); __p = begin() + __old_p; __old_end = begin() + __old_size; -#ifndef _LIBCPP_NO_EXCEPTIONS +#ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { erase(__old_end, end()); throw; } -#endif // _LIBCPP_NO_EXCEPTIONS +#endif // _LIBCPP_HAS_NO_EXCEPTIONS } __p = std::rotate(__p, __old_end, end()); insert(__p, __v.begin(), __v.end()); @@ -3293,7 +3295,7 @@ __x.swap(__y); } -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 template <class _Tp, class _Allocator, class _Up> _LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI typename vector<_Tp, _Allocator>::size_type @@ -3319,13 +3321,13 @@ inline constexpr bool __format::__enable_insertable<vector<wchar_t>> = true; #endif -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER >= 20 -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 template <class _Tp, class CharT> // Since is-vector-bool-reference is only used once it's inlined here. requires same_as<typename _Tp::__container, vector<bool, typename _Tp::__container::allocator_type>> -struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FORMAT formatter<_Tp, CharT> { +struct _LIBCPP_TEMPLATE_VIS formatter<_Tp, CharT> { private: formatter<bool, CharT> __underlying_; @@ -3340,11 +3342,11 @@ return __underlying_.format(__ref, __ctx); } }; -#endif // _LIBCPP_STD_VER > 20 +#endif // _LIBCPP_STD_VER >= 23 _LIBCPP_END_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD namespace pmr { template <class _ValueT> @@ -3359,6 +3361,8 @@ # include <algorithm> # include <atomic> # include <concepts> +# include <cstdlib> +# include <type_traits> # include <typeinfo> # include <utility> #endif
diff --git a/third_party/llvm-project/libcxx/include/version b/third_party/llvm-project/libcxx/include/version index 9705229..f58b51e 100644 --- a/third_party/llvm-project/libcxx/include/version +++ b/third_party/llvm-project/libcxx/include/version
@@ -85,6 +85,8 @@ __cpp_lib_expected 202202L <expected> __cpp_lib_filesystem 201703L <filesystem> __cpp_lib_format 202106L <format> +__cpp_lib_format_ranges 202207L <format> +__cpp_lib_formatters 202302L <stacktrace> <thread> __cpp_lib_forward_like 202207L <utility> __cpp_lib_gcd_lcm 201606L <numeric> __cpp_lib_generic_associative_lookup 201304L <map> <set> @@ -122,6 +124,7 @@ __cpp_lib_math_constants 201907L <numbers> __cpp_lib_math_special_functions 201603L <cmath> __cpp_lib_memory_resource 201603L <memory_resource> +__cpp_lib_move_iterator_concept 202207L <iterator> __cpp_lib_move_only_function 202110L <functional> __cpp_lib_node_extract 201606L <map> <set> <unordered_map> <unordered_set> @@ -139,6 +142,7 @@ __cpp_lib_quoted_string_io 201304L <iomanip> __cpp_lib_ranges 202106L <algorithm> <functional> <iterator> <memory> <ranges> +__cpp_lib_ranges_as_rvalue 202207L <ranges> __cpp_lib_ranges_chunk 202202L <ranges> __cpp_lib_ranges_chunk_by 202202L <ranges> __cpp_lib_ranges_iota 202202L <numeric> @@ -208,7 +212,7 @@ // clang-format off -#if _LIBCPP_STD_VER > 11 +#if _LIBCPP_STD_VER >= 14 # define __cpp_lib_chrono_udls 201304L # define __cpp_lib_complex_udls 201309L # define __cpp_lib_exchange_function 201304L @@ -223,7 +227,7 @@ # define __cpp_lib_quoted_string_io 201304L # define __cpp_lib_result_of_sfinae 201210L # define __cpp_lib_robust_nonmodifying_seq_ops 201304L -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_timed_mutex) +# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_HAS_NO_SHARED_MUTEX) # define __cpp_lib_shared_timed_mutex 201402L # endif # define __cpp_lib_string_udls 201304L @@ -233,7 +237,7 @@ # define __cpp_lib_tuples_by_type 201304L #endif -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 # define __cpp_lib_addressof_constexpr 201603L # define __cpp_lib_allocator_traits_is_always_equal 201411L # define __cpp_lib_any 201606L @@ -248,7 +252,7 @@ # define __cpp_lib_clamp 201603L # define __cpp_lib_enable_shared_from_this 201603L // # define __cpp_lib_execution 201603L -# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_filesystem) +# if !defined(_LIBCPP_AVAILABILITY_HAS_NO_FILESYSTEM) # define __cpp_lib_filesystem 201703L # endif # define __cpp_lib_gcd_lcm 201606L @@ -276,7 +280,7 @@ # define __cpp_lib_raw_memory_algorithms 201606L # define __cpp_lib_sample 201603L # define __cpp_lib_scoped_lock 201703L -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_shared_mutex) +# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_HAS_NO_SHARED_MUTEX) # define __cpp_lib_shared_mutex 201505L # endif # define __cpp_lib_shared_ptr_arrays 201611L @@ -292,7 +296,7 @@ # define __cpp_lib_void_t 201411L #endif -#if _LIBCPP_STD_VER > 17 +#if _LIBCPP_STD_VER >= 20 # undef __cpp_lib_array_constexpr # define __cpp_lib_array_constexpr 201811L # define __cpp_lib_assume_aligned 201811L @@ -302,10 +306,10 @@ // # define __cpp_lib_atomic_ref 201806L // # define __cpp_lib_atomic_shared_ptr 201711L # define __cpp_lib_atomic_value_initialization 201911L -# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_atomic_wait) +# if !defined(_LIBCPP_AVAILABILITY_HAS_NO_SYNC) # define __cpp_lib_atomic_wait 201907L # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_barrier) +# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_HAS_NO_SYNC) # define __cpp_lib_barrier 201907L # endif # define __cpp_lib_bind_front 201907L @@ -329,14 +333,14 @@ # define __cpp_lib_constexpr_utility 201811L # define __cpp_lib_constexpr_vector 201907L # define __cpp_lib_coroutine 201902L -# if _LIBCPP_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L +# if _LIBCPP_STD_VER >= 20 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L # define __cpp_lib_destroying_delete 201806L # endif # define __cpp_lib_endian 201907L # define __cpp_lib_erase_if 202002L # undef __cpp_lib_execution // # define __cpp_lib_execution 201902L -# if !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_format) && !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) +# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) // # define __cpp_lib_format 202106L # endif # define __cpp_lib_generic_unordered_lookup 201811L @@ -350,22 +354,23 @@ # if !defined(_LIBCPP_HAS_NO_THREADS) // # define __cpp_lib_jthread 201911L # endif -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_latch) +# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_HAS_NO_SYNC) # define __cpp_lib_latch 201907L # endif # define __cpp_lib_list_remove_return_type 201806L # define __cpp_lib_math_constants 201907L +# define __cpp_lib_move_iterator_concept 202207L # define __cpp_lib_polymorphic_allocator 201902L # define __cpp_lib_ranges 202106L # define __cpp_lib_remove_cvref 201711L -# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_DISABLE_FTM___cpp_lib_semaphore) +# if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(_LIBCPP_AVAILABILITY_HAS_NO_SYNC) # define __cpp_lib_semaphore 201907L # endif # undef __cpp_lib_shared_ptr_arrays # define __cpp_lib_shared_ptr_arrays 201707L # define __cpp_lib_shift 201806L // # define __cpp_lib_smart_ptr_for_overwrite 202002L -# if __has_builtin(__builtin_source_location) +# if __has_builtin(__builtin_source_location) && !(defined(_LIBCPP_APPLE_CLANG_VER) && _LIBCPP_APPLE_CLANG_VER <= 1403) # define __cpp_lib_source_location 201907L # endif # define __cpp_lib_span 202002L @@ -381,7 +386,7 @@ # define __cpp_lib_unwrap_ref 201811L #endif -#if _LIBCPP_STD_VER > 20 +#if _LIBCPP_STD_VER >= 23 # define __cpp_lib_adaptor_iterator_pair_constructor 202106L # define __cpp_lib_allocate_at_least 202106L // # define __cpp_lib_associative_heterogeneous_erasure 202110L @@ -392,15 +397,22 @@ // # define __cpp_lib_constexpr_cmath 202202L # undef __cpp_lib_constexpr_memory # define __cpp_lib_constexpr_memory 202202L -// # define __cpp_lib_constexpr_typeinfo 202106L +# define __cpp_lib_constexpr_typeinfo 202106L # define __cpp_lib_expected 202202L +# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) +# define __cpp_lib_format_ranges 202207L +# endif +# if !defined(_LIBCPP_HAS_NO_INCOMPLETE_FORMAT) +// # define __cpp_lib_formatters 202302L +# endif # define __cpp_lib_forward_like 202207L -// # define __cpp_lib_invoke_r 202106L +# define __cpp_lib_invoke_r 202106L # define __cpp_lib_is_scoped_enum 202011L // # define __cpp_lib_move_only_function 202110L # undef __cpp_lib_optional # define __cpp_lib_optional 202110L // # define __cpp_lib_out_ptr 202106L +# define __cpp_lib_ranges_as_rvalue 202207L // # define __cpp_lib_ranges_chunk 202202L // # define __cpp_lib_ranges_chunk_by 202202L // # define __cpp_lib_ranges_iota 202202L