diff options
Diffstat (limited to 'contrib/llvm-project/libcxx/include/__memory')
22 files changed, 589 insertions, 596 deletions
diff --git a/contrib/llvm-project/libcxx/include/__memory/addressof.h b/contrib/llvm-project/libcxx/include/__memory/addressof.h index d4c69b83a8dc..7cb2065038a7 100644 --- a/contrib/llvm-project/libcxx/include/__memory/addressof.h +++ b/contrib/llvm-project/libcxx/include/__memory/addressof.h @@ -20,7 +20,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp> inline _LIBCPP_CONSTEXPR_SINCE_CXX17 -_LIBCPP_NO_CFI _LIBCPP_INLINE_VISIBILITY +_LIBCPP_NO_CFI _LIBCPP_HIDE_FROM_ABI _Tp* addressof(_Tp& __x) _NOEXCEPT { @@ -33,7 +33,7 @@ addressof(_Tp& __x) _NOEXCEPT // _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler // itself is providing these definitions. Otherwise, we provide them. template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI __strong _Tp* addressof(__strong _Tp& __x) _NOEXCEPT { @@ -42,7 +42,7 @@ addressof(__strong _Tp& __x) _NOEXCEPT #ifdef _LIBCPP_HAS_OBJC_ARC_WEAK template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI __weak _Tp* addressof(__weak _Tp& __x) _NOEXCEPT { @@ -51,7 +51,7 @@ addressof(__weak _Tp& __x) _NOEXCEPT #endif template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI __autoreleasing _Tp* addressof(__autoreleasing _Tp& __x) _NOEXCEPT { @@ -59,7 +59,7 @@ addressof(__autoreleasing _Tp& __x) _NOEXCEPT } template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI __unsafe_unretained _Tp* addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT { diff --git a/contrib/llvm-project/libcxx/include/__memory/allocation_guard.h b/contrib/llvm-project/libcxx/include/__memory/allocation_guard.h index f63b17430ed1..c36ce15397c0 100644 --- a/contrib/llvm-project/libcxx/include/__memory/allocation_guard.h +++ b/contrib/llvm-project/libcxx/include/__memory/allocation_guard.h @@ -52,7 +52,7 @@ struct __allocation_guard { template<class _AllocT> // we perform the allocator conversion inside the constructor _LIBCPP_HIDE_FROM_ABI explicit __allocation_guard(_AllocT __alloc, _Size __n) - : __alloc_(_VSTD::move(__alloc)) + : __alloc_(std::move(__alloc)) , __n_(__n) , __ptr_(allocator_traits<_Alloc>::allocate(__alloc_, __n_)) // initialization order is important { } diff --git a/contrib/llvm-project/libcxx/include/__memory/allocator.h b/contrib/llvm-project/libcxx/include/__memory/allocator.h index 47e1ef926a4a..7568da799782 100644 --- a/contrib/llvm-project/libcxx/include/__memory/allocator.h +++ b/contrib/llvm-project/libcxx/include/__memory/allocator.h @@ -77,7 +77,7 @@ struct __non_trivial_if { }; template <class _Unique> struct __non_trivial_if<true, _Unique> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __non_trivial_if() _NOEXCEPT { } }; @@ -101,17 +101,17 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator() _NOEXCEPT = default; template <class _Up> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator(const allocator<_Up>&) _NOEXCEPT { } - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp* allocate(size_t __n) { if (__n > allocator_traits<allocator>::max_size(*this)) __throw_bad_array_new_length(); if (__libcpp_is_constant_evaluated()) { return static_cast<_Tp*>(::operator new(__n * sizeof(_Tp))); } else { - return static_cast<_Tp*>(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp))); + return static_cast<_Tp*>(std::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp))); } } @@ -122,12 +122,12 @@ public: } #endif - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void deallocate(_Tp* __p, size_t __n) _NOEXCEPT { if (__libcpp_is_constant_evaluated()) { ::operator delete(__p); } else { - _VSTD::__libcpp_deallocate((void*)__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)); + std::__libcpp_deallocate((void*)__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)); } } @@ -143,31 +143,31 @@ public: typedef allocator<_Up> other; }; - _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI pointer address(reference __x) const _NOEXCEPT { - return _VSTD::addressof(__x); + return std::addressof(__x); } - _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI const_pointer address(const_reference __x) const _NOEXCEPT { - return _VSTD::addressof(__x); + return std::addressof(__x); } - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_IN_CXX17 + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 _Tp* allocate(size_t __n, const void*) { return allocate(__n); } - _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT { + _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return size_type(~0) / sizeof(_Tp); } template <class _Up, class... _Args> - _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI void construct(_Up* __p, _Args&&... __args) { - ::new ((void*)__p) _Up(_VSTD::forward<_Args>(__args)...); + ::new ((void*)__p) _Up(std::forward<_Args>(__args)...); } - _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI void destroy(pointer __p) { __p->~_Tp(); } @@ -189,17 +189,17 @@ public: _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator() _NOEXCEPT = default; template <class _Up> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator(const allocator<_Up>&) _NOEXCEPT { } - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 const _Tp* allocate(size_t __n) { if (__n > allocator_traits<allocator>::max_size(*this)) __throw_bad_array_new_length(); if (__libcpp_is_constant_evaluated()) { return static_cast<const _Tp*>(::operator new(__n * sizeof(_Tp))); } else { - return static_cast<const _Tp*>(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp))); + return static_cast<const _Tp*>(std::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp))); } } @@ -210,12 +210,12 @@ public: } #endif - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void deallocate(const _Tp* __p, size_t __n) { if (__libcpp_is_constant_evaluated()) { ::operator delete(const_cast<_Tp*>(__p)); } else { - _VSTD::__libcpp_deallocate((void*) const_cast<_Tp *>(__p), __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)); + std::__libcpp_deallocate((void*) const_cast<_Tp *>(__p), __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)); } } @@ -231,27 +231,27 @@ public: typedef allocator<_Up> other; }; - _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI const_pointer address(const_reference __x) const _NOEXCEPT { - return _VSTD::addressof(__x); + return std::addressof(__x); } - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_IN_CXX17 + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 const _Tp* allocate(size_t __n, const void*) { return allocate(__n); } - _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT { + _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI size_type max_size() const _NOEXCEPT { return size_type(~0) / sizeof(_Tp); } template <class _Up, class... _Args> - _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI void construct(_Up* __p, _Args&&... __args) { - ::new ((void*)__p) _Up(_VSTD::forward<_Args>(__args)...); + ::new ((void*)__p) _Up(std::forward<_Args>(__args)...); } - _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_INLINE_VISIBILITY + _LIBCPP_DEPRECATED_IN_CXX17 _LIBCPP_HIDE_FROM_ABI void destroy(pointer __p) { __p->~_Tp(); } @@ -259,13 +259,13 @@ public: }; template <class _Tp, class _Up> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 bool operator==(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return true;} #if _LIBCPP_STD_VER <= 17 template <class _Tp, class _Up> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return false;} #endif diff --git a/contrib/llvm-project/libcxx/include/__memory/allocator_arg_t.h b/contrib/llvm-project/libcxx/include/__memory/allocator_arg_t.h index 4d9c115f7293..09a015acdf11 100644 --- a/contrib/llvm-project/libcxx/include/__memory/allocator_arg_t.h +++ b/contrib/llvm-project/libcxx/include/__memory/allocator_arg_t.h @@ -51,26 +51,26 @@ struct __uses_alloc_ctor {}; template <class _Tp, class _Allocator, class... _Args> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI void __user_alloc_construct_impl (integral_constant<int, 0>, _Tp *__storage, const _Allocator &, _Args &&... __args ) { - new (__storage) _Tp (_VSTD::forward<_Args>(__args)...); + new (__storage) _Tp (std::forward<_Args>(__args)...); } // FIXME: This should have a version which takes a non-const alloc. template <class _Tp, class _Allocator, class... _Args> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI 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, __a, std::forward<_Args>(__args)...); } // FIXME: This should have a version which takes a non-const alloc. template <class _Tp, class _Allocator, class... _Args> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI void __user_alloc_construct_impl (integral_constant<int, 2>, _Tp *__storage, const _Allocator &__a, _Args &&... __args ) { - new (__storage) _Tp (_VSTD::forward<_Args>(__args)..., __a); + new (__storage) _Tp (std::forward<_Args>(__args)..., __a); } #endif // _LIBCPP_CXX03_LANG diff --git a/contrib/llvm-project/libcxx/include/__memory/allocator_destructor.h b/contrib/llvm-project/libcxx/include/__memory/allocator_destructor.h index 623ad8ad800a..ea0ad9bec674 100644 --- a/contrib/llvm-project/libcxx/include/__memory/allocator_destructor.h +++ b/contrib/llvm-project/libcxx/include/__memory/allocator_destructor.h @@ -29,10 +29,10 @@ private: _Alloc& __alloc_; size_type __s_; public: - _LIBCPP_INLINE_VISIBILITY __allocator_destructor(_Alloc& __a, size_type __s) + _LIBCPP_HIDE_FROM_ABI __allocator_destructor(_Alloc& __a, size_type __s) _NOEXCEPT : __alloc_(__a), __s_(__s) {} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI void operator()(pointer __p) _NOEXCEPT {__alloc_traits::deallocate(__alloc_, __p, __s_);} }; diff --git a/contrib/llvm-project/libcxx/include/__memory/allocator_traits.h b/contrib/llvm-project/libcxx/include/__memory/allocator_traits.h index 4658098d64c9..c5db3e896fad 100644 --- a/contrib/llvm-project/libcxx/include/__memory/allocator_traits.h +++ b/contrib/llvm-project/libcxx/include/__memory/allocator_traits.h @@ -263,14 +263,14 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits }; #endif // _LIBCPP_CXX03_LANG - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer allocate(allocator_type& __a, size_type __n) { return __a.allocate(__n); } template <class _Ap = _Alloc, class = __enable_if_t<__has_allocate_hint<_Ap, size_type, const_void_pointer>::value> > - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint) { _LIBCPP_SUPPRESS_DEPRECATED_PUSH return __a.allocate(__n, __hint); @@ -278,38 +278,34 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits } template <class _Ap = _Alloc, class = void, class = __enable_if_t<!__has_allocate_hint<_Ap, size_type, const_void_pointer>::value> > - _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer) { return __a.allocate(__n); } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void deallocate(allocator_type& __a, pointer __p, size_type __n) _NOEXCEPT { __a.deallocate(__p, __n); } template <class _Tp, class... _Args, class = __enable_if_t<__has_construct<allocator_type, _Tp*, _Args...>::value> > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void construct(allocator_type& __a, _Tp* __p, _Args&&... __args) { _LIBCPP_SUPPRESS_DEPRECATED_PUSH - __a.construct(__p, _VSTD::forward<_Args>(__args)...); + __a.construct(__p, std::forward<_Args>(__args)...); _LIBCPP_SUPPRESS_DEPRECATED_POP } template <class _Tp, class... _Args, class = void, class = __enable_if_t<!__has_construct<allocator_type, _Tp*, _Args...>::value> > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void construct(allocator_type&, _Tp* __p, _Args&&... __args) { -#if _LIBCPP_STD_VER >= 20 - _VSTD::construct_at(__p, _VSTD::forward<_Args>(__args)...); -#else - ::new ((void*)__p) _Tp(_VSTD::forward<_Args>(__args)...); -#endif + std::__construct_at(__p, std::forward<_Args>(__args)...); } template <class _Tp, class = __enable_if_t<__has_destroy<allocator_type, _Tp*>::value> > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void destroy(allocator_type& __a, _Tp* __p) { _LIBCPP_SUPPRESS_DEPRECATED_PUSH __a.destroy(__p); @@ -317,18 +313,14 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits } template <class _Tp, class = void, class = __enable_if_t<!__has_destroy<allocator_type, _Tp*>::value> > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static void destroy(allocator_type&, _Tp* __p) { -#if _LIBCPP_STD_VER >= 20 - _VSTD::destroy_at(__p); -#else - __p->~_Tp(); -#endif + std::__destroy_at(__p); } template <class _Ap = _Alloc, class = __enable_if_t<__has_max_size<const _Ap>::value> > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static size_type max_size(const allocator_type& __a) _NOEXCEPT { _LIBCPP_SUPPRESS_DEPRECATED_PUSH return __a.max_size(); @@ -336,20 +328,20 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits } template <class _Ap = _Alloc, class = void, class = __enable_if_t<!__has_max_size<const _Ap>::value> > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static size_type max_size(const allocator_type&) _NOEXCEPT { return numeric_limits<size_type>::max() / sizeof(value_type); } template <class _Ap = _Alloc, class = __enable_if_t<__has_select_on_container_copy_construction<const _Ap>::value> > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static allocator_type select_on_container_copy_construction(const allocator_type& __a) { return __a.select_on_container_copy_construction(); } template <class _Ap = _Alloc, class = void, class = __enable_if_t<!__has_select_on_container_copy_construction<const _Ap>::value> > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static allocator_type select_on_container_copy_construction(const allocator_type& __a) { return __a; } @@ -408,14 +400,7 @@ struct __is_cpp17_copy_insertable<_Alloc, __enable_if_t< #ifdef _LIBCPP_HAS_ASAN_CONTAINER_ANNOTATIONS_FOR_ALL_ALLOCATORS template <class _Alloc> -struct __asan_annotate_container_with_allocator -# if defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 1600 - : true_type {}; -# else - // TODO(LLVM-18): Remove the special-casing - : false_type {}; -# endif - +struct __asan_annotate_container_with_allocator : true_type {}; template <class _Tp> struct __asan_annotate_container_with_allocator<allocator<_Tp> > : true_type {}; #endif diff --git a/contrib/llvm-project/libcxx/include/__memory/assume_aligned.h b/contrib/llvm-project/libcxx/include/__memory/assume_aligned.h index 00c2928dcce0..bce00bf02a71 100644 --- a/contrib/llvm-project/libcxx/include/__memory/assume_aligned.h +++ b/contrib/llvm-project/libcxx/include/__memory/assume_aligned.h @@ -22,16 +22,12 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER >= 20 - template <size_t _Np, class _Tp> -[[nodiscard]] -_LIBCPP_HIDE_FROM_ABI -constexpr _Tp* assume_aligned(_Tp* __ptr) { +_LIBCPP_NODISCARD _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp* __assume_aligned(_Tp* __ptr) { static_assert(_Np != 0 && (_Np & (_Np - 1)) == 0, "std::assume_aligned<N>(p) requires N to be a power of two"); - if (is_constant_evaluated()) { + if (__libcpp_is_constant_evaluated()) { return __ptr; } else { _LIBCPP_ASSERT_UNCATEGORIZED(reinterpret_cast<uintptr_t>(__ptr) % _Np == 0, "Alignment assumption is violated"); @@ -39,6 +35,13 @@ constexpr _Tp* assume_aligned(_Tp* __ptr) { } } +#if _LIBCPP_STD_VER >= 20 + +template <size_t _Np, class _Tp> +[[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr _Tp* assume_aligned(_Tp* __ptr) { + return std::__assume_aligned<_Np>(__ptr); +} + #endif // _LIBCPP_STD_VER >= 20 _LIBCPP_END_NAMESPACE_STD diff --git a/contrib/llvm-project/libcxx/include/__memory/auto_ptr.h b/contrib/llvm-project/libcxx/include/__memory/auto_ptr.h index c007b4d21a5d..00a6329c178d 100644 --- a/contrib/llvm-project/libcxx/include/__memory/auto_ptr.h +++ b/contrib/llvm-project/libcxx/include/__memory/auto_ptr.h @@ -34,39 +34,39 @@ private: public: typedef _Tp element_type; - _LIBCPP_INLINE_VISIBILITY explicit auto_ptr(_Tp* __p = 0) _NOEXCEPT : __ptr_(__p) {} - _LIBCPP_INLINE_VISIBILITY auto_ptr(auto_ptr& __p) _NOEXCEPT : __ptr_(__p.release()) {} - template<class _Up> _LIBCPP_INLINE_VISIBILITY auto_ptr(auto_ptr<_Up>& __p) _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI explicit auto_ptr(_Tp* __p = 0) _NOEXCEPT : __ptr_(__p) {} + _LIBCPP_HIDE_FROM_ABI auto_ptr(auto_ptr& __p) _NOEXCEPT : __ptr_(__p.release()) {} + template<class _Up> _LIBCPP_HIDE_FROM_ABI auto_ptr(auto_ptr<_Up>& __p) _NOEXCEPT : __ptr_(__p.release()) {} - _LIBCPP_INLINE_VISIBILITY auto_ptr& operator=(auto_ptr& __p) _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI auto_ptr& operator=(auto_ptr& __p) _NOEXCEPT {reset(__p.release()); return *this;} - template<class _Up> _LIBCPP_INLINE_VISIBILITY auto_ptr& operator=(auto_ptr<_Up>& __p) _NOEXCEPT + template<class _Up> _LIBCPP_HIDE_FROM_ABI auto_ptr& operator=(auto_ptr<_Up>& __p) _NOEXCEPT {reset(__p.release()); return *this;} - _LIBCPP_INLINE_VISIBILITY auto_ptr& operator=(auto_ptr_ref<_Tp> __p) _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI auto_ptr& operator=(auto_ptr_ref<_Tp> __p) _NOEXCEPT {reset(__p.__ptr_); return *this;} - _LIBCPP_INLINE_VISIBILITY ~auto_ptr() _NOEXCEPT {delete __ptr_;} + _LIBCPP_HIDE_FROM_ABI ~auto_ptr() _NOEXCEPT {delete __ptr_;} - _LIBCPP_INLINE_VISIBILITY _Tp& operator*() const _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI _Tp& operator*() const _NOEXCEPT {return *__ptr_;} - _LIBCPP_INLINE_VISIBILITY _Tp* operator->() const _NOEXCEPT {return __ptr_;} - _LIBCPP_INLINE_VISIBILITY _Tp* get() const _NOEXCEPT {return __ptr_;} - _LIBCPP_INLINE_VISIBILITY _Tp* release() _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI _Tp* operator->() const _NOEXCEPT {return __ptr_;} + _LIBCPP_HIDE_FROM_ABI _Tp* get() const _NOEXCEPT {return __ptr_;} + _LIBCPP_HIDE_FROM_ABI _Tp* release() _NOEXCEPT { _Tp* __t = __ptr_; __ptr_ = nullptr; return __t; } - _LIBCPP_INLINE_VISIBILITY void reset(_Tp* __p = 0) _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI void reset(_Tp* __p = 0) _NOEXCEPT { if (__ptr_ != __p) delete __ptr_; __ptr_ = __p; } - _LIBCPP_INLINE_VISIBILITY auto_ptr(auto_ptr_ref<_Tp> __p) _NOEXCEPT : __ptr_(__p.__ptr_) {} - template<class _Up> _LIBCPP_INLINE_VISIBILITY operator auto_ptr_ref<_Up>() _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI auto_ptr(auto_ptr_ref<_Tp> __p) _NOEXCEPT : __ptr_(__p.__ptr_) {} + template<class _Up> _LIBCPP_HIDE_FROM_ABI operator auto_ptr_ref<_Up>() _NOEXCEPT {auto_ptr_ref<_Up> __t; __t.__ptr_ = release(); return __t;} - template<class _Up> _LIBCPP_INLINE_VISIBILITY operator auto_ptr<_Up>() _NOEXCEPT + template<class _Up> _LIBCPP_HIDE_FROM_ABI operator auto_ptr<_Up>() _NOEXCEPT {return auto_ptr<_Up>(release());} }; diff --git a/contrib/llvm-project/libcxx/include/__memory/builtin_new_allocator.h b/contrib/llvm-project/libcxx/include/__memory/builtin_new_allocator.h index ab449ad29987..348712c6d8d6 100644 --- a/contrib/llvm-project/libcxx/include/__memory/builtin_new_allocator.h +++ b/contrib/llvm-project/libcxx/include/__memory/builtin_new_allocator.h @@ -32,7 +32,7 @@ struct __builtin_new_allocator { : __size_(__size), __align_(__align) {} _LIBCPP_HIDE_FROM_ABI void operator()(void* __p) const _NOEXCEPT { - _VSTD::__libcpp_deallocate(__p, __size_, __align_); + std::__libcpp_deallocate(__p, __size_, __align_); } private: @@ -43,13 +43,13 @@ struct __builtin_new_allocator { typedef unique_ptr<void, __builtin_new_deleter> __holder_t; _LIBCPP_HIDE_FROM_ABI static __holder_t __allocate_bytes(size_t __s, size_t __align) { - return __holder_t(_VSTD::__libcpp_allocate(__s, __align), + return __holder_t(std::__libcpp_allocate(__s, __align), __builtin_new_deleter(__s, __align)); } _LIBCPP_HIDE_FROM_ABI static void __deallocate_bytes(void* __p, size_t __s, size_t __align) _NOEXCEPT { - _VSTD::__libcpp_deallocate(__p, __s, __align); + std::__libcpp_deallocate(__p, __s, __align); } template <class _Tp> diff --git a/contrib/llvm-project/libcxx/include/__memory/construct_at.h b/contrib/llvm-project/libcxx/include/__memory/construct_at.h index a032c33b47a8..6797a3862973 100644 --- a/contrib/llvm-project/libcxx/include/__memory/construct_at.h +++ b/contrib/llvm-project/libcxx/include/__memory/construct_at.h @@ -37,7 +37,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD 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_UNCATEGORIZED(__location != nullptr, "null pointer given to construct_at"); + _LIBCPP_ASSERT_NON_NULL(__location != nullptr, "null pointer given to construct_at"); return ::new (std::__voidify(*__location)) _Tp(std::forward<_Args>(__args)...); } @@ -48,7 +48,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __construct_at(_Tp* __location, _Ar #if _LIBCPP_STD_VER >= 20 return std::construct_at(__location, std::forward<_Args>(__args)...); #else - return _LIBCPP_ASSERT_UNCATEGORIZED(__location != nullptr, "null pointer given to construct_at"), + return _LIBCPP_ASSERT_NON_NULL(__location != nullptr, "null pointer given to construct_at"), ::new (std::__voidify(*__location)) _Tp(std::forward<_Args>(__args)...); #endif } @@ -62,18 +62,18 @@ template <class _ForwardIterator> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _ForwardIterator __destroy(_ForwardIterator, _ForwardIterator); -template <class _Tp, typename enable_if<!is_array<_Tp>::value, int>::type = 0> +template <class _Tp, __enable_if_t<!is_array<_Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __destroy_at(_Tp* __loc) { - _LIBCPP_ASSERT_UNCATEGORIZED(__loc != nullptr, "null pointer given to destroy_at"); + _LIBCPP_ASSERT_NON_NULL(__loc != nullptr, "null pointer given to destroy_at"); __loc->~_Tp(); } #if _LIBCPP_STD_VER >= 20 -template <class _Tp, typename enable_if<is_array<_Tp>::value, int>::type = 0> +template <class _Tp, __enable_if_t<is_array<_Tp>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __destroy_at(_Tp* __loc) { - _LIBCPP_ASSERT_UNCATEGORIZED(__loc != nullptr, "null pointer given to destroy_at"); + _LIBCPP_ASSERT_NON_NULL(__loc != nullptr, "null pointer given to destroy_at"); std::__destroy(std::begin(*__loc), std::end(*__loc)); } #endif diff --git a/contrib/llvm-project/libcxx/include/__memory/destruct_n.h b/contrib/llvm-project/libcxx/include/__memory/destruct_n.h index 2cfb2e4c88ce..3a0ad9218af1 100644 --- a/contrib/llvm-project/libcxx/include/__memory/destruct_n.h +++ b/contrib/llvm-project/libcxx/include/__memory/destruct_n.h @@ -26,36 +26,36 @@ private: size_t __size_; template <class _Tp> - _LIBCPP_INLINE_VISIBILITY void __process(_Tp* __p, false_type) _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI void __process(_Tp* __p, false_type) _NOEXCEPT {for (size_t __i = 0; __i < __size_; ++__i, ++__p) __p->~_Tp();} template <class _Tp> - _LIBCPP_INLINE_VISIBILITY void __process(_Tp*, true_type) _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI void __process(_Tp*, true_type) _NOEXCEPT {} - _LIBCPP_INLINE_VISIBILITY void __incr(false_type) _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI void __incr(false_type) _NOEXCEPT {++__size_;} - _LIBCPP_INLINE_VISIBILITY void __incr(true_type) _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI void __incr(true_type) _NOEXCEPT {} - _LIBCPP_INLINE_VISIBILITY void __set(size_t __s, false_type) _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI void __set(size_t __s, false_type) _NOEXCEPT {__size_ = __s;} - _LIBCPP_INLINE_VISIBILITY void __set(size_t, true_type) _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI void __set(size_t, true_type) _NOEXCEPT {} public: - _LIBCPP_INLINE_VISIBILITY explicit __destruct_n(size_t __s) _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI explicit __destruct_n(size_t __s) _NOEXCEPT : __size_(__s) {} template <class _Tp> - _LIBCPP_INLINE_VISIBILITY void __incr() _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI void __incr() _NOEXCEPT {__incr(integral_constant<bool, is_trivially_destructible<_Tp>::value>());} template <class _Tp> - _LIBCPP_INLINE_VISIBILITY void __set(size_t __s, _Tp*) _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI void __set(size_t __s, _Tp*) _NOEXCEPT {__set(__s, integral_constant<bool, is_trivially_destructible<_Tp>::value>());} template <class _Tp> - _LIBCPP_INLINE_VISIBILITY void operator()(_Tp* __p) _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI void operator()(_Tp* __p) _NOEXCEPT {__process(__p, integral_constant<bool, is_trivially_destructible<_Tp>::value>());} }; diff --git a/contrib/llvm-project/libcxx/include/__memory/pointer_traits.h b/contrib/llvm-project/libcxx/include/__memory/pointer_traits.h index c33e7bd43f29..7fcf3bf06110 100644 --- a/contrib/llvm-project/libcxx/include/__memory/pointer_traits.h +++ b/contrib/llvm-project/libcxx/include/__memory/pointer_traits.h @@ -35,7 +35,7 @@ template <class _Tp> struct __has_element_type<_Tp, __void_t<typename _Tp::element_type> > : true_type {}; template <class _Ptr, bool = __has_element_type<_Ptr>::value> -struct __pointer_traits_element_type; +struct __pointer_traits_element_type {}; template <class _Ptr> struct __pointer_traits_element_type<_Ptr, true> @@ -111,12 +111,14 @@ struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, false> typedef _Sp<_Up, _Args...> type; }; +template <class _Ptr, class = void> +struct __pointer_traits_impl {}; + template <class _Ptr> -struct _LIBCPP_TEMPLATE_VIS pointer_traits -{ - typedef _Ptr pointer; - typedef typename __pointer_traits_element_type<pointer>::type element_type; - typedef typename __pointer_traits_difference_type<pointer>::type difference_type; +struct __pointer_traits_impl<_Ptr, __void_t<typename __pointer_traits_element_type<_Ptr>::type> > { + typedef _Ptr pointer; + typedef typename __pointer_traits_element_type<pointer>::type element_type; + typedef typename __pointer_traits_difference_type<pointer>::type difference_type; #ifndef _LIBCPP_CXX03_LANG template <class _Up> using rebind = typename __pointer_traits_rebind<pointer, _Up>::type; @@ -128,11 +130,14 @@ struct _LIBCPP_TEMPLATE_VIS pointer_traits private: struct __nat {}; public: - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer pointer_to(__conditional_t<is_void<element_type>::value, __nat, element_type>& __r) {return pointer::pointer_to(__r);} }; +template <class _Ptr> +struct _LIBCPP_TEMPLATE_VIS pointer_traits : __pointer_traits_impl<_Ptr> {}; + template <class _Tp> struct _LIBCPP_TEMPLATE_VIS pointer_traits<_Tp*> { @@ -149,9 +154,9 @@ struct _LIBCPP_TEMPLATE_VIS pointer_traits<_Tp*> private: struct __nat {}; public: - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX20 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 static pointer pointer_to(__conditional_t<is_void<element_type>::value, __nat, element_type>& __r) _NOEXCEPT - {return _VSTD::addressof(__r);} + {return std::addressof(__r);} }; #ifndef _LIBCPP_CXX03_LANG @@ -168,7 +173,7 @@ template <class _Pointer, class = void> struct __to_address_helper; template <class _Tp> -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR _Tp* __to_address(_Tp* __p) _NOEXCEPT { static_assert(!is_function<_Tp>::value, "_Tp is a function type"); return __p; @@ -199,7 +204,7 @@ struct _IsFancyPointer { template <class _Pointer, class = __enable_if_t< _And<is_class<_Pointer>, _IsFancyPointer<_Pointer> >::value > > -_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR __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); @@ -207,16 +212,16 @@ __to_address(const _Pointer& __p) _NOEXCEPT { template <class _Pointer, class> struct __to_address_helper { - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR - static decltype(_VSTD::__to_address(std::declval<const _Pointer&>().operator->())) + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR + static decltype(std::__to_address(std::declval<const _Pointer&>().operator->())) __call(const _Pointer& __p) _NOEXCEPT { - return _VSTD::__to_address(__p.operator->()); + return std::__to_address(__p.operator->()); } }; template <class _Pointer> struct __to_address_helper<_Pointer, decltype((void)pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>()))> { - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static decltype(pointer_traits<_Pointer>::to_address(std::declval<const _Pointer&>())) __call(const _Pointer& __p) _NOEXCEPT { return pointer_traits<_Pointer>::to_address(__p); @@ -225,15 +230,15 @@ struct __to_address_helper<_Pointer, decltype((void)pointer_traits<_Pointer>::to #if _LIBCPP_STD_VER >= 20 template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY constexpr +inline _LIBCPP_HIDE_FROM_ABI constexpr auto to_address(_Tp *__p) noexcept { - return _VSTD::__to_address(__p); + return std::__to_address(__p); } template <class _Pointer> -inline _LIBCPP_INLINE_VISIBILITY constexpr +inline _LIBCPP_HIDE_FROM_ABI constexpr auto to_address(const _Pointer& __p) noexcept -> decltype(std::__to_address(__p)) { - return _VSTD::__to_address(__p); + return std::__to_address(__p); } #endif diff --git a/contrib/llvm-project/libcxx/include/__memory/ranges_construct_at.h b/contrib/llvm-project/libcxx/include/__memory/ranges_construct_at.h index ed800f4a75b4..b6008a7b7f03 100644 --- a/contrib/llvm-project/libcxx/include/__memory/ranges_construct_at.h +++ b/contrib/llvm-project/libcxx/include/__memory/ranges_construct_at.h @@ -46,7 +46,7 @@ struct __fn { )> _LIBCPP_HIDE_FROM_ABI constexpr _Tp* operator()(_Tp* __location, _Args&& ...__args) const { - return _VSTD::construct_at(__location, _VSTD::forward<_Args>(__args)...); + return std::construct_at(__location, std::forward<_Args>(__args)...); } }; @@ -64,7 +64,7 @@ struct __fn { template <destructible _Tp> _LIBCPP_HIDE_FROM_ABI constexpr void operator()(_Tp* __location) const noexcept { - _VSTD::destroy_at(__location); + std::destroy_at(__location); } }; @@ -83,7 +83,7 @@ struct __fn { requires destructible<iter_value_t<_InputIterator>> _LIBCPP_HIDE_FROM_ABI constexpr _InputIterator operator()(_InputIterator __first, _Sentinel __last) const noexcept { - return _VSTD::__destroy(_VSTD::move(__first), _VSTD::move(__last)); + return std::__destroy(std::move(__first), std::move(__last)); } template <__nothrow_input_range _InputRange> @@ -109,7 +109,7 @@ struct __fn { requires destructible<iter_value_t<_InputIterator>> _LIBCPP_HIDE_FROM_ABI constexpr _InputIterator operator()(_InputIterator __first, iter_difference_t<_InputIterator> __n) const noexcept { - return _VSTD::destroy_n(_VSTD::move(__first), __n); + return std::destroy_n(std::move(__first), __n); } }; diff --git a/contrib/llvm-project/libcxx/include/__memory/ranges_uninitialized_algorithms.h b/contrib/llvm-project/libcxx/include/__memory/ranges_uninitialized_algorithms.h index 01c3e01003d4..513fcf70f154 100644 --- a/contrib/llvm-project/libcxx/include/__memory/ranges_uninitialized_algorithms.h +++ b/contrib/llvm-project/libcxx/include/__memory/ranges_uninitialized_algorithms.h @@ -47,8 +47,8 @@ struct __fn { requires default_initializable<iter_value_t<_ForwardIterator>> _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, _Sentinel __last) const { using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>; - return _VSTD::__uninitialized_default_construct<_ValueType>( - _VSTD::move(__first), _VSTD::move(__last)); + return std::__uninitialized_default_construct<_ValueType>( + std::move(__first), std::move(__last)); } template <__nothrow_forward_range _ForwardRange> @@ -74,7 +74,7 @@ struct __fn { _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, iter_difference_t<_ForwardIterator> __n) const { using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>; - return _VSTD::__uninitialized_default_construct_n<_ValueType>(_VSTD::move(__first), __n); + return std::__uninitialized_default_construct_n<_ValueType>(std::move(__first), __n); } }; @@ -94,8 +94,8 @@ struct __fn { requires default_initializable<iter_value_t<_ForwardIterator>> _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, _Sentinel __last) const { using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>; - return _VSTD::__uninitialized_value_construct<_ValueType>( - _VSTD::move(__first), _VSTD::move(__last)); + return std::__uninitialized_value_construct<_ValueType>( + std::move(__first), std::move(__last)); } template <__nothrow_forward_range _ForwardRange> @@ -121,7 +121,7 @@ struct __fn { _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, iter_difference_t<_ForwardIterator> __n) const { using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>; - return _VSTD::__uninitialized_value_construct_n<_ValueType>(_VSTD::move(__first), __n); + return std::__uninitialized_value_construct_n<_ValueType>(std::move(__first), __n); } }; @@ -142,7 +142,7 @@ struct __fn { requires constructible_from<iter_value_t<_ForwardIterator>, const _Tp&> _LIBCPP_HIDE_FROM_ABI _ForwardIterator operator()(_ForwardIterator __first, _Sentinel __last, const _Tp& __x) const { using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>; - return _VSTD::__uninitialized_fill<_ValueType>(_VSTD::move(__first), _VSTD::move(__last), __x); + return std::__uninitialized_fill<_ValueType>(std::move(__first), std::move(__last), __x); } template <__nothrow_forward_range _ForwardRange, class _Tp> @@ -169,7 +169,7 @@ struct __fn { iter_difference_t<_ForwardIterator> __n, const _Tp& __x) const { using _ValueType = remove_reference_t<iter_reference_t<_ForwardIterator>>; - return _VSTD::__uninitialized_fill_n<_ValueType>(_VSTD::move(__first), __n, __x); + return std::__uninitialized_fill_n<_ValueType>(std::move(__first), __n, __x); } }; @@ -196,9 +196,10 @@ struct __fn { operator()(_InputIterator __ifirst, _Sentinel1 __ilast, _OutputIterator __ofirst, _Sentinel2 __olast) const { using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>; - auto __result = _VSTD::__uninitialized_copy<_ValueType>(_VSTD::move(__ifirst), _VSTD::move(__ilast), - _VSTD::move(__ofirst), _VSTD::move(__olast)); - return {_VSTD::move(__result.first), _VSTD::move(__result.second)}; + auto __stop_copying = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; }; + auto __result = std::__uninitialized_copy<_ValueType>( + std::move(__ifirst), std::move(__ilast), std::move(__ofirst), __stop_copying); + return {std::move(__result.first), std::move(__result.second)}; } template <input_range _InputRange, __nothrow_forward_range _OutputRange> @@ -232,9 +233,10 @@ struct __fn { operator()(_InputIterator __ifirst, iter_difference_t<_InputIterator> __n, _OutputIterator __ofirst, _Sentinel __olast) const { using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>; - auto __result = _VSTD::__uninitialized_copy_n<_ValueType>(_VSTD::move(__ifirst), __n, - _VSTD::move(__ofirst), _VSTD::move(__olast)); - return {_VSTD::move(__result.first), _VSTD::move(__result.second)}; + auto __stop_copying = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; }; + auto __result = + std::__uninitialized_copy_n<_ValueType>(std::move(__ifirst), __n, std::move(__ofirst), __stop_copying); + return {std::move(__result.first), std::move(__result.second)}; } }; @@ -261,9 +263,10 @@ struct __fn { operator()(_InputIterator __ifirst, _Sentinel1 __ilast, _OutputIterator __ofirst, _Sentinel2 __olast) const { using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>; auto __iter_move = [](auto&& __iter) -> decltype(auto) { return ranges::iter_move(__iter); }; - auto __result = _VSTD::__uninitialized_move<_ValueType>(_VSTD::move(__ifirst), _VSTD::move(__ilast), - _VSTD::move(__ofirst), _VSTD::move(__olast), __iter_move); - return {_VSTD::move(__result.first), _VSTD::move(__result.second)}; + auto __stop_moving = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; }; + auto __result = std::__uninitialized_move<_ValueType>( + std::move(__ifirst), std::move(__ilast), std::move(__ofirst), __stop_moving, __iter_move); + return {std::move(__result.first), std::move(__result.second)}; } template <input_range _InputRange, __nothrow_forward_range _OutputRange> @@ -298,9 +301,10 @@ struct __fn { _OutputIterator __ofirst, _Sentinel __olast) const { using _ValueType = remove_reference_t<iter_reference_t<_OutputIterator>>; auto __iter_move = [](auto&& __iter) -> decltype(auto) { return ranges::iter_move(__iter); }; - auto __result = _VSTD::__uninitialized_move_n<_ValueType>(_VSTD::move(__ifirst), __n, - _VSTD::move(__ofirst), _VSTD::move(__olast), __iter_move); - return {_VSTD::move(__result.first), _VSTD::move(__result.second)}; + auto __stop_moving = [&__olast](auto&& __out_iter) -> bool { return __out_iter == __olast; }; + auto __result = std::__uninitialized_move_n<_ValueType>( + std::move(__ifirst), __n, std::move(__ofirst), __stop_moving, __iter_move); + return {std::move(__result.first), std::move(__result.second)}; } }; diff --git a/contrib/llvm-project/libcxx/include/__memory/raw_storage_iterator.h b/contrib/llvm-project/libcxx/include/__memory/raw_storage_iterator.h index df7ef5afe7d4..7aa75dca350a 100644 --- a/contrib/llvm-project/libcxx/include/__memory/raw_storage_iterator.h +++ b/contrib/llvm-project/libcxx/include/__memory/raw_storage_iterator.h @@ -47,19 +47,19 @@ public: typedef void pointer; typedef void reference; - _LIBCPP_INLINE_VISIBILITY explicit raw_storage_iterator(_OutputIterator __x) : __x_(__x) {} - _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator*() {return *this;} - _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(const _Tp& __element) - {::new ((void*)_VSTD::addressof(*__x_)) _Tp(__element); return *this;} + _LIBCPP_HIDE_FROM_ABI explicit raw_storage_iterator(_OutputIterator __x) : __x_(__x) {} + _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator*() {return *this;} + _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator=(const _Tp& __element) + {::new ((void*)std::addressof(*__x_)) _Tp(__element); return *this;} #if _LIBCPP_STD_VER >= 14 - _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(_Tp&& __element) - {::new ((void*)_VSTD::addressof(*__x_)) _Tp(_VSTD::move(__element)); return *this;} + _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator=(_Tp&& __element) + {::new ((void*)std::addressof(*__x_)) _Tp(std::move(__element)); return *this;} #endif - _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator++() {++__x_; return *this;} - _LIBCPP_INLINE_VISIBILITY raw_storage_iterator operator++(int) + _LIBCPP_HIDE_FROM_ABI raw_storage_iterator& operator++() {++__x_; return *this;} + _LIBCPP_HIDE_FROM_ABI raw_storage_iterator operator++(int) {raw_storage_iterator __t(*this); ++__x_; return __t;} #if _LIBCPP_STD_VER >= 14 - _LIBCPP_INLINE_VISIBILITY _OutputIterator base() const { return __x_; } + _LIBCPP_HIDE_FROM_ABI _OutputIterator base() const { return __x_; } #endif }; diff --git a/contrib/llvm-project/libcxx/include/__memory/shared_ptr.h b/contrib/llvm-project/libcxx/include/__memory/shared_ptr.h index a5bae83e0b61..84db7998a147 100644 --- a/contrib/llvm-project/libcxx/include/__memory/shared_ptr.h +++ b/contrib/llvm-project/libcxx/include/__memory/shared_ptr.h @@ -14,9 +14,11 @@ #include <__compare/compare_three_way.h> #include <__compare/ordering.h> #include <__config> +#include <__exception/exception.h> #include <__functional/binary_function.h> #include <__functional/operations.h> #include <__functional/reference_wrapper.h> +#include <__fwd/ostream.h> #include <__iterator/access.h> #include <__memory/addressof.h> #include <__memory/allocation_guard.h> @@ -49,9 +51,7 @@ #include <__utility/swap.h> #include <__verbose_abort> #include <cstddef> -#include <iosfwd> #include <new> -#include <stdexcept> #include <typeinfo> #if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER) # include <__atomic/memory_order.h> @@ -75,7 +75,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD #endif template <class _ValueType> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI _ValueType __libcpp_relaxed_load(_ValueType const* __value) { #if !defined(_LIBCPP_HAS_NO_THREADS) && \ defined(__ATOMIC_RELAXED) && \ @@ -87,7 +87,7 @@ _ValueType __libcpp_relaxed_load(_ValueType const* __value) { } template <class _ValueType> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI _ValueType __libcpp_acquire_load(_ValueType const* __value) { #if !defined(_LIBCPP_HAS_NO_THREADS) && \ defined(__ATOMIC_ACQUIRE) && \ @@ -99,7 +99,7 @@ _ValueType __libcpp_acquire_load(_ValueType const* __value) { } template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY _Tp +inline _LIBCPP_HIDE_FROM_ABI _Tp __libcpp_atomic_refcount_increment(_Tp& __t) _NOEXCEPT { #if defined(_LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT) && !defined(_LIBCPP_HAS_NO_THREADS) @@ -110,7 +110,7 @@ __libcpp_atomic_refcount_increment(_Tp& __t) _NOEXCEPT } template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY _Tp +inline _LIBCPP_HIDE_FROM_ABI _Tp __libcpp_atomic_refcount_decrement(_Tp& __t) _NOEXCEPT { #if defined(_LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT) && !defined(_LIBCPP_HAS_NO_THREADS) @@ -126,11 +126,12 @@ class _LIBCPP_EXPORTED_FROM_ABI bad_weak_ptr public: _LIBCPP_HIDE_FROM_ABI bad_weak_ptr() _NOEXCEPT = default; _LIBCPP_HIDE_FROM_ABI bad_weak_ptr(const bad_weak_ptr&) _NOEXCEPT = default; + _LIBCPP_HIDE_FROM_ABI bad_weak_ptr& operator=(const bad_weak_ptr&) _NOEXCEPT = default; ~bad_weak_ptr() _NOEXCEPT override; const char* what() const _NOEXCEPT override; }; -_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY +_LIBCPP_NORETURN inline _LIBCPP_HIDE_FROM_ABI void __throw_bad_weak_ptr() { #ifndef _LIBCPP_HAS_NO_EXCEPTIONS @@ -154,7 +155,7 @@ private: virtual void __on_zero_shared() _NOEXCEPT = 0; public: - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI explicit __shared_count(long __refs = 0) _NOEXCEPT : __shared_owners_(__refs) {} @@ -162,11 +163,11 @@ public: void __add_shared() noexcept; bool __release_shared() noexcept; #else - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI void __add_shared() _NOEXCEPT { __libcpp_atomic_refcount_increment(__shared_owners_); } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI bool __release_shared() _NOEXCEPT { if (__libcpp_atomic_refcount_decrement(__shared_owners_) == -1) { __on_zero_shared(); @@ -175,7 +176,7 @@ public: return false; } #endif - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI long use_count() const _NOEXCEPT { return __libcpp_relaxed_load(&__shared_owners_) + 1; } @@ -187,7 +188,7 @@ class _LIBCPP_EXPORTED_FROM_ABI __shared_weak_count long __shared_weak_owners_; public: - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI explicit __shared_weak_count(long __refs = 0) _NOEXCEPT : __shared_count(__refs), __shared_weak_owners_(__refs) {} @@ -200,22 +201,22 @@ public: void __add_weak() noexcept; void __release_shared() noexcept; #else - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI void __add_shared() _NOEXCEPT { __shared_count::__add_shared(); } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI void __add_weak() _NOEXCEPT { __libcpp_atomic_refcount_increment(__shared_weak_owners_); } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI void __release_shared() _NOEXCEPT { if (__shared_count::__release_shared()) __release_weak(); } #endif void __release_weak() _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI long use_count() const _NOEXCEPT {return __shared_count::use_count();} __shared_weak_count* lock() _NOEXCEPT; @@ -230,9 +231,9 @@ class __shared_ptr_pointer { __compressed_pair<__compressed_pair<_Tp, _Dp>, _Alloc> __data_; public: - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI __shared_ptr_pointer(_Tp __p, _Dp __d, _Alloc __a) - : __data_(__compressed_pair<_Tp, _Dp>(__p, _VSTD::move(__d)), _VSTD::move(__a)) {} + : __data_(__compressed_pair<_Tp, _Dp>(__p, std::move(__d)), std::move(__a)) {} #ifndef _LIBCPP_HAS_NO_RTTI _LIBCPP_HIDE_FROM_ABI_VIRTUAL const void* __get_deleter(const type_info&) const _NOEXCEPT override; @@ -249,7 +250,7 @@ template <class _Tp, class _Dp, class _Alloc> const void* __shared_ptr_pointer<_Tp, _Dp, _Alloc>::__get_deleter(const type_info& __t) const _NOEXCEPT { - return __t == typeid(_Dp) ? _VSTD::addressof(__data_.first().second()) : nullptr; + return __t == typeid(_Dp) ? std::addressof(__data_.first().second()) : nullptr; } #endif // _LIBCPP_HAS_NO_RTTI @@ -284,23 +285,23 @@ template <class _Tp, class _Alloc> struct __shared_ptr_emplace : __shared_weak_count { - template<class ..._Args> + template <class... _Args, class _Allocator = _Alloc, __enable_if_t<is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI + explicit __shared_ptr_emplace(_Alloc __a, _Args&& ...) + : __storage_(std::move(__a)) + { + static_assert(sizeof...(_Args) == 0, "No argument should be provided to the control block when using _for_overwrite"); + ::new ((void*)__get_elem()) _Tp; + } + + template <class... _Args, class _Allocator = _Alloc, __enable_if_t<!is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0> _LIBCPP_HIDE_FROM_ABI explicit __shared_ptr_emplace(_Alloc __a, _Args&& ...__args) - : __storage_(_VSTD::move(__a)) + : __storage_(std::move(__a)) { -#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 + using _TpAlloc = typename __allocator_traits_rebind<_Alloc, _Tp>::type; + _TpAlloc __tmp(*__get_alloc()); + allocator_traits<_TpAlloc>::construct(__tmp, __get_elem(), std::forward<_Args>(__args)...); } _LIBCPP_HIDE_FROM_ABI @@ -310,18 +311,20 @@ struct __shared_ptr_emplace _Tp* __get_elem() _NOEXCEPT { return __storage_.__get_elem(); } private: - _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override { -#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 + template <class _Allocator = _Alloc, __enable_if_t<is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI void __on_zero_shared_impl() _NOEXCEPT { __get_elem()->~_Tp(); -#endif + } + + template <class _Allocator = _Alloc, __enable_if_t<!is_same<typename _Allocator::value_type, __for_overwrite_tag>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI void __on_zero_shared_impl() _NOEXCEPT { + using _TpAlloc = typename __allocator_traits_rebind<_Allocator, _Tp>::type; + _TpAlloc __tmp(*__get_alloc()); + allocator_traits<_TpAlloc>::destroy(__tmp, __get_elem()); + } + + _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared() _NOEXCEPT override { + __on_zero_shared_impl(); } _LIBCPP_HIDE_FROM_ABI_VIRTUAL void __on_zero_shared_weak() _NOEXCEPT override { @@ -346,7 +349,7 @@ private: char __blob_[sizeof(_CompressedPair)]; _LIBCPP_HIDE_FROM_ABI explicit _Storage(_Alloc&& __a) { - ::new ((void*)__get_alloc()) _Alloc(_VSTD::move(__a)); + ::new ((void*)__get_alloc()) _Alloc(std::move(__a)); } _LIBCPP_HIDE_FROM_ABI ~_Storage() { __get_alloc()->~_Alloc(); @@ -530,7 +533,7 @@ public: typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT; typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT> _CntrlBlk; #ifndef _LIBCPP_CXX03_LANG - __cntrl_ = new _CntrlBlk(__p, _VSTD::move(__d), _AllocT()); + __cntrl_ = new _CntrlBlk(__p, std::move(__d), _AllocT()); #else __cntrl_ = new _CntrlBlk(__p, __d, _AllocT()); #endif // not _LIBCPP_CXX03_LANG @@ -559,13 +562,13 @@ public: typedef __allocator_destructor<_A2> _D2; _A2 __a2(__a); unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1)); - ::new ((void*)_VSTD::addressof(*__hold2.get())) + ::new ((void*)std::addressof(*__hold2.get())) #ifndef _LIBCPP_CXX03_LANG - _CntrlBlk(__p, _VSTD::move(__d), __a); + _CntrlBlk(__p, std::move(__d), __a); #else _CntrlBlk(__p, __d, __a); #endif // not _LIBCPP_CXX03_LANG - __cntrl_ = _VSTD::addressof(*__hold2.release()); + __cntrl_ = std::addressof(*__hold2.release()); __enable_weak_this(__p, __p); #ifndef _LIBCPP_HAS_NO_EXCEPTIONS } @@ -589,7 +592,7 @@ public: typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT; typedef __shared_ptr_pointer<nullptr_t, _Dp, _AllocT> _CntrlBlk; #ifndef _LIBCPP_CXX03_LANG - __cntrl_ = new _CntrlBlk(__p, _VSTD::move(__d), _AllocT()); + __cntrl_ = new _CntrlBlk(__p, std::move(__d), _AllocT()); #else __cntrl_ = new _CntrlBlk(__p, __d, _AllocT()); #endif // not _LIBCPP_CXX03_LANG @@ -617,13 +620,13 @@ public: typedef __allocator_destructor<_A2> _D2; _A2 __a2(__a); unique_ptr<_CntrlBlk, _D2> __hold2(__a2.allocate(1), _D2(__a2, 1)); - ::new ((void*)_VSTD::addressof(*__hold2.get())) + ::new ((void*)std::addressof(*__hold2.get())) #ifndef _LIBCPP_CXX03_LANG - _CntrlBlk(__p, _VSTD::move(__d), __a); + _CntrlBlk(__p, std::move(__d), __a); #else _CntrlBlk(__p, __d, __a); #endif // not _LIBCPP_CXX03_LANG - __cntrl_ = _VSTD::addressof(*__hold2.release()); + __cntrl_ = std::addressof(*__hold2.release()); #ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) @@ -759,7 +762,7 @@ public: typedef __shared_ptr_pointer<typename unique_ptr<_Yp, _Dp>::pointer, reference_wrapper<__libcpp_remove_reference_t<_Dp> >, _AllocT> _CntrlBlk; - __cntrl_ = new _CntrlBlk(__r.get(), _VSTD::ref(__r.get_deleter()), _AllocT()); + __cntrl_ = new _CntrlBlk(__r.get(), std::ref(__r.get_deleter()), _AllocT()); __enable_weak_this(__r.get(), __r.get()); } __r.release(); @@ -790,7 +793,7 @@ public: _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(shared_ptr&& __r) _NOEXCEPT { - shared_ptr(_VSTD::move(__r)).swap(*this); + shared_ptr(std::move(__r)).swap(*this); return *this; } @@ -798,7 +801,7 @@ public: _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(shared_ptr<_Yp>&& __r) { - shared_ptr(_VSTD::move(__r)).swap(*this); + shared_ptr(std::move(__r)).swap(*this); return *this; } @@ -810,7 +813,7 @@ public: _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(auto_ptr<_Yp>&& __r) { - shared_ptr(_VSTD::move(__r)).swap(*this); + shared_ptr(std::move(__r)).swap(*this); return *this; } #endif @@ -822,15 +825,15 @@ public: _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp>& operator=(unique_ptr<_Yp, _Dp>&& __r) { - shared_ptr(_VSTD::move(__r)).swap(*this); + shared_ptr(std::move(__r)).swap(*this); return *this; } _LIBCPP_HIDE_FROM_ABI void swap(shared_ptr& __r) _NOEXCEPT { - _VSTD::swap(__ptr_, __r.__ptr_); - _VSTD::swap(__cntrl_, __r.__cntrl_); + std::swap(__ptr_, __r.__ptr_); + std::swap(__cntrl_, __r.__cntrl_); } _LIBCPP_HIDE_FROM_ABI @@ -1019,16 +1022,16 @@ shared_ptr<_Tp> allocate_shared(const _Alloc& __a, _Args&& ...__args) 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(__a, _VSTD::forward<_Args>(__args)...); + ::new ((void*)std::addressof(*__guard.__get())) _ControlBlock(__a, std::forward<_Args>(__args)...); auto __control_block = __guard.__release_ptr(); - return shared_ptr<_Tp>::__create_with_control_block((*__control_block).__get_elem(), _VSTD::addressof(*__control_block)); + return shared_ptr<_Tp>::__create_with_control_block((*__control_block).__get_elem(), std::addressof(*__control_block)); } template<class _Tp, class ..._Args, class = __enable_if_t<!is_array<_Tp>::value> > _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> make_shared(_Args&& ...__args) { - return _VSTD::allocate_shared<_Tp>(allocator<_Tp>(), _VSTD::forward<_Args>(__args)...); + return std::allocate_shared<_Tp>(allocator<_Tp>(), std::forward<_Args>(__args)...); } #if _LIBCPP_STD_VER >= 20 @@ -1339,7 +1342,7 @@ shared_ptr<_Tp> make_shared_for_overwrite(size_t __n) #endif // _LIBCPP_STD_VER >= 20 template<class _Tp, class _Up> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator==(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT { @@ -1349,7 +1352,7 @@ operator==(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT #if _LIBCPP_STD_VER <= 17 template<class _Tp, class _Up> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT { @@ -1357,7 +1360,7 @@ operator!=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT } template<class _Tp, class _Up> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator<(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT { @@ -1371,7 +1374,7 @@ operator<(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT } template<class _Tp, class _Up> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator>(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT { @@ -1379,7 +1382,7 @@ operator>(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT } template<class _Tp, class _Up> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT { @@ -1387,7 +1390,7 @@ operator<=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT } template<class _Tp, class _Up> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT { @@ -1406,7 +1409,7 @@ operator<=>(shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) noexcept #endif template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator==(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT { @@ -1416,7 +1419,7 @@ operator==(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT #if _LIBCPP_STD_VER <= 17 template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator==(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT { @@ -1424,7 +1427,7 @@ operator==(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT } template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT { @@ -1432,7 +1435,7 @@ operator!=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT } template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator!=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT { @@ -1440,7 +1443,7 @@ operator!=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT } template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator<(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT { @@ -1448,7 +1451,7 @@ operator<(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT } template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator<(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT { @@ -1456,7 +1459,7 @@ operator<(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT } template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator>(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT { @@ -1464,7 +1467,7 @@ operator>(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT } template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator>(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT { @@ -1472,7 +1475,7 @@ operator>(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT } template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT { @@ -1480,7 +1483,7 @@ operator<=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT } template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator<=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT { @@ -1488,7 +1491,7 @@ operator<=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT } template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT { @@ -1496,7 +1499,7 @@ operator>=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT } template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator>=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT { @@ -1515,7 +1518,7 @@ operator<=>(shared_ptr<_Tp> const& __x, nullptr_t) noexcept #endif template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI void swap(shared_ptr<_Tp>& __x, shared_ptr<_Tp>& __y) _NOEXCEPT { @@ -1523,7 +1526,7 @@ swap(shared_ptr<_Tp>& __x, shared_ptr<_Tp>& __y) _NOEXCEPT } template<class _Tp, class _Up> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> static_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT { @@ -1542,7 +1545,7 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> static_pointer_cast(shared_ptr<_Up>&& __r) #endif template<class _Tp, class _Up> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> dynamic_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT { @@ -1599,7 +1602,7 @@ _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> reinterpret_pointer_cast(shared_ptr<_Up>&& #ifndef _LIBCPP_HAS_NO_RTTI template<class _Dp, class _Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI _Dp* get_deleter(const shared_ptr<_Tp>& __p) _NOEXCEPT { @@ -1623,73 +1626,60 @@ private: __shared_weak_count* __cntrl_; public: - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR weak_ptr() _NOEXCEPT; - template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(shared_ptr<_Yp> const& __r, - typename enable_if<__compatible_with<_Yp, _Tp>::value, __nat*>::type = 0) - _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + + template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI weak_ptr(shared_ptr<_Yp> const& __r) _NOEXCEPT; + + _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr const& __r) _NOEXCEPT; - template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(weak_ptr<_Yp> const& __r, - typename enable_if<__compatible_with<_Yp, _Tp>::value, __nat*>::type = 0) - _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr<_Yp> const& __r) _NOEXCEPT; + + _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr&& __r) _NOEXCEPT; - template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(weak_ptr<_Yp>&& __r, - typename enable_if<__compatible_with<_Yp, _Tp>::value, __nat*>::type = 0) - _NOEXCEPT; + + template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI weak_ptr(weak_ptr<_Yp>&& __r) _NOEXCEPT; + _LIBCPP_HIDE_FROM_ABI ~weak_ptr(); - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr const& __r) _NOEXCEPT; - template<class _Yp> - typename enable_if - < - __compatible_with<_Yp, _Tp>::value, - weak_ptr& - >::type - _LIBCPP_INLINE_VISIBILITY + template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr&& __r) _NOEXCEPT; - template<class _Yp> - typename enable_if - < - __compatible_with<_Yp, _Tp>::value, - weak_ptr& - >::type - _LIBCPP_INLINE_VISIBILITY + template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT; - template<class _Yp> - typename enable_if - < - __compatible_with<_Yp, _Tp>::value, - weak_ptr& - >::type - _LIBCPP_INLINE_VISIBILITY + template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI weak_ptr& operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI void swap(weak_ptr& __r) _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI void reset() _NOEXCEPT; - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI long use_count() const _NOEXCEPT {return __cntrl_ ? __cntrl_->use_count() : 0;} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI bool expired() const _NOEXCEPT {return __cntrl_ == nullptr || __cntrl_->use_count() == 0;} _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> lock() const _NOEXCEPT; template<class _Up> - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI bool owner_before(const shared_ptr<_Up>& __r) const _NOEXCEPT {return __cntrl_ < __r.__cntrl_;} template<class _Up> - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI bool owner_before(const weak_ptr<_Up>& __r) const _NOEXCEPT {return __cntrl_ < __r.__cntrl_;} @@ -1722,10 +1712,9 @@ weak_ptr<_Tp>::weak_ptr(weak_ptr const& __r) _NOEXCEPT } template<class _Tp> -template<class _Yp> +template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> > inline -weak_ptr<_Tp>::weak_ptr(shared_ptr<_Yp> const& __r, - typename enable_if<__compatible_with<_Yp, _Tp>::value, __nat*>::type) +weak_ptr<_Tp>::weak_ptr(shared_ptr<_Yp> const& __r) _NOEXCEPT : __ptr_(__r.__ptr_), __cntrl_(__r.__cntrl_) @@ -1735,16 +1724,15 @@ weak_ptr<_Tp>::weak_ptr(shared_ptr<_Yp> const& __r, } template<class _Tp> -template<class _Yp> +template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> > inline -weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r, - typename enable_if<__compatible_with<_Yp, _Tp>::value, __nat*>::type) +weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r) _NOEXCEPT - : __ptr_(__r.__ptr_), - __cntrl_(__r.__cntrl_) + : __ptr_(nullptr), + __cntrl_(nullptr) { - if (__cntrl_) - __cntrl_->__add_weak(); + shared_ptr<_Yp> __s = __r.lock(); + *this = weak_ptr<_Tp>(__s); } template<class _Tp> @@ -1758,16 +1746,16 @@ weak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) _NOEXCEPT } template<class _Tp> -template<class _Yp> +template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> > inline -weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp>&& __r, - typename enable_if<__compatible_with<_Yp, _Tp>::value, __nat*>::type) +weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp>&& __r) _NOEXCEPT - : __ptr_(__r.__ptr_), - __cntrl_(__r.__cntrl_) + : __ptr_(nullptr), + __cntrl_(nullptr) { - __r.__ptr_ = nullptr; - __r.__cntrl_ = nullptr; + shared_ptr<_Yp> __s = __r.lock(); + *this = weak_ptr<_Tp>(__s); + __r.reset(); } template<class _Tp> @@ -1787,13 +1775,9 @@ weak_ptr<_Tp>::operator=(weak_ptr const& __r) _NOEXCEPT } template<class _Tp> -template<class _Yp> +template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> > inline -typename enable_if -< - __compatible_with<_Yp, _Tp>::value, - weak_ptr<_Tp>& ->::type +weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT { weak_ptr(__r).swap(*this); @@ -1805,32 +1789,24 @@ inline weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(weak_ptr&& __r) _NOEXCEPT { - weak_ptr(_VSTD::move(__r)).swap(*this); + weak_ptr(std::move(__r)).swap(*this); return *this; } template<class _Tp> -template<class _Yp> +template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> > inline -typename enable_if -< - __compatible_with<_Yp, _Tp>::value, - weak_ptr<_Tp>& ->::type +weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT { - weak_ptr(_VSTD::move(__r)).swap(*this); + weak_ptr(std::move(__r)).swap(*this); return *this; } template<class _Tp> -template<class _Yp> +template<class _Yp, __enable_if_t<__compatible_with<_Yp, _Tp>::value, int> > inline -typename enable_if -< - __compatible_with<_Yp, _Tp>::value, - weak_ptr<_Tp>& ->::type +weak_ptr<_Tp>& weak_ptr<_Tp>::operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT { weak_ptr(__r).swap(*this); @@ -1842,12 +1818,12 @@ inline void weak_ptr<_Tp>::swap(weak_ptr& __r) _NOEXCEPT { - _VSTD::swap(__ptr_, __r.__ptr_); - _VSTD::swap(__cntrl_, __r.__cntrl_); + std::swap(__ptr_, __r.__ptr_); + std::swap(__cntrl_, __r.__cntrl_); } template<class _Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI void swap(weak_ptr<_Tp>& __x, weak_ptr<_Tp>& __y) _NOEXCEPT { @@ -1884,13 +1860,13 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS owner_less<shared_ptr<_Tp> > : __binary_function<shared_ptr<_Tp>, shared_ptr<_Tp>, bool> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI bool operator()(shared_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} }; @@ -1899,13 +1875,13 @@ template <class _Tp> struct _LIBCPP_TEMPLATE_VIS owner_less<weak_ptr<_Tp> > : __binary_function<weak_ptr<_Tp>, weak_ptr<_Tp>, bool> { - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} }; @@ -1915,19 +1891,19 @@ template <> struct _LIBCPP_TEMPLATE_VIS owner_less<void> { template <class _Tp, class _Up> - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} template <class _Tp, class _Up> - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI bool operator()( shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} template <class _Tp, class _Up> - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} template <class _Tp, class _Up> - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const _NOEXCEPT {return __x.owner_before(__y);} typedef void is_transparent; @@ -1939,29 +1915,29 @@ class _LIBCPP_TEMPLATE_VIS enable_shared_from_this { mutable weak_ptr<_Tp> __weak_this_; protected: - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR enable_shared_from_this() _NOEXCEPT {} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI enable_shared_from_this(enable_shared_from_this const&) _NOEXCEPT {} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI enable_shared_from_this& operator=(enable_shared_from_this const&) _NOEXCEPT {return *this;} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI ~enable_shared_from_this() {} public: - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> shared_from_this() {return shared_ptr<_Tp>(__weak_this_);} - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp const> shared_from_this() const {return shared_ptr<const _Tp>(__weak_this_);} #if _LIBCPP_STD_VER >= 17 - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI weak_ptr<_Tp> weak_from_this() _NOEXCEPT { return __weak_this_; } - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI weak_ptr<const _Tp> weak_from_this() const _NOEXCEPT { return __weak_this_; } #endif // _LIBCPP_STD_VER >= 17 @@ -1979,7 +1955,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<shared_ptr<_Tp> > _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type; #endif - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(const shared_ptr<_Tp>& __ptr) const _NOEXCEPT { return hash<typename shared_ptr<_Tp>::element_type*>()(__ptr.get()); @@ -1987,7 +1963,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<shared_ptr<_Tp> > }; template<class _CharT, class _Traits, class _Yp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI basic_ostream<_CharT, _Traits>& operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p); @@ -2009,11 +1985,10 @@ private: friend _LIBCPP_EXPORTED_FROM_ABI __sp_mut& __get_sp_mut(const void*); }; -_LIBCPP_EXPORTED_FROM_ABI _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR -__sp_mut& __get_sp_mut(const void*); +_LIBCPP_EXPORTED_FROM_ABI __sp_mut& __get_sp_mut(const void*); template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool atomic_is_lock_free(const shared_ptr<_Tp>*) { @@ -2021,7 +1996,6 @@ atomic_is_lock_free(const shared_ptr<_Tp>*) } template <class _Tp> -_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> atomic_load(const shared_ptr<_Tp>* __p) { @@ -2033,8 +2007,7 @@ atomic_load(const shared_ptr<_Tp>* __p) } template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR +inline _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order) { @@ -2042,7 +2015,6 @@ atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order) } template <class _Tp> -_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR _LIBCPP_HIDE_FROM_ABI void atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) { @@ -2053,8 +2025,7 @@ atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) } template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR +inline _LIBCPP_HIDE_FROM_ABI void atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order) { @@ -2062,7 +2033,6 @@ atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order) } template <class _Tp> -_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) { @@ -2074,8 +2044,7 @@ atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r) } template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR +inline _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order) { @@ -2083,7 +2052,6 @@ atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order } template <class _Tp> -_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR _LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w) { @@ -2092,20 +2060,19 @@ atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, share __m.lock(); if (__p->__owner_equivalent(*__v)) { - _VSTD::swap(__temp, *__p); + std::swap(__temp, *__p); *__p = __w; __m.unlock(); return true; } - _VSTD::swap(__temp, *__v); + std::swap(__temp, *__v); *__v = *__p; __m.unlock(); return false; } template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR +inline _LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w) { @@ -2113,8 +2080,7 @@ atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ } template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR +inline _LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w, memory_order, memory_order) @@ -2123,8 +2089,7 @@ atomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* _ } template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY -_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR +inline _LIBCPP_HIDE_FROM_ABI bool atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w, memory_order, memory_order) diff --git a/contrib/llvm-project/libcxx/include/__memory/swap_allocator.h b/contrib/llvm-project/libcxx/include/__memory/swap_allocator.h index 90851cb79cfc..f2c509056391 100644 --- a/contrib/llvm-project/libcxx/include/__memory/swap_allocator.h +++ b/contrib/llvm-project/libcxx/include/__memory/swap_allocator.h @@ -29,7 +29,7 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __swap_allocator(_Alloc _NOEXCEPT_(__is_nothrow_swappable<_Alloc>::value) #endif { - using _VSTD::swap; + using std::swap; swap(__a1, __a2); } @@ -45,7 +45,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __swap_allocator _NOEXCEPT_(__is_nothrow_swappable<_Alloc>::value) #endif { - _VSTD::__swap_allocator( + std::__swap_allocator( __a1, __a2, integral_constant<bool, allocator_traits<_Alloc>::propagate_on_container_swap::value>()); } diff --git a/contrib/llvm-project/libcxx/include/__memory/temporary_buffer.h b/contrib/llvm-project/libcxx/include/__memory/temporary_buffer.h index c917f041a014..28ef5d028bec 100644 --- a/contrib/llvm-project/libcxx/include/__memory/temporary_buffer.h +++ b/contrib/llvm-project/libcxx/include/__memory/temporary_buffer.h @@ -38,8 +38,7 @@ get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT #if !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION) if (__is_overaligned_for_new(_LIBCPP_ALIGNOF(_Tp))) { - align_val_t __al = - align_val_t(alignment_of<_Tp>::value); + align_val_t __al = align_val_t(_LIBCPP_ALIGNOF(_Tp)); __r.first = static_cast<_Tp*>(::operator new( __n * sizeof(_Tp), __al, nothrow)); } else { @@ -68,17 +67,17 @@ get_temporary_buffer(ptrdiff_t __n) _NOEXCEPT } template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_IN_CXX17 +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_DEPRECATED_IN_CXX17 void return_temporary_buffer(_Tp* __p) _NOEXCEPT { - _VSTD::__libcpp_deallocate_unsized((void*)__p, _LIBCPP_ALIGNOF(_Tp)); + std::__libcpp_deallocate_unsized((void*)__p, _LIBCPP_ALIGNOF(_Tp)); } struct __return_temporary_buffer { _LIBCPP_SUPPRESS_DEPRECATED_PUSH template <class _Tp> - _LIBCPP_INLINE_VISIBILITY void operator()(_Tp* __p) const {_VSTD::return_temporary_buffer(__p);} + _LIBCPP_HIDE_FROM_ABI void operator()(_Tp* __p) const {std::return_temporary_buffer(__p);} _LIBCPP_SUPPRESS_DEPRECATED_POP }; diff --git a/contrib/llvm-project/libcxx/include/__memory/uninitialized_algorithms.h b/contrib/llvm-project/libcxx/include/__memory/uninitialized_algorithms.h index 2b68df8e6d63..b0eb7001598b 100644 --- a/contrib/llvm-project/libcxx/include/__memory/uninitialized_algorithms.h +++ b/contrib/llvm-project/libcxx/include/__memory/uninitialized_algorithms.h @@ -44,35 +44,32 @@ _LIBCPP_BEGIN_NAMESPACE_STD -// This is a simplified version of C++20 `unreachable_sentinel` that doesn't use concepts and thus can be used in any -// language mode. -struct __unreachable_sentinel { - template <class _Iter> - _LIBCPP_HIDE_FROM_ABI friend _LIBCPP_CONSTEXPR bool operator!=(const _Iter&, __unreachable_sentinel) _NOEXCEPT { - return true; +struct __always_false { + template <class... _Args> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool operator()(_Args&&...) const _NOEXCEPT { + return false; } }; // uninitialized_copy -template <class _ValueType, class _InputIterator, class _Sentinel1, class _ForwardIterator, class _Sentinel2> -inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> -__uninitialized_copy(_InputIterator __ifirst, _Sentinel1 __ilast, - _ForwardIterator __ofirst, _Sentinel2 __olast) { +template <class _ValueType, class _InputIterator, class _Sentinel1, class _ForwardIterator, class _EndPredicate> +inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitialized_copy( + _InputIterator __ifirst, _Sentinel1 __ilast, _ForwardIterator __ofirst, _EndPredicate __stop_copying) { _ForwardIterator __idx = __ofirst; #ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif - for (; __ifirst != __ilast && __idx != __olast; ++__ifirst, (void)++__idx) - ::new (_VSTD::__voidify(*__idx)) _ValueType(*__ifirst); + for (; __ifirst != __ilast && !__stop_copying(__idx); ++__ifirst, (void)++__idx) + ::new (std::__voidify(*__idx)) _ValueType(*__ifirst); #ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { - _VSTD::__destroy(__ofirst, __idx); + std::__destroy(__ofirst, __idx); throw; } #endif - return pair<_InputIterator, _ForwardIterator>(_VSTD::move(__ifirst), _VSTD::move(__idx)); + return pair<_InputIterator, _ForwardIterator>(std::move(__ifirst), std::move(__idx)); } template <class _InputIterator, class _ForwardIterator> @@ -80,40 +77,39 @@ _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_copy(_InputIterator __ifirst, _InputIterator __ilast, _ForwardIterator __ofirst) { typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; - auto __result = _VSTD::__uninitialized_copy<_ValueType>(_VSTD::move(__ifirst), _VSTD::move(__ilast), - _VSTD::move(__ofirst), __unreachable_sentinel()); - return _VSTD::move(__result.second); + auto __result = std::__uninitialized_copy<_ValueType>( + std::move(__ifirst), std::move(__ilast), std::move(__ofirst), __always_false()); + return std::move(__result.second); } // uninitialized_copy_n -template <class _ValueType, class _InputIterator, class _Size, class _ForwardIterator, class _Sentinel> -inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> -__uninitialized_copy_n(_InputIterator __ifirst, _Size __n, - _ForwardIterator __ofirst, _Sentinel __olast) { +template <class _ValueType, class _InputIterator, class _Size, class _ForwardIterator, class _EndPredicate> +inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitialized_copy_n( + _InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst, _EndPredicate __stop_copying) { _ForwardIterator __idx = __ofirst; #ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif - for (; __n > 0 && __idx != __olast; ++__ifirst, (void)++__idx, (void)--__n) - ::new (_VSTD::__voidify(*__idx)) _ValueType(*__ifirst); + for (; __n > 0 && !__stop_copying(__idx); ++__ifirst, (void)++__idx, (void)--__n) + ::new (std::__voidify(*__idx)) _ValueType(*__ifirst); #ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { - _VSTD::__destroy(__ofirst, __idx); + std::__destroy(__ofirst, __idx); throw; } #endif - return pair<_InputIterator, _ForwardIterator>(_VSTD::move(__ifirst), _VSTD::move(__idx)); + return pair<_InputIterator, _ForwardIterator>(std::move(__ifirst), std::move(__idx)); } template <class _InputIterator, class _Size, class _ForwardIterator> inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_copy_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst) { typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; - auto __result = _VSTD::__uninitialized_copy_n<_ValueType>(_VSTD::move(__ifirst), __n, _VSTD::move(__ofirst), - __unreachable_sentinel()); - return _VSTD::move(__result.second); + auto __result = + std::__uninitialized_copy_n<_ValueType>(std::move(__ifirst), __n, std::move(__ofirst), __always_false()); + return std::move(__result.second); } // uninitialized_fill @@ -128,12 +124,12 @@ _ForwardIterator __uninitialized_fill(_ForwardIterator __first, _Sentinel __last { #endif for (; __idx != __last; ++__idx) - ::new (_VSTD::__voidify(*__idx)) _ValueType(__x); + ::new (std::__voidify(*__idx)) _ValueType(__x); #ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { - _VSTD::__destroy(__first, __idx); + std::__destroy(__first, __idx); throw; } #endif @@ -146,7 +142,7 @@ inline _LIBCPP_HIDE_FROM_ABI void uninitialized_fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __x) { typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; - (void)_VSTD::__uninitialized_fill<_ValueType>(__first, __last, __x); + (void)std::__uninitialized_fill<_ValueType>(__first, __last, __x); } // uninitialized_fill_n @@ -161,12 +157,12 @@ _ForwardIterator __uninitialized_fill_n(_ForwardIterator __first, _Size __n, con { #endif for (; __n > 0; ++__idx, (void) --__n) - ::new (_VSTD::__voidify(*__idx)) _ValueType(__x); + ::new (std::__voidify(*__idx)) _ValueType(__x); #ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { - _VSTD::__destroy(__first, __idx); + std::__destroy(__first, __idx); throw; } #endif @@ -179,7 +175,7 @@ inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_fill_n(_ForwardIterator __first, _Size __n, const _Tp& __x) { typedef typename iterator_traits<_ForwardIterator>::value_type _ValueType; - return _VSTD::__uninitialized_fill_n<_ValueType>(__first, __n, __x); + return std::__uninitialized_fill_n<_ValueType>(__first, __n, __x); } #if _LIBCPP_STD_VER >= 17 @@ -194,10 +190,10 @@ _ForwardIterator __uninitialized_default_construct(_ForwardIterator __first, _Se try { #endif for (; __idx != __last; ++__idx) - ::new (_VSTD::__voidify(*__idx)) _ValueType; + ::new (std::__voidify(*__idx)) _ValueType; #ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { - _VSTD::__destroy(__first, __idx); + std::__destroy(__first, __idx); throw; } #endif @@ -209,8 +205,8 @@ template <class _ForwardIterator> inline _LIBCPP_HIDE_FROM_ABI void uninitialized_default_construct(_ForwardIterator __first, _ForwardIterator __last) { using _ValueType = typename iterator_traits<_ForwardIterator>::value_type; - (void)_VSTD::__uninitialized_default_construct<_ValueType>( - _VSTD::move(__first), _VSTD::move(__last)); + (void)std::__uninitialized_default_construct<_ValueType>( + std::move(__first), std::move(__last)); } // uninitialized_default_construct_n @@ -223,10 +219,10 @@ _ForwardIterator __uninitialized_default_construct_n(_ForwardIterator __first, _ try { #endif for (; __n > 0; ++__idx, (void) --__n) - ::new (_VSTD::__voidify(*__idx)) _ValueType; + ::new (std::__voidify(*__idx)) _ValueType; #ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { - _VSTD::__destroy(__first, __idx); + std::__destroy(__first, __idx); throw; } #endif @@ -238,7 +234,7 @@ template <class _ForwardIterator, class _Size> inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_default_construct_n(_ForwardIterator __first, _Size __n) { using _ValueType = typename iterator_traits<_ForwardIterator>::value_type; - return _VSTD::__uninitialized_default_construct_n<_ValueType>(_VSTD::move(__first), __n); + return std::__uninitialized_default_construct_n<_ValueType>(std::move(__first), __n); } // uninitialized_value_construct @@ -251,10 +247,10 @@ _ForwardIterator __uninitialized_value_construct(_ForwardIterator __first, _Sent try { #endif for (; __idx != __last; ++__idx) - ::new (_VSTD::__voidify(*__idx)) _ValueType(); + ::new (std::__voidify(*__idx)) _ValueType(); #ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { - _VSTD::__destroy(__first, __idx); + std::__destroy(__first, __idx); throw; } #endif @@ -266,8 +262,8 @@ template <class _ForwardIterator> inline _LIBCPP_HIDE_FROM_ABI void uninitialized_value_construct(_ForwardIterator __first, _ForwardIterator __last) { using _ValueType = typename iterator_traits<_ForwardIterator>::value_type; - (void)_VSTD::__uninitialized_value_construct<_ValueType>( - _VSTD::move(__first), _VSTD::move(__last)); + (void)std::__uninitialized_value_construct<_ValueType>( + std::move(__first), std::move(__last)); } // uninitialized_value_construct_n @@ -280,10 +276,10 @@ _ForwardIterator __uninitialized_value_construct_n(_ForwardIterator __first, _Si try { #endif for (; __n > 0; ++__idx, (void) --__n) - ::new (_VSTD::__voidify(*__idx)) _ValueType(); + ::new (std::__voidify(*__idx)) _ValueType(); #ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { - _VSTD::__destroy(__first, __idx); + std::__destroy(__first, __idx); throw; } #endif @@ -295,74 +291,85 @@ template <class _ForwardIterator, class _Size> inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_value_construct_n(_ForwardIterator __first, _Size __n) { using _ValueType = typename iterator_traits<_ForwardIterator>::value_type; - return std::__uninitialized_value_construct_n<_ValueType>(_VSTD::move(__first), __n); + return std::__uninitialized_value_construct_n<_ValueType>(std::move(__first), __n); } // uninitialized_move -template <class _ValueType, class _InputIterator, class _Sentinel1, class _ForwardIterator, class _Sentinel2, +template <class _ValueType, + class _InputIterator, + class _Sentinel1, + class _ForwardIterator, + class _EndPredicate, class _IterMove> -inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> -__uninitialized_move(_InputIterator __ifirst, _Sentinel1 __ilast, - _ForwardIterator __ofirst, _Sentinel2 __olast, _IterMove __iter_move) { +inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitialized_move( + _InputIterator __ifirst, + _Sentinel1 __ilast, + _ForwardIterator __ofirst, + _EndPredicate __stop_moving, + _IterMove __iter_move) { auto __idx = __ofirst; #ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif - for (; __ifirst != __ilast && __idx != __olast; ++__idx, (void)++__ifirst) { - ::new (_VSTD::__voidify(*__idx)) _ValueType(__iter_move(__ifirst)); + for (; __ifirst != __ilast && !__stop_moving(__idx); ++__idx, (void)++__ifirst) { + ::new (std::__voidify(*__idx)) _ValueType(__iter_move(__ifirst)); } #ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { - _VSTD::__destroy(__ofirst, __idx); + std::__destroy(__ofirst, __idx); throw; } #endif - return {_VSTD::move(__ifirst), _VSTD::move(__idx)}; + return {std::move(__ifirst), std::move(__idx)}; } template <class _InputIterator, class _ForwardIterator> inline _LIBCPP_HIDE_FROM_ABI _ForwardIterator uninitialized_move(_InputIterator __ifirst, _InputIterator __ilast, _ForwardIterator __ofirst) { using _ValueType = typename iterator_traits<_ForwardIterator>::value_type; - auto __iter_move = [](auto&& __iter) -> decltype(auto) { return _VSTD::move(*__iter); }; + auto __iter_move = [](auto&& __iter) -> decltype(auto) { return std::move(*__iter); }; - auto __result = _VSTD::__uninitialized_move<_ValueType>(_VSTD::move(__ifirst), _VSTD::move(__ilast), - _VSTD::move(__ofirst), __unreachable_sentinel(), __iter_move); - return _VSTD::move(__result.second); + auto __result = std::__uninitialized_move<_ValueType>( + std::move(__ifirst), std::move(__ilast), std::move(__ofirst), __always_false(), __iter_move); + return std::move(__result.second); } // uninitialized_move_n -template <class _ValueType, class _InputIterator, class _Size, class _ForwardIterator, class _Sentinel, class _IterMove> -inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> -__uninitialized_move_n(_InputIterator __ifirst, _Size __n, - _ForwardIterator __ofirst, _Sentinel __olast, _IterMove __iter_move) { +template <class _ValueType, + class _InputIterator, + class _Size, + class _ForwardIterator, + class _EndPredicate, + class _IterMove> +inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> __uninitialized_move_n( + _InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst, _EndPredicate __stop_moving, _IterMove __iter_move) { auto __idx = __ofirst; #ifndef _LIBCPP_HAS_NO_EXCEPTIONS try { #endif - for (; __n > 0 && __idx != __olast; ++__idx, (void)++__ifirst, --__n) - ::new (_VSTD::__voidify(*__idx)) _ValueType(__iter_move(__ifirst)); + for (; __n > 0 && !__stop_moving(__idx); ++__idx, (void)++__ifirst, --__n) + ::new (std::__voidify(*__idx)) _ValueType(__iter_move(__ifirst)); #ifndef _LIBCPP_HAS_NO_EXCEPTIONS } catch (...) { - _VSTD::__destroy(__ofirst, __idx); + std::__destroy(__ofirst, __idx); throw; } #endif - return {_VSTD::move(__ifirst), _VSTD::move(__idx)}; + return {std::move(__ifirst), std::move(__idx)}; } template <class _InputIterator, class _Size, class _ForwardIterator> inline _LIBCPP_HIDE_FROM_ABI pair<_InputIterator, _ForwardIterator> uninitialized_move_n(_InputIterator __ifirst, _Size __n, _ForwardIterator __ofirst) { using _ValueType = typename iterator_traits<_ForwardIterator>::value_type; - auto __iter_move = [](auto&& __iter) -> decltype(auto) { return _VSTD::move(*__iter); }; + auto __iter_move = [](auto&& __iter) -> decltype(auto) { return std::move(*__iter); }; - return _VSTD::__uninitialized_move_n<_ValueType>(_VSTD::move(__ifirst), __n, _VSTD::move(__ofirst), - __unreachable_sentinel(), __iter_move); + return std::__uninitialized_move_n<_ValueType>( + std::move(__ifirst), __n, std::move(__ofirst), __always_false(), __iter_move); } // TODO: Rewrite this to iterate left to right and use reverse_iterators when calling diff --git a/contrib/llvm-project/libcxx/include/__memory/unique_ptr.h b/contrib/llvm-project/libcxx/include/__memory/unique_ptr.h index 5a9687897196..32e4942a834c 100644 --- a/contrib/llvm-project/libcxx/include/__memory/unique_ptr.h +++ b/contrib/llvm-project/libcxx/include/__memory/unique_ptr.h @@ -54,15 +54,15 @@ struct _LIBCPP_TEMPLATE_VIS default_delete { static_assert(!is_function<_Tp>::value, "default_delete cannot be instantiated for function types"); #ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY constexpr default_delete() _NOEXCEPT = default; + _LIBCPP_HIDE_FROM_ABI constexpr default_delete() _NOEXCEPT = default; #else - _LIBCPP_INLINE_VISIBILITY default_delete() {} + _LIBCPP_HIDE_FROM_ABI default_delete() {} #endif - template <class _Up> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 default_delete( - const default_delete<_Up>&, typename enable_if<is_convertible<_Up*, _Tp*>::value>::type* = 0) _NOEXCEPT {} + template <class _Up, __enable_if_t<is_convertible<_Up*, _Tp*>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 default_delete( + const default_delete<_Up>&) _NOEXCEPT {} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator()(_Tp* __ptr) const _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void operator()(_Tp* __ptr) const _NOEXCEPT { static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type"); static_assert(!is_void<_Tp>::value, "cannot delete an incomplete type"); delete __ptr; @@ -78,17 +78,17 @@ private: public: #ifndef _LIBCPP_CXX03_LANG - _LIBCPP_INLINE_VISIBILITY constexpr default_delete() _NOEXCEPT = default; + _LIBCPP_HIDE_FROM_ABI constexpr default_delete() _NOEXCEPT = default; #else - _LIBCPP_INLINE_VISIBILITY default_delete() {} + _LIBCPP_HIDE_FROM_ABI default_delete() {} #endif template <class _Up> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 default_delete(const default_delete<_Up[]>&, typename _EnableIfConvertible<_Up>::type* = 0) _NOEXCEPT {} template <class _Up> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 typename _EnableIfConvertible<_Up>::type + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 typename _EnableIfConvertible<_Up>::type operator()(_Up* __ptr) const _NOEXCEPT { static_assert(sizeof(_Up) >= 0, "cannot delete an incomplete type"); delete[] __ptr; @@ -155,84 +155,82 @@ private: template <bool _Dummy, class _Deleter = typename __dependent_type< __type_identity<deleter_type>, _Dummy>::type> using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG = - typename enable_if<is_default_constructible<_Deleter>::value && - !is_pointer<_Deleter>::value>::type; + __enable_if_t<is_default_constructible<_Deleter>::value && + !is_pointer<_Deleter>::value>; template <class _ArgType> using _EnableIfDeleterConstructible _LIBCPP_NODEBUG = - typename enable_if<is_constructible<deleter_type, _ArgType>::value>::type; + __enable_if_t<is_constructible<deleter_type, _ArgType>::value>; template <class _UPtr, class _Up> - using _EnableIfMoveConvertible _LIBCPP_NODEBUG = typename enable_if< + using _EnableIfMoveConvertible _LIBCPP_NODEBUG = __enable_if_t< is_convertible<typename _UPtr::pointer, pointer>::value && !is_array<_Up>::value - >::type; + >; template <class _UDel> - using _EnableIfDeleterConvertible _LIBCPP_NODEBUG = typename enable_if< + using _EnableIfDeleterConvertible _LIBCPP_NODEBUG = __enable_if_t< (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) || (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value) - >::type; + >; template <class _UDel> - using _EnableIfDeleterAssignable = typename enable_if< + using _EnableIfDeleterAssignable = __enable_if_t< is_assignable<_Dp&, _UDel&&>::value - >::type; + >; public: template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {} template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {} template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(pointer __p) _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(pointer __p) _NOEXCEPT : __ptr_(__p, __value_init_tag()) {} template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(pointer __p, _LValRefType<_Dummy> __d) _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(pointer __p, _LValRefType<_Dummy> __d) _NOEXCEPT : __ptr_(__p, __d) {} template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 - unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT : __ptr_(__p, _VSTD::move(__d)) { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 + unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT : __ptr_(__p, std::move(__d)) { static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference"); } template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> > > - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI unique_ptr(pointer __p, _BadRValRefType<_Dummy> __d) = delete; - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr&& __u) _NOEXCEPT - : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) {} + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr&& __u) _NOEXCEPT + : __ptr_(__u.release(), std::forward<deleter_type>(__u.get_deleter())) {} template <class _Up, class _Ep, class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>, class = _EnableIfDeleterConvertible<_Ep> > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT - : __ptr_(__u.release(), _VSTD::forward<_Ep>(__u.get_deleter())) {} + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT + : __ptr_(__u.release(), std::forward<_Ep>(__u.get_deleter())) {} #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) - template <class _Up> - _LIBCPP_INLINE_VISIBILITY - unique_ptr(auto_ptr<_Up>&& __p, - typename enable_if<is_convertible<_Up*, _Tp*>::value && - is_same<_Dp, default_delete<_Tp> >::value, - __nat>::type = __nat()) _NOEXCEPT + template <class _Up, __enable_if_t<is_convertible<_Up*, _Tp*>::value && + is_same<_Dp, default_delete<_Tp> >::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI + unique_ptr(auto_ptr<_Up>&& __p) _NOEXCEPT : __ptr_(__p.release(), __value_init_tag()) {} #endif - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT { reset(__u.release()); - __ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter()); + __ptr_.second() = std::forward<deleter_type>(__u.get_deleter()); return *this; } @@ -240,18 +238,17 @@ public: class _Ep, class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>, class = _EnableIfDeleterAssignable<_Ep> > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT { reset(__u.release()); - __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter()); + __ptr_.second() = std::forward<_Ep>(__u.get_deleter()); return *this; } #if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) - template <class _Up> - _LIBCPP_INLINE_VISIBILITY - typename enable_if<is_convertible<_Up*, _Tp*>::value && - is_same<_Dp, default_delete<_Tp> >::value, - unique_ptr&>::type + template <class _Up, __enable_if_t<is_convertible<_Up*, _Tp*>::value && + is_same<_Dp, default_delete<_Tp> >::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI + unique_ptr& operator=(auto_ptr<_Up> __p) { reset(__p.release()); return *this; @@ -263,44 +260,44 @@ public: unique_ptr& operator=(unique_ptr const&) = delete; #endif - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(nullptr_t) _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(nullptr_t) _NOEXCEPT { reset(); return *this; } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t<_Tp> operator*() const { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t<_Tp> operator*() const { return *__ptr_.first(); } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer operator->() const _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer operator->() const _NOEXCEPT { return __ptr_.first(); } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer get() const _NOEXCEPT { return __ptr_.first(); } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 deleter_type& get_deleter() _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer get() const _NOEXCEPT { return __ptr_.first(); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 deleter_type& get_deleter() _NOEXCEPT { return __ptr_.second(); } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 const deleter_type& get_deleter() const _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const deleter_type& get_deleter() const _NOEXCEPT { return __ptr_.second(); } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit operator bool() const _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit operator bool() const _NOEXCEPT { return __ptr_.first() != nullptr; } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer release() _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer release() _NOEXCEPT { pointer __t = __ptr_.first(); __ptr_.first() = pointer(); return __t; } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 void reset(pointer __p = pointer()) _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void reset(pointer __p = pointer()) _NOEXCEPT { pointer __tmp = __ptr_.first(); __ptr_.first() = __p; if (__tmp) __ptr_.second()(__tmp); } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 void swap(unique_ptr& __u) _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void swap(unique_ptr& __u) _NOEXCEPT { __ptr_.swap(__u.__ptr_); } }; @@ -345,80 +342,80 @@ private: template <bool _Dummy, class _Deleter = typename __dependent_type< __type_identity<deleter_type>, _Dummy>::type> using _EnableIfDeleterDefaultConstructible _LIBCPP_NODEBUG = - typename enable_if<is_default_constructible<_Deleter>::value && - !is_pointer<_Deleter>::value>::type; + __enable_if_t<is_default_constructible<_Deleter>::value && + !is_pointer<_Deleter>::value>; template <class _ArgType> using _EnableIfDeleterConstructible _LIBCPP_NODEBUG = - typename enable_if<is_constructible<deleter_type, _ArgType>::value>::type; + __enable_if_t<is_constructible<deleter_type, _ArgType>::value>; template <class _Pp> - using _EnableIfPointerConvertible _LIBCPP_NODEBUG = typename enable_if< + using _EnableIfPointerConvertible _LIBCPP_NODEBUG = __enable_if_t< _CheckArrayPointerConversion<_Pp>::value - >::type; + >; template <class _UPtr, class _Up, class _ElemT = typename _UPtr::element_type> - using _EnableIfMoveConvertible _LIBCPP_NODEBUG = typename enable_if< + using _EnableIfMoveConvertible _LIBCPP_NODEBUG = __enable_if_t< is_array<_Up>::value && is_same<pointer, element_type*>::value && is_same<typename _UPtr::pointer, _ElemT*>::value && is_convertible<_ElemT(*)[], element_type(*)[]>::value - >::type; + >; template <class _UDel> - using _EnableIfDeleterConvertible _LIBCPP_NODEBUG = typename enable_if< + using _EnableIfDeleterConvertible _LIBCPP_NODEBUG = __enable_if_t< (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) || (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value) - >::type; + >; template <class _UDel> - using _EnableIfDeleterAssignable _LIBCPP_NODEBUG = typename enable_if< + using _EnableIfDeleterAssignable _LIBCPP_NODEBUG = __enable_if_t< is_assignable<_Dp&, _UDel&&>::value - >::type; + >; public: template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {} template <bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy> > - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT : __ptr_(__value_init_tag(), __value_init_tag()) {} template <class _Pp, bool _Dummy = true, class = _EnableIfDeleterDefaultConstructible<_Dummy>, class = _EnableIfPointerConvertible<_Pp> > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(_Pp __p) _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit unique_ptr(_Pp __p) _NOEXCEPT : __ptr_(__p, __value_init_tag()) {} template <class _Pp, bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> >, class = _EnableIfPointerConvertible<_Pp> > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(_Pp __p, _LValRefType<_Dummy> __d) _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(_Pp __p, _LValRefType<_Dummy> __d) _NOEXCEPT : __ptr_(__p, __d) {} template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_LValRefType<_Dummy> > > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(nullptr_t, _LValRefType<_Dummy> __d) _NOEXCEPT + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(nullptr_t, _LValRefType<_Dummy> __d) _NOEXCEPT : __ptr_(nullptr, __d) {} template <class _Pp, bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> >, class = _EnableIfPointerConvertible<_Pp> > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(_Pp __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT - : __ptr_(__p, _VSTD::move(__d)) { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(_Pp __p, _GoodRValRefType<_Dummy> __d) _NOEXCEPT + : __ptr_(__p, std::move(__d)) { static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference"); } template <bool _Dummy = true, class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy> > > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(nullptr_t, _GoodRValRefType<_Dummy> __d) _NOEXCEPT - : __ptr_(nullptr, _VSTD::move(__d)) { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(nullptr_t, _GoodRValRefType<_Dummy> __d) _NOEXCEPT + : __ptr_(nullptr, std::move(__d)) { static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference"); } @@ -426,15 +423,15 @@ public: template <class _Pp, bool _Dummy = true, class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy> >, class = _EnableIfPointerConvertible<_Pp> > - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI unique_ptr(_Pp __p, _BadRValRefType<_Dummy> __d) = delete; - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr&& __u) _NOEXCEPT - : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) {} + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr&& __u) _NOEXCEPT + : __ptr_(__u.release(), std::forward<deleter_type>(__u.get_deleter())) {} - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT { reset(__u.release()); - __ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter()); + __ptr_.second() = std::forward<deleter_type>(__u.get_deleter()); return *this; } @@ -442,16 +439,16 @@ public: class _Ep, class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>, class = _EnableIfDeleterConvertible<_Ep> > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT - : __ptr_(__u.release(), _VSTD::forward<_Ep>(__u.get_deleter())) {} + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT + : __ptr_(__u.release(), std::forward<_Ep>(__u.get_deleter())) {} template <class _Up, class _Ep, class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>, class = _EnableIfDeleterAssignable<_Ep> > - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT { reset(__u.release()); - __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter()); + __ptr_.second() = std::forward<_Ep>(__u.get_deleter()); return *this; } @@ -460,80 +457,79 @@ public: unique_ptr& operator=(unique_ptr const&) = delete; #endif public: - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(nullptr_t) _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 unique_ptr& operator=(nullptr_t) _NOEXCEPT { reset(); return *this; } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t<_Tp> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 __add_lvalue_reference_t<_Tp> operator[](size_t __i) const { return __ptr_.first()[__i]; } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer get() const _NOEXCEPT { return __ptr_.first(); } + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer get() const _NOEXCEPT { return __ptr_.first(); } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 deleter_type& get_deleter() _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 deleter_type& get_deleter() _NOEXCEPT { return __ptr_.second(); } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 const deleter_type& get_deleter() const _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 const deleter_type& get_deleter() const _NOEXCEPT { return __ptr_.second(); } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit operator bool() const _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 explicit operator bool() const _NOEXCEPT { return __ptr_.first() != nullptr; } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer release() _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 pointer release() _NOEXCEPT { pointer __t = __ptr_.first(); __ptr_.first() = pointer(); return __t; } - template <class _Pp> - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 - typename enable_if< _CheckArrayPointerConversion<_Pp>::value >::type - reset(_Pp __p) _NOEXCEPT { + template <class _Pp, __enable_if_t<_CheckArrayPointerConversion<_Pp>::value, int> = 0> + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 + void reset(_Pp __p) _NOEXCEPT { pointer __tmp = __ptr_.first(); __ptr_.first() = __p; if (__tmp) __ptr_.second()(__tmp); } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 void reset(nullptr_t = nullptr) _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void reset(nullptr_t = nullptr) _NOEXCEPT { pointer __tmp = __ptr_.first(); __ptr_.first() = nullptr; if (__tmp) __ptr_.second()(__tmp); } - _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 void swap(unique_ptr& __u) _NOEXCEPT { + _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 void swap(unique_ptr& __u) _NOEXCEPT { __ptr_.swap(__u.__ptr_); } }; -template <class _Tp, class _Dp> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 - typename enable_if< __is_swappable<_Dp>::value, void >::type +template <class _Tp, class _Dp, __enable_if_t<__is_swappable<_Dp>::value, int> = 0> +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 + void swap(unique_ptr<_Tp, _Dp>& __x, unique_ptr<_Tp, _Dp>& __y) _NOEXCEPT { __x.swap(__y); } template <class _T1, class _D1, class _T2, class _D2> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator==(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) { return __x.get() == __y.get(); } #if _LIBCPP_STD_VER <= 17 template <class _T1, class _D1, class _T2, class _D2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__x == __y);} #endif template <class _T1, class _D1, class _T2, class _D2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator< (const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) { @@ -544,17 +540,17 @@ operator< (const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) } template <class _T1, class _D1, class _T2, class _D2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator> (const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return __y < __x;} template <class _T1, class _D1, class _T2, class _D2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator<=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__y < __x);} template <class _T1, class _D1, class _T2, class _D2> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator>=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__x < __y);} @@ -572,14 +568,14 @@ operator<=>(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) { #endif template <class _T1, class _D1> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT { return !__x; } #if _LIBCPP_STD_VER <= 17 template <class _T1, class _D1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT { @@ -587,7 +583,7 @@ operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT } template <class _T1, class _D1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT { @@ -595,7 +591,7 @@ operator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT } template <class _T1, class _D1> -inline _LIBCPP_INLINE_VISIBILITY +inline _LIBCPP_HIDE_FROM_ABI bool operator!=(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT { @@ -604,51 +600,51 @@ operator!=(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT #endif // _LIBCPP_STD_VER <= 17 template <class _T1, class _D1> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator<(const unique_ptr<_T1, _D1>& __x, nullptr_t) { typedef typename unique_ptr<_T1, _D1>::pointer _P1; return less<_P1>()(__x.get(), nullptr); } template <class _T1, class _D1> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator<(nullptr_t, const unique_ptr<_T1, _D1>& __x) { typedef typename unique_ptr<_T1, _D1>::pointer _P1; return less<_P1>()(nullptr, __x.get()); } template <class _T1, class _D1> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator>(const unique_ptr<_T1, _D1>& __x, nullptr_t) { return nullptr < __x; } template <class _T1, class _D1> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator>(nullptr_t, const unique_ptr<_T1, _D1>& __x) { return __x < nullptr; } template <class _T1, class _D1> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator<=(const unique_ptr<_T1, _D1>& __x, nullptr_t) { return !(nullptr < __x); } template <class _T1, class _D1> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator<=(nullptr_t, const unique_ptr<_T1, _D1>& __x) { return !(__x < nullptr); } template <class _T1, class _D1> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator>=(const unique_ptr<_T1, _D1>& __x, nullptr_t) { return !(__x < nullptr); } template <class _T1, class _D1> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 bool +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator>=(nullptr_t, const unique_ptr<_T1, _D1>& __x) { return !(nullptr < __x); } @@ -684,13 +680,13 @@ struct __unique_if<_Tp[_Np]> }; template <class _Tp, class... _Args> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 typename __unique_if<_Tp>::__unique_single +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 typename __unique_if<_Tp>::__unique_single make_unique(_Args&&... __args) { - return unique_ptr<_Tp>(new _Tp(_VSTD::forward<_Args>(__args)...)); + return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); } template <class _Tp> -inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 typename __unique_if<_Tp>::__unique_array_unknown_bound +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 typename __unique_if<_Tp>::__unique_array_unknown_bound make_unique(size_t __n) { typedef __remove_extent_t<_Tp> _Up; return unique_ptr<_Tp>(new _Up[__n]()); @@ -736,7 +732,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<__enable_hash_helper< _LIBCPP_DEPRECATED_IN_CXX17 typedef size_t result_type; #endif - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_HIDE_FROM_ABI size_t operator()(const unique_ptr<_Tp, _Dp>& __ptr) const { typedef typename unique_ptr<_Tp, _Dp>::pointer pointer; diff --git a/contrib/llvm-project/libcxx/include/__memory/uses_allocator_construction.h b/contrib/llvm-project/libcxx/include/__memory/uses_allocator_construction.h index a2e4f6e26f4b..71ae5bcd3233 100644 --- a/contrib/llvm-project/libcxx/include/__memory/uses_allocator_construction.h +++ b/contrib/llvm-project/libcxx/include/__memory/uses_allocator_construction.h @@ -12,6 +12,7 @@ #include <__config> #include <__memory/construct_at.h> #include <__memory/uses_allocator.h> +#include <__tuple/pair_like.h> #include <__type_traits/enable_if.h> #include <__type_traits/is_same.h> #include <__type_traits/remove_cv.h> @@ -36,15 +37,19 @@ inline constexpr bool __is_std_pair = false; template <class _Type1, class _Type2> inline constexpr bool __is_std_pair<pair<_Type1, _Type2>> = true; -template <class _Type, class _Alloc, class... _Args, __enable_if_t<!__is_std_pair<_Type>, int> = 0> +template <class _Tp> +inline constexpr bool __is_cv_std_pair = __is_std_pair<remove_cv_t<_Tp>>; + +template <class _Type, class _Alloc, class... _Args, __enable_if_t<!__is_cv_std_pair<_Type>, int> = 0> _LIBCPP_HIDE_FROM_ABI constexpr auto __uses_allocator_construction_args(const _Alloc& __alloc, _Args&&... __args) noexcept { - if constexpr (!uses_allocator_v<_Type, _Alloc> && is_constructible_v<_Type, _Args...>) { + if constexpr (!uses_allocator_v<remove_cv_t<_Type>, _Alloc> && is_constructible_v<_Type, _Args...>) { return std::forward_as_tuple(std::forward<_Args>(__args)...); - } else if constexpr (uses_allocator_v<_Type, _Alloc> && + } else if constexpr (uses_allocator_v<remove_cv_t<_Type>, _Alloc> && is_constructible_v<_Type, allocator_arg_t, const _Alloc&, _Args...>) { return tuple<allocator_arg_t, const _Alloc&, _Args&&...>(allocator_arg, __alloc, std::forward<_Args>(__args)...); - } else if constexpr (uses_allocator_v<_Type, _Alloc> && is_constructible_v<_Type, _Args..., const _Alloc&>) { + } else if constexpr (uses_allocator_v<remove_cv_t<_Type>, _Alloc> && + is_constructible_v<_Type, _Args..., const _Alloc&>) { return std::forward_as_tuple(std::forward<_Args>(__args)..., __alloc); } else { static_assert( @@ -52,7 +57,7 @@ __uses_allocator_construction_args(const _Alloc& __alloc, _Args&&... __args) noe } } -template <class _Pair, class _Alloc, class _Tuple1, class _Tuple2, __enable_if_t<__is_std_pair<_Pair>, int> = 0> +template <class _Pair, class _Alloc, class _Tuple1, class _Tuple2, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0> _LIBCPP_HIDE_FROM_ABI constexpr auto __uses_allocator_construction_args( const _Alloc& __alloc, piecewise_construct_t, _Tuple1&& __x, _Tuple2&& __y) noexcept { return std::make_tuple( @@ -71,12 +76,12 @@ _LIBCPP_HIDE_FROM_ABI constexpr auto __uses_allocator_construction_args( std::forward<_Tuple2>(__y))); } -template <class _Pair, class _Alloc, __enable_if_t<__is_std_pair<_Pair>, int> = 0> +template <class _Pair, class _Alloc, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0> _LIBCPP_HIDE_FROM_ABI constexpr auto __uses_allocator_construction_args(const _Alloc& __alloc) noexcept { return std::__uses_allocator_construction_args<_Pair>(__alloc, piecewise_construct, tuple<>{}, tuple<>{}); } -template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_std_pair<_Pair>, int> = 0> +template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0> _LIBCPP_HIDE_FROM_ABI constexpr auto __uses_allocator_construction_args(const _Alloc& __alloc, _Up&& __u, _Vp&& __v) noexcept { return std::__uses_allocator_construction_args<_Pair>( @@ -87,7 +92,7 @@ __uses_allocator_construction_args(const _Alloc& __alloc, _Up&& __u, _Vp&& __v) } # if _LIBCPP_STD_VER >= 23 -template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_std_pair<_Pair>, int> = 0> +template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0> _LIBCPP_HIDE_FROM_ABI constexpr auto __uses_allocator_construction_args(const _Alloc& __alloc, pair<_Up, _Vp>& __pair) noexcept { return std::__uses_allocator_construction_args<_Pair>( @@ -95,14 +100,14 @@ __uses_allocator_construction_args(const _Alloc& __alloc, pair<_Up, _Vp>& __pair } # endif -template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_std_pair<_Pair>, int> = 0> +template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0> _LIBCPP_HIDE_FROM_ABI constexpr auto __uses_allocator_construction_args(const _Alloc& __alloc, const pair<_Up, _Vp>& __pair) noexcept { return std::__uses_allocator_construction_args<_Pair>( __alloc, piecewise_construct, std::forward_as_tuple(__pair.first), std::forward_as_tuple(__pair.second)); } -template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_std_pair<_Pair>, int> = 0> +template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0> _LIBCPP_HIDE_FROM_ABI constexpr auto __uses_allocator_construction_args(const _Alloc& __alloc, pair<_Up, _Vp>&& __pair) noexcept { return std::__uses_allocator_construction_args<_Pair>( @@ -113,7 +118,7 @@ __uses_allocator_construction_args(const _Alloc& __alloc, pair<_Up, _Vp>&& __pai } # if _LIBCPP_STD_VER >= 23 -template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_std_pair<_Pair>, int> = 0> +template <class _Pair, class _Alloc, class _Up, class _Vp, __enable_if_t<__is_cv_std_pair<_Pair>, int> = 0> _LIBCPP_HIDE_FROM_ABI constexpr auto __uses_allocator_construction_args(const _Alloc& __alloc, const pair<_Up, _Vp>&& __pair) noexcept { return std::__uses_allocator_construction_args<_Pair>( @@ -122,6 +127,20 @@ __uses_allocator_construction_args(const _Alloc& __alloc, const pair<_Up, _Vp>&& std::forward_as_tuple(std::get<0>(std::move(__pair))), std::forward_as_tuple(std::get<1>(std::move(__pair)))); } + +template < class _Pair, + class _Alloc, + __pair_like _PairLike, + __enable_if_t<__is_cv_std_pair<_Pair> && !__is_specialization_of_subrange<remove_cvref_t<_PairLike>>::value, + int> = 0> +_LIBCPP_HIDE_FROM_ABI constexpr auto +__uses_allocator_construction_args(const _Alloc& __alloc, _PairLike&& __p) noexcept { + return std::__uses_allocator_construction_args<_Pair>( + __alloc, + piecewise_construct, + std::forward_as_tuple(std::get<0>(std::forward<_PairLike>(__p))), + std::forward_as_tuple(std::get<1>(std::forward<_PairLike>(__p)))); +} # endif namespace __uses_allocator_detail { @@ -139,23 +158,33 @@ template <class _Tp> inline constexpr bool __convertible_to_const_pair_ref = decltype(__uses_allocator_detail::__convertible_to_const_pair_ref_impl<_Tp>(0))::value; +# if _LIBCPP_STD_VER >= 23 +template <class _Tp, class _Up> +inline constexpr bool __uses_allocator_constraints = + __is_cv_std_pair<_Tp> && + (__is_specialization_of_subrange<remove_cvref_t<_Up>>::value || + (!__pair_like<_Up> && !__convertible_to_const_pair_ref<_Up>)); +# else +template <class _Tp, class _Up> +inline constexpr bool __uses_allocator_constraints = __is_cv_std_pair<_Tp> && !__convertible_to_const_pair_ref<_Up>; +# endif + } // namespace __uses_allocator_detail -template < - class _Pair, - class _Alloc, - class _Type, - __enable_if_t<__is_std_pair<_Pair> && !__uses_allocator_detail::__convertible_to_const_pair_ref<_Type>, int> = 0> +template < class _Pair, + class _Alloc, + class _Type, + __enable_if_t<__uses_allocator_detail::__uses_allocator_constraints<_Pair, _Type>, int> = 0> _LIBCPP_HIDE_FROM_ABI constexpr auto __uses_allocator_construction_args(const _Alloc& __alloc, _Type&& __value) noexcept; template <class _Type, class _Alloc, class... _Args> _LIBCPP_HIDE_FROM_ABI constexpr _Type __make_obj_using_allocator(const _Alloc& __alloc, _Args&&... __args); -template <class _Pair, - class _Alloc, - class _Type, - __enable_if_t<__is_std_pair<_Pair> && !__uses_allocator_detail::__convertible_to_const_pair_ref<_Type>, int>> +template < class _Pair, + class _Alloc, + class _Type, + __enable_if_t< __uses_allocator_detail::__uses_allocator_constraints<_Pair, _Type>, int>> _LIBCPP_HIDE_FROM_ABI constexpr auto __uses_allocator_construction_args(const _Alloc& __alloc, _Type&& __value) noexcept { struct __pair_constructor { diff --git a/contrib/llvm-project/libcxx/include/__memory/voidify.h b/contrib/llvm-project/libcxx/include/__memory/voidify.h index 39e10343f4ca..dbd083bd8c1e 100644 --- a/contrib/llvm-project/libcxx/include/__memory/voidify.h +++ b/contrib/llvm-project/libcxx/include/__memory/voidify.h @@ -22,7 +22,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <typename _Tp> _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void* __voidify(_Tp& __from) { // Cast away cv-qualifiers to allow modifying elements of a range through const iterators. - return const_cast<void*>(static_cast<const volatile void*>(_VSTD::addressof(__from))); + return const_cast<void*>(static_cast<const volatile void*>(std::addressof(__from))); } _LIBCPP_END_NAMESPACE_STD |
