diff options
author | mikhnenko <mikhnenko@yandex-team.com> | 2024-01-26 10:38:46 +0300 |
---|---|---|
committer | mikhnenko <mikhnenko@yandex-team.com> | 2024-01-26 11:13:08 +0300 |
commit | 885b105cca4721eee2ee14d6b83d856dac3739ef (patch) | |
tree | c40b876bba01bcb469aadd981ef6d9dcbbbd589d /contrib/libs/cxxsupp/libcxx/include/__utility | |
parent | 15e6154017194456fd8a7a76513e14aa4ae5f5d1 (diff) | |
download | ydb-885b105cca4721eee2ee14d6b83d856dac3739ef.tar.gz |
Update libcxx to 02 June 2023 185b81e034ba60081023b6e59504dfffb560f3e3 (llvmorg-16.0.5)
:warning: Для всех проектов и мимо проходящим коллегам :warning:
Если по каким-то причинам ваши тесты подломались, пожалуйста, переканонизируйте их сами. По статистике там просто поменялся порядок в канонизации.
Если изменения действительно серьезные -- приходите в [DEVTOOLSSUPPORT](https://st.yandex-team.ru/createTicket?queue=DEVTOOLSSUPPORT) / пишите в телеграм / призывайте в тикеты, будем разбираться.
```
Changes:
[libc++] Don't try to provide source_location on AppleClang 1403
[release/16.x][libc++] Revert the bitset sort optimization
[libc++] Avoid ODR violations in __exception_guard
[libc++][ranges] Fix incorrect integer typedef in `elements_view` test.
[libc++][format] Fix a missing include in tests.
[libc++][format] Fixes invalid usage of m type.
[libc++][format] Fix floating point formatting.
[libc++] Fix ranges::binary_search() returning true for cases where the element is not in the range
[libc++] Temporarily not use compiler intrinsics for some type traits in Objective-C++ mode.
[libc++][ranges] move all range iterators back in class
[libcxx][ranges] revert join_view::iterator and sentinel to be in-class
[libc++] Add FTM for views::as_rvalue
[libc++] Fix bug in allocate_shared_for_overwrite
[libc++] fix `shared_ptr`'s incorrect constraints
[libc++] In tests, use `abort` to terminate upon an error.
[libc++] Guard the fix to CityHash behind ABI v2
[libc++][format] Fixes constexpr validation.
[libc++] Remove use of internal glibc macros to determine if c8rtomb() and mbrtoc8() are present.
[libc++] Fixes the Clang modular build.
[libc++][ranges] Temporarily mark `ranges::join_view` as experimental.
libcxx: Don't apply ABI tags to extern "C" fns
[libc++] Introduce a compile-time mechanism to override __libcpp_verbose_abort
[libc++][format] Fixes usage of contiguous ranges.
[libc++][doc] Updates format status.
[libc++][ranges] implement `std::ranges::split_view`
[libc++] implement P1020R1 P1973R1 make_unique[shared]_for_overwrite
[libc++] Improve binary size when using __transaction
[libc++] Rename take_while_view::__sentinel to __take_while_view_sentinel
[libc++] Granularize <type_traits> includes in <bit>, <numbers> and <coroutine>
[libc++] Implement P1413R3 (Deprecate std::aligned_storage and std::aligned_union)
[libc++] Add FreeBSD XFAILs in preparation for CI
[libc++] add FreeBSD atomic wait support
[libc++][format] range-default-formatter for set.
[libc++] Move iota_view::iterator and sentinel out of iota_view
[libc++] Enable clang-tidy from the buildkite pipeline instead of hard-coding it in run-buildbot
[libc++] Enable segmented iterator optimizations for join_view::iterator
[libc++] Mark LWG3349 as complete
[libc++] Remove old CI configurations and update the supported compiler versions
[libc++] Implement P2446R2 (views::as_rvalue)
[libc++][format] range-default-formatter for map
[libc++][format] Adds formatter std::vector<bool>.
[libc++][format] Adds container adaptor formatters.
[libc++][format] Implements range_formatter
[libc++][format] Adds new test macros.
[libc++][ranges] Remove a leftover include version control markers in Cxx20Papers.csv
[libc++][ranges] Mark completed Ranges papers and issues as done, bump version macro
[libc++] Add ALLOW_RETRIES to a few flaky tests
[SystemZ][z/OS] Fix cityhash lit for EBCDIC
[libc++] Mark std::pmr virtual functions as _LIBCPP_HIDE_FROM_ABI_VIRTUAL
[libc++] Remove <type_traits> includes from <atomic> and <ratio>
[libcxx] Add missing includes
[libc++] allow redefined macro in non_trivial_copy_move_ABI test
[libc++][ranges] implement `std::views::elements_view`
[libc++] Add [[clang::lifetimebound]] attribute to std::forward and friends
Reapply "[libc++][ranges]Refactor `copy{,_backward}` and `move{,_backward}`"
[libc++] Add clang-tidy to the list of possible substitutions for %{clang-tidy}
[libc++] Add missing includes in move_iterator.h
[libc++] Make pmr::monotonic_buffer_resource bump down
[libc++] Add [[nodiscard]] extensions in <math.h>
[libc++] Fix ranges::uninitialized_move{, _n} for move-only types
[libc++][ranges] Fix incorrect integer type in `view_interface` tests.
[libc++] Hold mutex lock while notify_all is called at notify_all_at_thread_exit
[Libcxx] Add <source_location> header.
[libc++] Rename transform_view::{__iterator, __sentinel} to __transform_view_{iterator, sentinel}
[libc++] Add FreeBSD exceptions.nonew ABI list
[libc++][format] Fixes escaping string literals.
[libc++] Use _LIBCPP_HIDE_FROM_ABI_VIRTUAL instead of _LIBCPP_INLINE_VISIBILITY attribute on virtual function
[libc++][test] Move `common_input_iterator` to `test_iterators.h`
[libc++][utils] Remove unused import in `run.py`
[libc++] Remove warning for `LIBCXX_SYSROOT`, `LIBCXX_TARGET_TRIPLE`, and `LIBCXX_GCC_TOOLCHAIN`
[libc++] Fix aligned_alloc usage for Android
[libc++] Use %{clang-query} when calling clang-query
[libc++] Add missing include in __format/unicode.h
[libc++] Remove HIDE_FROM_ABI from virtual functions
[libc++] Fix transitive includes list for C++23
[libc++] Add _LIBCPP_HIDE_FROM_ABI to __constexpr_logb and __constexpr_scalbn
[libc++] Granularize <bit> and remove <__bits>
[libc++] [C++20] [P0415] Constexpr for std::complex.
libc++: bring back the unsigned in the return type in wcstoull_l
[libc++][CI] Improves clang-(tidy|query) selection.
[libc++] Granularize <type_traits> includes in <iterator>
[libc++] Implement constexpr {isfinite, isinf, isnan, isnormal}
[libc++][chrono] Add calendar type formatters.
[libc++] LWG3738 Validates a missing precondition.
[libc++] LWG3745 noexcept for atomic_wait.
[libc++] Granularize <type_traits> includes in <compare>
std::sort: add BlockQuickSort partitioning algorithm for arithmetic types
[libc++] Granularize <type_traits> includes in <utility>
[libc++][format] Removes test redundancy.
[libc++][format] Adds formatter for tuple and pair
[libc++] Use aligned_alloc instead of posix_memalign for C++17
[libc++] Rename __tuple to __tuple_dir to avoid file collision
[libc++] Add FreeBSD ABI list
[libc++] Adds __cpp_lib_constexpr_algorithms to utility.
[libc++] Granularize <type_traits> includes in <concepts
[libc++][format] Renames __null_sentinel.
Implementstd::ranges::view_interface::size returns a signed type
[libc++] Implement P1169R4 (static operator())
[libc++] Implement `std::expected` P0323R12
[libc++][Android] Disable pbump2gig for Android
[libc++][Android] Android/Bionic headers don't work with modules yet
[libc++][math.h] Add double overloads
[libc++] Move filter_view::iterator and sentinel out of filter_view
[libc++] Implement P0339R6 (polymorphic_allocator<> as a vocabulary type)
[libc++][format] Adds range-default-formatter.
[libc++][Android] Rename user NS to User to avoid conflict with struct
[libc++] Fix memory leaks when throwing inside std::vector constructors
```
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/__utility')
17 files changed, 210 insertions, 135 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/as_const.h b/contrib/libs/cxxsupp/libcxx/include/__utility/as_const.h index e28d7bc1a2..d4a72f43d4 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/as_const.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/as_const.h @@ -10,9 +10,9 @@ #define _LIBCPP___UTILITY_AS_CONST_H #include <__config> +#include <__type_traits/add_const.h> #include <__utility/forward.h> #include <__utility/move.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/auto_cast.h b/contrib/libs/cxxsupp/libcxx/include/__utility/auto_cast.h index e907944395..381ed0c205 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/auto_cast.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/auto_cast.h @@ -11,7 +11,7 @@ #define _LIBCPP___UTILITY_AUTO_CAST_H #include <__config> -#include <type_traits> +#include <__type_traits/decay.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/cmp.h b/contrib/libs/cxxsupp/libcxx/include/__utility/cmp.h index 3cfd981067..d448a1d084 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/cmp.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/cmp.h @@ -10,10 +10,14 @@ #define _LIBCPP___UTILITY_CMP_H #include <__config> +#include <__type_traits/disjunction.h> +#include <__type_traits/is_integral.h> +#include <__type_traits/is_same.h> +#include <__type_traits/is_signed.h> +#include <__type_traits/make_unsigned.h> #include <__utility/forward.h> #include <__utility/move.h> #include <limits> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/declval.h b/contrib/libs/cxxsupp/libcxx/include/__utility/declval.h index 97fd1eba91..c2f4bec132 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/declval.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/declval.h @@ -27,7 +27,7 @@ _Tp __declval(long); _LIBCPP_SUPPRESS_DEPRECATED_POP template <class _Tp> -decltype(__declval<_Tp>(0)) declval() _NOEXCEPT; +decltype(std::__declval<_Tp>(0)) declval() _NOEXCEPT; _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/exception_guard.h b/contrib/libs/cxxsupp/libcxx/include/__utility/exception_guard.h new file mode 100644 index 0000000000..46f9359a5c --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/exception_guard.h @@ -0,0 +1,139 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___UTILITY_TRANSACTION_H +#define _LIBCPP___UTILITY_TRANSACTION_H + +#include <__assert> +#include <__config> +#include <__type_traits/is_nothrow_move_constructible.h> +#include <__utility/exchange.h> +#include <__utility/move.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +// __exception_guard is a helper class for writing code with the strong exception guarantee. +// +// When writing code that can throw an exception, one can store rollback instructions in an +// exception guard so that if an exception is thrown at any point during the lifetime of the +// exception guard, it will be rolled back automatically. When the exception guard is done, one +// must mark it as being complete so it isn't rolled back when the exception guard is destroyed. +// +// Exception guards are not default constructible, they can't be copied or assigned to, but +// they can be moved around for convenience. +// +// __exception_guard is a no-op in -fno-exceptions mode to produce better code-gen. This means +// that we don't provide the strong exception guarantees. However, Clang doesn't generate cleanup +// code with exceptions disabled, so even if we wanted to provide the strong exception guarantees +// we couldn't. This is also only relevant for constructs with a stack of +// -fexceptions > -fno-exceptions > -fexceptions code, since the exception can't be caught where +// exceptions are disabled. While -fexceptions > -fno-exceptions is quite common +// (e.g. libc++.dylib > -fno-exceptions), having another layer with exceptions enabled seems a lot +// 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: +// +// template <class Iterator, class Size, class OutputIterator> +// Iterator uninitialized_copy_n(Iterator iter, Size n, OutputIterator out) { +// typedef typename iterator_traits<Iterator>::value_type value_type; +// __exception_guard guard([start=out, &out] { +// std::destroy(start, out); +// }); +// +// for (; n > 0; ++iter, ++out, --n) { +// ::new ((void*)std::addressof(*out)) value_type(*iter); +// } +// guard.__complete(); +// return out; +// } +// + +#ifndef _LIBCPP_NO_EXCEPTIONS +template <class _Rollback> +struct __exception_guard_exceptions { + __exception_guard_exceptions() = delete; + + _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_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_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_exceptions() { + if (!__completed_) + __rollback_(); + } + +private: + _Rollback __rollback_; + bool __completed_; +}; + +_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(__exception_guard_exceptions); + +template <class _Rollback> +using __exception_guard = __exception_guard_exceptions<_Rollback>; +#else // _LIBCPP_NO_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_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_noexceptions() { + _LIBCPP_ASSERT(__completed_, "__exception_guard not completed with exceptions disabled"); + } + +private: + bool __completed_ = false; +}; + +_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(__exception_guard_noexceptions); + +template <class _Rollback> +using __exception_guard = __exception_guard_noexceptions<_Rollback>; +#endif // _LIBCPP_NO_EXCEPTIONS + +template <class _Rollback> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __exception_guard<_Rollback> __make_exception_guard(_Rollback __rollback) { + return __exception_guard<_Rollback>(std::move(__rollback)); +} + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___UTILITY_TRANSACTION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/exchange.h b/contrib/libs/cxxsupp/libcxx/include/__utility/exchange.h index 6838fc8c62..8df71a17b1 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/exchange.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/exchange.h @@ -10,9 +10,10 @@ #define _LIBCPP___UTILITY_EXCHANGE_H #include <__config> +#include <__type_traits/is_nothrow_assignable.h> +#include <__type_traits/is_nothrow_move_constructible.h> #include <__utility/forward.h> #include <__utility/move.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/forward.h b/contrib/libs/cxxsupp/libcxx/include/__utility/forward.h index 4e254e0fa0..010f2362bd 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/forward.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/forward.h @@ -21,14 +21,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp> -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _Tp&& -forward(__libcpp_remove_reference_t<_Tp>& __t) _NOEXCEPT { +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp&& +forward(_LIBCPP_LIFETIMEBOUND __libcpp_remove_reference_t<_Tp>& __t) _NOEXCEPT { return static_cast<_Tp&&>(__t); } template <class _Tp> -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _Tp&& -forward(__libcpp_remove_reference_t<_Tp>&& __t) _NOEXCEPT { +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp&& +forward(_LIBCPP_LIFETIMEBOUND __libcpp_remove_reference_t<_Tp>&& __t) _NOEXCEPT { static_assert(!is_lvalue_reference<_Tp>::value, "cannot forward an rvalue as an lvalue"); return static_cast<_Tp&&>(__t); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/forward_like.h b/contrib/libs/cxxsupp/libcxx/include/__utility/forward_like.h index 1446964da5..7bb0d7d203 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/forward_like.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/forward_like.h @@ -34,7 +34,8 @@ template <class _Ap, class _Bp> using _ForwardLike = _OverrideRef<_Ap&&, _CopyConst<remove_reference_t<_Ap>, remove_reference_t<_Bp>>>; template <class _Tp, class _Up> -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto forward_like(_Up&& __ux) noexcept -> _ForwardLike<_Tp, _Up> { +[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr auto forward_like(_LIBCPP_LIFETIMEBOUND _Up&& __ux) noexcept + -> _ForwardLike<_Tp, _Up> { return static_cast<_ForwardLike<_Tp, _Up>>(__ux); } diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/in_place.h b/contrib/libs/cxxsupp/libcxx/include/__utility/in_place.h index bedd9e1e00..a3518455e2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/in_place.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/in_place.h @@ -10,7 +10,8 @@ #define _LIBCPP___UTILITY_IN_PLACE_H #include <__config> -#include <type_traits> +#include <__type_traits/remove_cvref.h> +#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/integer_sequence.h b/contrib/libs/cxxsupp/libcxx/include/__utility/integer_sequence.h index 87c76e9d92..257b4301c0 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/integer_sequence.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/integer_sequence.h @@ -10,7 +10,8 @@ #define _LIBCPP___UTILITY_INTEGER_SEQUENCE_H #include <__config> -#include <type_traits> +#include <__type_traits/is_integral.h> +#include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -137,6 +138,14 @@ template<size_t _Np> template<class... _Tp> using index_sequence_for = make_index_sequence<sizeof...(_Tp)>; +# if _LIBCPP_STD_VER > 17 +// 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 > 11 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/move.h b/contrib/libs/cxxsupp/libcxx/include/__utility/move.h index 522673005b..4859c39e8b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/move.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/move.h @@ -11,7 +11,10 @@ #define _LIBCPP___UTILITY_MOVE_H #include <__config> -#include <type_traits> +#include <__type_traits/conditional.h> +#include <__type_traits/is_copy_constructible.h> +#include <__type_traits/is_nothrow_move_constructible.h> +#include <__type_traits/remove_reference.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -20,8 +23,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp> -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __libcpp_remove_reference_t<_Tp>&& -move(_Tp&& __t) _NOEXCEPT { +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __libcpp_remove_reference_t<_Tp>&& +move(_LIBCPP_LIFETIMEBOUND _Tp&& __t) _NOEXCEPT { typedef _LIBCPP_NODEBUG __libcpp_remove_reference_t<_Tp> _Up; return static_cast<_Up&&>(__t); } @@ -31,9 +34,9 @@ using __move_if_noexcept_result_t = __conditional_t<!is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value, const _Tp&, _Tp&&>; template <class _Tp> -_LIBCPP_NODISCARD_EXT inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX14 __move_if_noexcept_result_t<_Tp> -move_if_noexcept(_Tp& __x) _NOEXCEPT { - return _VSTD::move(__x); +_LIBCPP_NODISCARD_EXT inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 __move_if_noexcept_result_t<_Tp> +move_if_noexcept(_LIBCPP_LIFETIMEBOUND _Tp& __x) _NOEXCEPT { + return std::move(__x); } _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/pair.h b/contrib/libs/cxxsupp/libcxx/include/__utility/pair.h index d928689118..8151674bcc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/pair.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/pair.h @@ -15,16 +15,33 @@ #include <__functional/unwrap_ref.h> #include <__fwd/get.h> #include <__fwd/tuple.h> -#include <__tuple/sfinae_helpers.h> -#include <__tuple/tuple_element.h> -#include <__tuple/tuple_indices.h> -#include <__tuple/tuple_size.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 <__type_traits/common_reference.h> +#include <__type_traits/common_type.h> +#include <__type_traits/conditional.h> +#include <__type_traits/is_assignable.h> +#include <__type_traits/is_constructible.h> +#include <__type_traits/is_convertible.h> +#include <__type_traits/is_copy_assignable.h> +#include <__type_traits/is_default_constructible.h> #include <__type_traits/is_implicitly_default_constructible.h> +#include <__type_traits/is_move_assignable.h> +#include <__type_traits/is_nothrow_assignable.h> +#include <__type_traits/is_nothrow_constructible.h> +#include <__type_traits/is_nothrow_copy_assignable.h> +#include <__type_traits/is_nothrow_copy_constructible.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_swappable.h> +#include <__type_traits/nat.h> #include <__utility/forward.h> #include <__utility/move.h> #include <__utility/piecewise_construct.h> #include <cstddef> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/rel_ops.h b/contrib/libs/cxxsupp/libcxx/include/__utility/rel_ops.h index 2577e94e91..5f8d42c0b2 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/rel_ops.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/rel_ops.h @@ -10,9 +10,6 @@ #define _LIBCPP___UTILITY_REL_OPS_H #include <__config> -#include <__utility/forward.h> -#include <__utility/move.h> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/swap.h b/contrib/libs/cxxsupp/libcxx/include/__utility/swap.h index 545614aeca..0843b35a8b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/swap.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/swap.h @@ -10,10 +10,14 @@ #define _LIBCPP___UTILITY_SWAP_H #include <__config> +#include <__type_traits/is_move_assignable.h> +#include <__type_traits/is_move_constructible.h> +#include <__type_traits/is_nothrow_move_assignable.h> +#include <__type_traits/is_nothrow_move_constructible.h> +#include <__type_traits/is_swappable.h> #include <__utility/declval.h> #include <__utility/move.h> #include <cstddef> -#include <type_traits> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/to_underlying.h b/contrib/libs/cxxsupp/libcxx/include/__utility/to_underlying.h index 3428406e8d..a194d3ef28 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/to_underlying.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/to_underlying.h @@ -11,7 +11,7 @@ #define _LIBCPP___UTILITY_TO_UNDERLYING_H #include <__config> -#include <type_traits> +#include <__type_traits/underlying_type.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/transaction.h b/contrib/libs/cxxsupp/libcxx/include/__utility/transaction.h deleted file mode 100644 index dc65c349d1..0000000000 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/transaction.h +++ /dev/null @@ -1,97 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___UTILITY_TRANSACTION_H -#define _LIBCPP___UTILITY_TRANSACTION_H - -#include <__config> -#include <__utility/exchange.h> -#include <__utility/move.h> -#include <type_traits> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -// __transaction is a helper class for writing code with the strong exception guarantee. -// -// When writing code that can throw an exception, one can store rollback instructions in a -// transaction so that if an exception is thrown at any point during the lifetime of the -// transaction, it will be rolled back automatically. When the transaction is done, one -// must mark it as being complete so it isn't rolled back when the transaction is destroyed. -// -// Transactions are not default constructible, they can't be copied or assigned to, but -// they can be moved around for convenience. -// -// __transaction can help greatly simplify code that would normally be cluttered by -// `#if _LIBCPP_NO_EXCEPTIONS`. For example: -// -// template <class Iterator, class Size, class OutputIterator> -// Iterator uninitialized_copy_n(Iterator iter, Size n, OutputIterator out) { -// typedef typename iterator_traits<Iterator>::value_type value_type; -// __transaction transaction([start=out, &out] { -// std::destroy(start, out); -// }); -// -// for (; n > 0; ++iter, ++out, --n) { -// ::new ((void*)std::addressof(*out)) value_type(*iter); -// } -// transaction.__complete(); -// return out; -// } -// -template <class _Rollback> -struct __transaction { - __transaction() = delete; - - _LIBCPP_HIDE_FROM_ABI - _LIBCPP_CONSTEXPR_SINCE_CXX20 explicit __transaction(_Rollback __rollback) - : __rollback_(_VSTD::move(__rollback)) - , __completed_(false) - { } - - _LIBCPP_HIDE_FROM_ABI - _LIBCPP_CONSTEXPR_SINCE_CXX20 __transaction(__transaction&& __other) - _NOEXCEPT_(is_nothrow_move_constructible<_Rollback>::value) - : __rollback_(_VSTD::move(__other.__rollback_)) - , __completed_(__other.__completed_) - { - __other.__completed_ = true; - } - - __transaction(__transaction const&) = delete; - __transaction& operator=(__transaction const&) = delete; - __transaction& operator=(__transaction&&) = delete; - - _LIBCPP_HIDE_FROM_ABI - _LIBCPP_CONSTEXPR_SINCE_CXX20 void __complete() _NOEXCEPT { - __completed_ = true; - } - - _LIBCPP_HIDE_FROM_ABI - _LIBCPP_CONSTEXPR_SINCE_CXX20 ~__transaction() { - if (!__completed_) - __rollback_(); - } - -private: - _Rollback __rollback_; - bool __completed_; -}; -_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(__transaction); - -template <class _Rollback> -_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __transaction<_Rollback> __make_transaction(_Rollback __rollback) { - return __transaction<_Rollback>(std::move(__rollback)); -} - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___UTILITY_TRANSACTION_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__utility/unreachable.h b/contrib/libs/cxxsupp/libcxx/include/__utility/unreachable.h index 485edb227c..d93e60b10b 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__utility/unreachable.h +++ b/contrib/libs/cxxsupp/libcxx/include/__utility/unreachable.h @@ -9,8 +9,8 @@ #ifndef _LIBCPP___UTILITY_UNREACHABLE_H #define _LIBCPP___UTILITY_UNREACHABLE_H +#include <__assert> #include <__config> -#include <cstdlib> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -18,21 +18,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD -_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __libcpp_unreachable() -{ -#if __has_builtin(__builtin_unreachable) - __builtin_unreachable(); -#else - std::abort(); -#endif +_LIBCPP_NORETURN _LIBCPP_HIDE_FROM_ABI inline void __libcpp_unreachable() { + _LIBCPP_ASSERT(false, "std::unreachable() was reached"); + __builtin_unreachable(); } #if _LIBCPP_STD_VER > 20 [[noreturn]] _LIBCPP_HIDE_FROM_ABI inline void unreachable() { __libcpp_unreachable(); } -#endif // _LIBCPP_STD_VER > 20 +#endif _LIBCPP_END_NAMESPACE_STD -#endif +#endif // _LIBCPP___UTILITY_UNREACHABLE_H |