diff options
author | arcadia-devtools <[email protected]> | 2022-03-30 14:55:02 +0300 |
---|---|---|
committer | arcadia-devtools <[email protected]> | 2022-03-30 14:55:02 +0300 |
commit | 24f5751a6226aa590aebd7e5915fa3508d40fbd9 (patch) | |
tree | ca4f8c3f42989f5f2b9d2d26b27bc0cead4d8bbb /contrib/libs/cxxsupp/libcxx | |
parent | b8e180adf4a659f46cacb10cd67b96e38ef660a1 (diff) |
intermediate changes
ref:6e865ff0ae14a24901c8add989f674d8e88acf17
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx')
25 files changed, 180 insertions, 196 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/import b/contrib/libs/cxxsupp/libcxx/import index 318c8820f78..caec9ca1386 100755 --- a/contrib/libs/cxxsupp/libcxx/import +++ b/contrib/libs/cxxsupp/libcxx/import @@ -1,6 +1,6 @@ #!/bin/sh -e -rev=7056250f +rev=ee8e81b4 output_dir="libcxx-r$rev" if [ -z $1 ] ; then git clone https://github.com/llvm/llvm-project.git --no-checkout "$output_dir/tmp" diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_heap.h index b3defd4de07..a67c798ee7d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_heap.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/make_heap.h @@ -32,7 +32,7 @@ __make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compar // start from the first parent, there is no need to consider children for (difference_type __start = (__n - 2) / 2; __start >= 0; --__start) { - _VSTD::__sift_down<_Compare>(__first, __last, __comp, __n, __first + __start); + _VSTD::__sift_down<_Compare>(__first, __comp, __n, __first + __start); } } } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort.h index 622624ec4f4..017ac90b671 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort.h @@ -40,7 +40,7 @@ __partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _R if (__comp(*__i, *__first)) { swap(*__i, *__first); - _VSTD::__sift_down<_Compare>(__first, __middle, __comp, __len, __first); + _VSTD::__sift_down<_Compare>(__first, __comp, __len, __first); } } _VSTD::__sort_heap<_Compare>(__first, __middle, __comp); diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort_copy.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort_copy.h index 4c0c9f5ad04..a81c621c75c 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/partial_sort_copy.h @@ -40,7 +40,7 @@ __partial_sort_copy(_InputIterator __first, _InputIterator __last, if (__comp(*__first, *__result_first)) { *__result_first = *__first; - _VSTD::__sift_down<_Compare>(__result_first, __r, __comp, __len, __result_first); + _VSTD::__sift_down<_Compare>(__result_first, __comp, __len, __result_first); } _VSTD::__sort_heap<_Compare>(__result_first, __r, __comp); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pop_heap.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pop_heap.h index e8c801a5c81..1d57de24ff0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/pop_heap.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/pop_heap.h @@ -31,7 +31,7 @@ __pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare if (__len > 1) { swap(*__first, *--__last); - _VSTD::__sift_down<_Compare>(__first, __last, __comp, __len - 1, __first); + _VSTD::__sift_down<_Compare>(__first, __comp, __len - 1, __first); } } diff --git a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sift_down.h b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sift_down.h index 4d99ff237c9..bf5447698cd 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__algorithm/sift_down.h +++ b/contrib/libs/cxxsupp/libcxx/include/__algorithm/sift_down.h @@ -21,8 +21,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _Compare, class _RandomAccessIterator> _LIBCPP_CONSTEXPR_AFTER_CXX11 void -__sift_down(_RandomAccessIterator __first, _RandomAccessIterator /*__last*/, - _Compare __comp, +__sift_down(_RandomAccessIterator __first, _Compare __comp, typename iterator_traits<_RandomAccessIterator>::difference_type __len, _RandomAccessIterator __start) { @@ -46,7 +45,7 @@ __sift_down(_RandomAccessIterator __first, _RandomAccessIterator /*__last*/, // check if we are in heap-order if (__comp(*__child_i, *__start)) - // we are, __start is larger than it's largest child + // we are, __start is larger than its largest child return; value_type __top(_VSTD::move(*__start)); diff --git a/contrib/libs/cxxsupp/libcxx/include/__coroutine/noop_coroutine_handle.h b/contrib/libs/cxxsupp/libcxx/include/__coroutine/noop_coroutine_handle.h index 07440c3d752..6952e245f2d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__coroutine/noop_coroutine_handle.h +++ b/contrib/libs/cxxsupp/libcxx/include/__coroutine/noop_coroutine_handle.h @@ -20,7 +20,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_builtin(__builtin_coro_noop) +#if __has_builtin(__builtin_coro_noop) || defined(_LIBCPP_COMPILER_GCC) + // [coroutine.noop] // [coroutine.promise.noop] struct noop_coroutine_promise {}; @@ -64,20 +65,45 @@ private: _LIBCPP_HIDE_FROM_ABI friend coroutine_handle<noop_coroutine_promise> noop_coroutine() noexcept; +#if __has_builtin(__builtin_coro_noop) _LIBCPP_HIDE_FROM_ABI coroutine_handle() noexcept { this->__handle_ = __builtin_coro_noop(); } void* __handle_ = nullptr; + +#elif defined(_LIBCPP_COMPILER_GCC) + // GCC doesn't implement __builtin_coro_noop(). + // Construct the coroutine frame manually instead. + struct __noop_coroutine_frame_ty_ { + static void __dummy_resume_destroy_func() { } + + void (*__resume_)() = __dummy_resume_destroy_func; + void (*__destroy_)() = __dummy_resume_destroy_func; + struct noop_coroutine_promise __promise_; + }; + + static __noop_coroutine_frame_ty_ __noop_coroutine_frame_; + + void* __handle_ = &__noop_coroutine_frame_; + + _LIBCPP_HIDE_FROM_ABI coroutine_handle() noexcept = default; + +#endif // __has_builtin(__builtin_coro_noop) }; using noop_coroutine_handle = coroutine_handle<noop_coroutine_promise>; +#if defined(_LIBCPP_COMPILER_GCC) +inline noop_coroutine_handle::__noop_coroutine_frame_ty_ + noop_coroutine_handle::__noop_coroutine_frame_{}; +#endif + // [coroutine.noop.coroutine] inline _LIBCPP_HIDE_FROM_ABI noop_coroutine_handle noop_coroutine() noexcept { return noop_coroutine_handle(); } -#endif // __has_builtin(__builtin_coro_noop) +#endif // __has_builtin(__builtin_coro_noop) || defined(_LIBCPP_COMPILER_GCC) _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h b/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h index a9a8c1f0da0..59429c13d41 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/format_arg.h @@ -37,21 +37,20 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if !defined(_LIBCPP_HAS_NO_CONCEPTS) namespace __format { -/** The type stored in @ref basic_format_arg. */ +/// The type stored in @ref basic_format_arg. +/// +/// @note The 128-bit types are unconditionally in the list to avoid the values +/// of the enums to depend on the availability of 128-bit integers. enum class _LIBCPP_ENUM_VIS __arg_t : uint8_t { __none, __boolean, __char_type, __int, __long_long, -#ifndef _LIBCPP_HAS_NO_INT128 __i128, -#endif __unsigned, __unsigned_long_long, -#ifndef _LIBCPP_HAS_NO_INT128 __u128, -#endif __float, __double, __long_double, @@ -75,18 +74,22 @@ visit_format_arg(_Visitor&& __vis, basic_format_arg<_Context> __arg) { return _VSTD::invoke(_VSTD::forward<_Visitor>(__vis), __arg.__int); case __format::__arg_t::__long_long: return _VSTD::invoke(_VSTD::forward<_Visitor>(__vis), __arg.__long_long); -#ifndef _LIBCPP_HAS_NO_INT128 case __format::__arg_t::__i128: +#ifndef _LIBCPP_HAS_NO_INT128 return _VSTD::invoke(_VSTD::forward<_Visitor>(__vis), __arg.__i128); +#else + _LIBCPP_UNREACHABLE(); #endif case __format::__arg_t::__unsigned: return _VSTD::invoke(_VSTD::forward<_Visitor>(__vis), __arg.__unsigned); case __format::__arg_t::__unsigned_long_long: return _VSTD::invoke(_VSTD::forward<_Visitor>(__vis), __arg.__unsigned_long_long); -#ifndef _LIBCPP_HAS_NO_INT128 case __format::__arg_t::__u128: +#ifndef _LIBCPP_HAS_NO_INT128 return _VSTD::invoke(_VSTD::forward<_Visitor>(__vis), __arg.__u128); +#else + _LIBCPP_UNREACHABLE(); #endif case __format::__arg_t::__float: return _VSTD::invoke(_VSTD::forward<_Visitor>(__vis), __arg.__float); diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/format_context.h b/contrib/libs/cxxsupp/libcxx/include/__format/format_context.h index b4fe5cc7b12..f8ec7c8eb00 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/format_context.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/format_context.h @@ -14,10 +14,9 @@ #include <__config> #include <__format/format_args.h> #include <__format/format_fwd.h> +#include <__iterator/back_insert_iterator.h> #include <__iterator/concepts.h> #include <concepts> -#include <iterator> -#include <string> #ifndef _LIBCPP_HAS_NO_LOCALIZATION #include <locale> diff --git a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_string.h b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_string.h index 2be36a1ba94..75a81f5184a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__format/formatter_string.h +++ b/contrib/libs/cxxsupp/libcxx/include/__format/formatter_string.h @@ -16,7 +16,6 @@ #include <__format/format_string.h> #include <__format/formatter.h> #include <__format/parser_std_format_spec.h> -#include <algorithm> #include <string_view> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) diff --git a/contrib/libs/cxxsupp/libcxx/include/__iterator/concepts.h b/contrib/libs/cxxsupp/libcxx/include/__iterator/concepts.h index 531acdf0a5b..d7a666743af 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__iterator/concepts.h +++ b/contrib/libs/cxxsupp/libcxx/include/__iterator/concepts.h @@ -28,8 +28,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if !defined(_LIBCPP_HAS_NO_RANGES) -// clang-format off - // [iterator.concept.readable] template<class _In> concept __indirectly_readable_impl = @@ -259,8 +257,6 @@ concept indirectly_movable_storable = // Note: indirectly_swappable is located in iter_swap.h to prevent a dependency cycle // (both iter_swap and indirectly_swappable require indirectly_readable). -// clang-format on - #endif // !defined(_LIBCPP_HAS_NO_RANGES) _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/access.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/access.h index b0b89c0eeea..91dc3055c86 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/access.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/access.h @@ -14,8 +14,7 @@ #include <__iterator/readable_traits.h> #include <__ranges/enable_borrowed_range.h> #include <__utility/as_const.h> -#include <__utility/decay_copy.h> -#include <__utility/forward.h> +#include <__utility/auto_cast.h> #include <concepts> #include <type_traits> @@ -27,24 +26,21 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if !defined(_LIBCPP_HAS_NO_RANGES) -// clang-format off - namespace ranges { template <class _Tp> concept __can_borrow = - is_lvalue_reference_v<_Tp> || enable_borrowed_range<remove_cvref_t<_Tp> >; - - template<class _Tp> - concept __is_complete = requires { sizeof(_Tp); }; + is_lvalue_reference_v<_Tp> || enable_borrowed_range<remove_cvref_t<_Tp>>; } // namespace ranges // [range.access.begin] -namespace ranges::__begin { + +namespace ranges { +namespace __begin { template <class _Tp> concept __member_begin = __can_borrow<_Tp> && requires(_Tp&& __t) { - { _VSTD::__decay_copy(__t.begin()) } -> input_or_output_iterator; + { _LIBCPP_AUTO_CAST(__t.begin()) } -> input_or_output_iterator; }; void begin(auto&) = delete; @@ -54,61 +50,61 @@ namespace ranges::__begin { concept __unqualified_begin = !__member_begin<_Tp> && __can_borrow<_Tp> && - __class_or_enum<remove_cvref_t<_Tp> > && + __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp && __t) { - { _VSTD::__decay_copy(begin(__t)) } -> input_or_output_iterator; + { _LIBCPP_AUTO_CAST(begin(__t)) } -> input_or_output_iterator; }; struct __fn { template <class _Tp> - requires is_array_v<remove_cv_t<_Tp>> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp& __t) const noexcept { - constexpr bool __complete = __is_complete<iter_value_t<_Tp> >; - if constexpr (__complete) { // used to disable cryptic diagnostic - return __t + 0; - } - else { - static_assert(__complete, "`std::ranges::begin` is SFINAE-unfriendly on arrays of an incomplete type."); - } + requires is_array_v<remove_cv_t<_Tp>> + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp& __t) const noexcept + { + return __t; } template <class _Tp> - requires __member_begin<_Tp> + requires __member_begin<_Tp> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(_VSTD::__decay_copy(__t.begin()))) + noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.begin()))) { - return __t.begin(); + return _LIBCPP_AUTO_CAST(__t.begin()); } template <class _Tp> - requires __unqualified_begin<_Tp> + requires __unqualified_begin<_Tp> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(_VSTD::__decay_copy(begin(__t)))) + noexcept(noexcept(_LIBCPP_AUTO_CAST(begin(__t)))) { - return begin(__t); + return _LIBCPP_AUTO_CAST(begin(__t)); } void operator()(auto&&) const = delete; }; -} // namespace ranges::__begin +} -namespace ranges { - inline namespace __cpo { - inline constexpr auto begin = __begin::__fn{}; - } // namespace __cpo +inline namespace __cpo { + inline constexpr auto begin = __begin::__fn{}; +} // namespace __cpo +} // namespace ranges + +// [range.range] +namespace ranges { template <class _Tp> using iterator_t = decltype(ranges::begin(declval<_Tp&>())); } // namespace ranges // [range.access.end] -namespace ranges::__end { + +namespace ranges { +namespace __end { template <class _Tp> concept __member_end = __can_borrow<_Tp> && requires(_Tp&& __t) { typename iterator_t<_Tp>; - { _VSTD::__decay_copy(_VSTD::forward<_Tp>(__t).end()) } -> sentinel_for<iterator_t<_Tp> >; + { _LIBCPP_AUTO_CAST(__t.end()) } -> sentinel_for<iterator_t<_Tp>>; }; void end(auto&) = delete; @@ -118,98 +114,101 @@ namespace ranges::__end { concept __unqualified_end = !__member_end<_Tp> && __can_borrow<_Tp> && - __class_or_enum<remove_cvref_t<_Tp> > && + __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp && __t) { typename iterator_t<_Tp>; - { _VSTD::__decay_copy(end(_VSTD::forward<_Tp>(__t))) } -> sentinel_for<iterator_t<_Tp> >; + { _LIBCPP_AUTO_CAST(end(__t)) } -> sentinel_for<iterator_t<_Tp>>; }; class __fn { public: template <class _Tp, size_t _Np> - [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[_Np]) const noexcept { - constexpr bool __complete = __is_complete<remove_cv_t<_Tp> >; - if constexpr (__complete) { // used to disable cryptic diagnostic - return __t + _Np; - } - else { - static_assert(__complete, "`std::ranges::end` is SFINAE-unfriendly on arrays of an incomplete type."); - } + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp (&__t)[_Np]) const noexcept + requires (sizeof(*__t) != 0) // Disallow incomplete element types. + { + return __t + _Np; } template <class _Tp> - requires __member_end<_Tp> + requires __member_end<_Tp> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(_VSTD::__decay_copy(__t.end()))) + noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.end()))) { - return _VSTD::forward<_Tp>(__t).end(); + return _LIBCPP_AUTO_CAST(__t.end()); } template <class _Tp> - requires __unqualified_end<_Tp> + requires __unqualified_end<_Tp> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(_VSTD::__decay_copy(end(__t)))) + noexcept(noexcept(_LIBCPP_AUTO_CAST(end(__t)))) { - return end(__t); + return _LIBCPP_AUTO_CAST(end(__t)); } void operator()(auto&&) const = delete; }; -} // namespace ranges::__end +} -namespace ranges::inline __cpo { +inline namespace __cpo { inline constexpr auto end = __end::__fn{}; -} // namespace ranges::__cpo +} // namespace __cpo +} // namespace ranges -namespace ranges::__cbegin { +// [range.access.cbegin] + +namespace ranges { +namespace __cbegin { struct __fn { template <class _Tp> - requires invocable<decltype(ranges::begin), _Tp const&> + requires invocable<decltype(ranges::begin), _Tp const&> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp& __t) const - noexcept(noexcept(ranges::begin(_VSTD::as_const(__t)))) + noexcept(noexcept(ranges::begin(_VSTD::as_const(__t)))) { return ranges::begin(_VSTD::as_const(__t)); } template <class _Tp> - requires is_rvalue_reference_v<_Tp> && invocable<decltype(ranges::begin), _Tp const&&> + requires is_rvalue_reference_v<_Tp> && invocable<decltype(ranges::begin), _Tp const&&> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(ranges::begin(static_cast<_Tp const&&>(__t)))) + noexcept(noexcept(ranges::begin(static_cast<_Tp const&&>(__t)))) { return ranges::begin(static_cast<_Tp const&&>(__t)); } }; -} // namespace ranges::__cbegin +} -namespace ranges::inline __cpo { +inline namespace __cpo { inline constexpr auto cbegin = __cbegin::__fn{}; -} // namespace ranges::__cpo +} // namespace __cpo +} // namespace ranges + +// [range.access.cend] -namespace ranges::__cend { +namespace ranges { +namespace __cend { struct __fn { template <class _Tp> - requires invocable<decltype(ranges::end), _Tp const&> + requires invocable<decltype(ranges::end), _Tp const&> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp& __t) const - noexcept(noexcept(ranges::end(_VSTD::as_const(__t)))) + noexcept(noexcept(ranges::end(_VSTD::as_const(__t)))) { return ranges::end(_VSTD::as_const(__t)); } template <class _Tp> - requires is_rvalue_reference_v<_Tp> && invocable<decltype(ranges::end), _Tp const&&> + requires is_rvalue_reference_v<_Tp> && invocable<decltype(ranges::end), _Tp const&&> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(ranges::end(static_cast<_Tp const&&>(__t)))) + noexcept(noexcept(ranges::end(static_cast<_Tp const&&>(__t)))) { return ranges::end(static_cast<_Tp const&&>(__t)); } }; -} // namespace ranges::__cend +} -namespace ranges::inline __cpo { +inline namespace __cpo { inline constexpr auto cend = __cend::__fn{}; -} // namespace ranges::__cpo - -// clang-format off +} // namespace __cpo +} // namespace ranges #endif // !defined(_LIBCPP_HAS_NO_RANGES) diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/all.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/all.h index affe13ee086..ccc77258ba1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/all.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/all.h @@ -17,7 +17,7 @@ #include <__ranges/range_adaptor.h> #include <__ranges/ref_view.h> #include <__ranges/subrange.h> -#include <__utility/decay_copy.h> +#include <__utility/auto_cast.h> #include <__utility/declval.h> #include <__utility/forward.h> #include <type_traits> @@ -38,9 +38,9 @@ namespace __all { requires ranges::view<decay_t<_Tp>> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t) const - noexcept(noexcept(_VSTD::__decay_copy(_VSTD::forward<_Tp>(__t)))) + noexcept(noexcept(_LIBCPP_AUTO_CAST(_VSTD::forward<_Tp>(__t)))) { - return _VSTD::forward<_Tp>(__t); + return _LIBCPP_AUTO_CAST(_VSTD::forward<_Tp>(__t)); } template<class _Tp> diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/concepts.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/concepts.h index 6a8364006be..bad23c8c4bf 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/concepts.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/concepts.h @@ -29,8 +29,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD -// clang-format off - #if !defined(_LIBCPP_HAS_NO_RANGES) namespace ranges { @@ -126,8 +124,6 @@ namespace ranges { #endif // !defined(_LIBCPP_HAS_NO_RANGES) -// clang-format on - _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___RANGES_CONCEPTS_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/data.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/data.h index 7eade494cce..cc151c59f3d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/data.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/data.h @@ -26,9 +26,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if !defined(_LIBCPP_HAS_NO_RANGES) -// clang-format off -namespace ranges { // [range.prim.data] + +namespace ranges { namespace __data { template <class _Tp> concept __ptr_to_object = is_pointer_v<_Tp> && is_object_v<remove_pointer_t<_Tp>>; @@ -65,15 +65,13 @@ namespace __data { return _VSTD::to_address(ranges::begin(_VSTD::forward<_Tp>(__t))); } }; -} // end namespace __data +} inline namespace __cpo { inline constexpr auto data = __data::__fn{}; } // namespace __cpo } // namespace ranges -// clang-format off - #endif // !defined(_LIBCPP_HAS_NO_RANGES) _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/empty.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/empty.h index fc6a938fd86..e8a8aabf4ae 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/empty.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/empty.h @@ -13,7 +13,6 @@ #include <__iterator/concepts.h> #include <__ranges/access.h> #include <__ranges/size.h> -#include <__utility/forward.h> #include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) @@ -24,19 +23,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if !defined(_LIBCPP_HAS_NO_RANGES) -// clang-format off -namespace ranges { // [range.prim.empty] + +namespace ranges { namespace __empty { template <class _Tp> concept __member_empty = requires(_Tp&& __t) { - bool(_VSTD::forward<_Tp>(__t).empty()); + bool(__t.empty()); }; template<class _Tp> concept __can_invoke_size = !__member_empty<_Tp> && - requires(_Tp&& __t) { ranges::size(_VSTD::forward<_Tp>(__t)); }; + requires(_Tp&& __t) { ranges::size(__t); }; template <class _Tp> concept __can_compare_begin_end = @@ -51,13 +50,13 @@ namespace __empty { template <__member_empty _Tp> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const noexcept(noexcept(bool(__t.empty()))) { - return __t.empty(); + return bool(__t.empty()); } template <__can_invoke_size _Tp> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t) const - noexcept(noexcept(ranges::size(_VSTD::forward<_Tp>(__t)))) { - return ranges::size(_VSTD::forward<_Tp>(__t)) == 0; + noexcept(noexcept(ranges::size(__t))) { + return ranges::size(__t) == 0; } template<__can_compare_begin_end _Tp> @@ -72,7 +71,6 @@ inline namespace __cpo { inline constexpr auto empty = __empty::__fn{}; } // namespace __cpo } // namespace ranges -// clang-format off #endif // !defined(_LIBCPP_HAS_NO_RANGES) diff --git a/contrib/libs/cxxsupp/libcxx/include/__ranges/size.h b/contrib/libs/cxxsupp/libcxx/include/__ranges/size.h index af0a8479f2e..fc6641cf488 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__ranges/size.h +++ b/contrib/libs/cxxsupp/libcxx/include/__ranges/size.h @@ -13,8 +13,7 @@ #include <__iterator/concepts.h> #include <__iterator/iterator_traits.h> #include <__ranges/access.h> -#include <__utility/decay_copy.h> -#include <__utility/forward.h> +#include <__utility/auto_cast.h> #include <concepts> #include <type_traits> @@ -26,12 +25,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if !defined(_LIBCPP_HAS_NO_RANGES) -// clang-format off namespace ranges { -template<class> -inline constexpr bool disable_sized_range = false; + template<class> + inline constexpr bool disable_sized_range = false; +} // [range.prim.size] + +namespace ranges { namespace __size { void size(auto&) = delete; void size(const auto&) = delete; @@ -41,7 +42,7 @@ namespace __size { template <class _Tp> concept __member_size = __size_enabled<_Tp> && requires(_Tp&& __t) { - { _VSTD::__decay_copy(_VSTD::forward<_Tp>(__t).size()) } -> __integer_like; + { _LIBCPP_AUTO_CAST(__t.size()) } -> __integer_like; }; template <class _Tp> @@ -50,7 +51,7 @@ namespace __size { !__member_size<_Tp> && __class_or_enum<remove_cvref_t<_Tp>> && requires(_Tp&& __t) { - { _VSTD::__decay_copy(size(_VSTD::forward<_Tp>(__t))) } -> __integer_like; + { _LIBCPP_AUTO_CAST(size(__t)) } -> __integer_like; }; template <class _Tp> @@ -76,14 +77,14 @@ namespace __size { template <__member_size _Tp> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __integer_like auto operator()(_Tp&& __t) const - noexcept(noexcept(_VSTD::forward<_Tp>(__t).size())) { - return _VSTD::forward<_Tp>(__t).size(); + noexcept(noexcept(_LIBCPP_AUTO_CAST(__t.size()))) { + return _LIBCPP_AUTO_CAST(__t.size()); } template <__unqualified_size _Tp> [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr __integer_like auto operator()(_Tp&& __t) const - noexcept(noexcept(size(_VSTD::forward<_Tp>(__t)))) { - return size(_VSTD::forward<_Tp>(__t)); + noexcept(noexcept(_LIBCPP_AUTO_CAST(size(__t)))) { + return _LIBCPP_AUTO_CAST(size(__t)); } template<__difference _Tp> @@ -92,18 +93,23 @@ namespace __size { return _VSTD::__to_unsigned_like(ranges::end(__t) - ranges::begin(__t)); } }; -} // end namespace __size +} inline namespace __cpo { inline constexpr auto size = __size::__fn{}; } // namespace __cpo +} // namespace ranges + +// [range.prim.ssize] +namespace ranges { namespace __ssize { struct __fn { template<class _Tp> requires requires (_Tp&& __t) { ranges::size(__t); } [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr integral auto operator()(_Tp&& __t) const - noexcept(noexcept(ranges::size(__t))) { + noexcept(noexcept(ranges::size(__t))) + { using _Signed = make_signed_t<decltype(ranges::size(__t))>; if constexpr (sizeof(ptrdiff_t) > sizeof(_Signed)) return static_cast<ptrdiff_t>(ranges::size(__t)); @@ -118,8 +124,6 @@ inline namespace __cpo { } // namespace __cpo } // namespace ranges -// clang-format off - #endif // !defined(_LIBCPP_HAS_NO_RANGES) _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/decay_copy.h b/contrib/libs/cxxsupp/libcxx/include/__utility/auto_cast.h index 32238e117f5..5c368e07750 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/decay_copy.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/auto_cast.h @@ -7,29 +7,16 @@ // //===----------------------------------------------------------------------===// -#ifndef _LIBCPP___UTILITY_DECAY_COPY_H -#define _LIBCPP___UTILITY_DECAY_COPY_H +#ifndef _LIBCPP___UTILITY_AUTO_CAST_H +#define _LIBCPP___UTILITY_AUTO_CAST_H #include <__config> -#include <__utility/forward.h> #include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -_LIBCPP_BEGIN_NAMESPACE_STD +#define _LIBCPP_AUTO_CAST(expr) static_cast<typename decay<decltype((expr))>::type>(expr) -template <class _Tp> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR -typename decay<_Tp>::type __decay_copy(_Tp&& __t) -#if _LIBCPP_STD_VER > 17 - noexcept(is_nothrow_convertible_v<_Tp, decay_t<_Tp>>) -#endif -{ - return _VSTD::forward<_Tp>(__t); -} - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___UTILITY_DECAY_COPY_H +#endif // _LIBCPP___UTILITY_AUTO_CAST_H diff --git a/contrib/libs/cxxsupp/libcxx/include/filesystem b/contrib/libs/cxxsupp/libcxx/include/filesystem index 09d90614aa0..9f5b42747b3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/filesystem +++ b/contrib/libs/cxxsupp/libcxx/include/filesystem @@ -238,48 +238,26 @@ inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_direct */ -#include<__filesystem/copy_options.h> -#include<__filesystem/directory_entry.h> -#include<__filesystem/directory_iterator.h> -#include<__filesystem/directory_options.h> -#include<__filesystem/file_status.h> -#include<__filesystem/file_time_type.h> -#include<__filesystem/file_type.h> -#include<__filesystem/filesystem_error.h> -#include<__filesystem/operations.h> -#include<__filesystem/path_iterator.h> -#include<__filesystem/path.h> -#include<__filesystem/perm_options.h> -#include<__filesystem/perms.h> -#include<__filesystem/recursive_directory_iterator.h> -#include<__filesystem/space_info.h> -#include<__filesystem/u8path.h> - -#include <__availability> #include <__config> -#include <__debug> -#include <__ranges/enable_borrowed_range.h> -#include <__ranges/enable_view.h> -#include <__utility/forward.h> -#include <chrono> +#include <__filesystem/copy_options.h> +#include <__filesystem/directory_entry.h> +#include <__filesystem/directory_iterator.h> +#include <__filesystem/directory_options.h> +#include <__filesystem/file_status.h> +#include <__filesystem/file_time_type.h> +#include <__filesystem/file_type.h> +#include <__filesystem/filesystem_error.h> +#include <__filesystem/operations.h> +#include <__filesystem/path_iterator.h> +#include <__filesystem/path.h> +#include <__filesystem/perm_options.h> +#include <__filesystem/perms.h> +#include <__filesystem/recursive_directory_iterator.h> +#include <__filesystem/space_info.h> +#include <__filesystem/u8path.h> #include <compare> -#include <cstddef> -#include <cstdlib> -#include <iosfwd> -#include <iterator> -#include <memory> -#include <stack> -#include <string> -#include <string_view> -#include <system_error> -#include <utility> #include <version> -#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) -# include <locale> -# include <iomanip> // for quoted -#endif - #if defined(_LIBCPP_HAS_NO_FILESYSTEM_LIBRARY) # error "The Filesystem library is not supported since libc++ has been configured with LIBCXX_ENABLE_FILESYSTEM disabled" #endif diff --git a/contrib/libs/cxxsupp/libcxx/include/future b/contrib/libs/cxxsupp/libcxx/include/future index 99df8831a77..6b666a70f48 100644 --- a/contrib/libs/cxxsupp/libcxx/include/future +++ b/contrib/libs/cxxsupp/libcxx/include/future @@ -366,7 +366,7 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>; #include <__debug> #include <__memory/allocator_arg_t.h> #include <__memory/uses_allocator.h> -#include <__utility/decay_copy.h> +#include <__utility/auto_cast.h> #include <__utility/forward.h> #include <chrono> #include <exception> @@ -2207,16 +2207,16 @@ async(launch __policy, _Fp&& __f, _Args&&... __args) { #endif if (__does_policy_contain(__policy, launch::async)) - return _VSTD::__make_async_assoc_state<_Rp>(_BF(_VSTD::__decay_copy(_VSTD::forward<_Fp>(__f)), - _VSTD::__decay_copy(_VSTD::forward<_Args>(__args))...)); + 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 } catch ( ... ) { if (__policy == launch::async) throw ; } #endif if (__does_policy_contain(__policy, launch::deferred)) - return _VSTD::__make_deferred_assoc_state<_Rp>(_BF(_VSTD::__decay_copy(_VSTD::forward<_Fp>(__f)), - _VSTD::__decay_copy(_VSTD::forward<_Args>(__args))...)); + return _VSTD::__make_deferred_assoc_state<_Rp>(_BF(_LIBCPP_AUTO_CAST(_VSTD::forward<_Fp>(__f)), + _LIBCPP_AUTO_CAST(_VSTD::forward<_Args>(__args))...)); return future<_Rp>{}; } diff --git a/contrib/libs/cxxsupp/libcxx/include/module.modulemap b/contrib/libs/cxxsupp/libcxx/include/module.modulemap index 4194a7fb83f..1dc6db406a7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/module.modulemap +++ b/contrib/libs/cxxsupp/libcxx/include/module.modulemap @@ -921,8 +921,8 @@ module std [system] { module __utility { module as_const { private header "__utility/as_const.h" } + module auto_cast { private header "__utility/auto_cast.h" } module cmp { private header "__utility/cmp.h" } - module decay_copy { private header "__utility/decay_copy.h" } module declval { private header "__utility/declval.h" } module exchange { private header "__utility/exchange.h" } module forward { private header "__utility/forward.h" } diff --git a/contrib/libs/cxxsupp/libcxx/include/thread b/contrib/libs/cxxsupp/libcxx/include/thread index bf751c87aa3..a4632f6fe52 100644 --- a/contrib/libs/cxxsupp/libcxx/include/thread +++ b/contrib/libs/cxxsupp/libcxx/include/thread @@ -88,7 +88,6 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time); #include <__mutex_base> #include <__thread/poll_with_backoff.h> #include <__threading_support> -#include <__utility/decay_copy.h> #include <__utility/forward.h> #include <chrono> #include <cstddef> @@ -303,8 +302,8 @@ thread::thread(_Fp&& __f, _Args&&... __args) typedef tuple<_TSPtr, typename decay<_Fp>::type, typename decay<_Args>::type...> _Gp; unique_ptr<_Gp> __p( new _Gp(_VSTD::move(__tsp), - _VSTD::__decay_copy(_VSTD::forward<_Fp>(__f)), - _VSTD::__decay_copy(_VSTD::forward<_Args>(__args))...)); + _VSTD::forward<_Fp>(__f), + _VSTD::forward<_Args>(__args)...)); int __ec = _VSTD::__libcpp_thread_create(&__t_, &__thread_proxy<_Gp>, __p.get()); if (__ec == 0) __p.release(); diff --git a/contrib/libs/cxxsupp/libcxx/include/utility b/contrib/libs/cxxsupp/libcxx/include/utility index 9ab7b8e0ffb..9dd7905516a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/utility +++ b/contrib/libs/cxxsupp/libcxx/include/utility @@ -218,6 +218,7 @@ template <class T> #include <__debug> #include <__tuple> #include <__utility/as_const.h> +#include <__utility/auto_cast.h> #include <__utility/cmp.h> #include <__utility/declval.h> #include <__utility/exchange.h> diff --git a/contrib/libs/cxxsupp/libcxx/src/filesystem/directory_iterator.cpp b/contrib/libs/cxxsupp/libcxx/src/filesystem/directory_iterator.cpp index ea32a2d2bd5..de7ded45140 100644 --- a/contrib/libs/cxxsupp/libcxx/src/filesystem/directory_iterator.cpp +++ b/contrib/libs/cxxsupp/libcxx/src/filesystem/directory_iterator.cpp @@ -6,8 +6,9 @@ // //===----------------------------------------------------------------------===// -#include "filesystem" #include "__config" +#include "filesystem" +#include "stack" #if defined(_LIBCPP_WIN32API) #define WIN32_LEAN_AND_MEAN #define NOMINMAX diff --git a/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h b/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h index 39e53b78436..75e0b0aa4ee 100644 --- a/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h +++ b/contrib/libs/cxxsupp/libcxx/src/filesystem/filesystem_common.h @@ -17,6 +17,7 @@ #include "cstdlib" #include "ctime" #include "filesystem" +#include "system_error" #if !defined(_LIBCPP_WIN32API) # include <unistd.h> |