diff options
author | hiddenpath <[email protected]> | 2024-02-21 23:16:42 +0300 |
---|---|---|
committer | hiddenpath <[email protected]> | 2024-02-21 23:33:25 +0300 |
commit | 9052eb5cc304b8da8885fc4e3364ebddc16945f3 (patch) | |
tree | 3c252f6161dd0745c7732d74c9304c000645ab47 /contrib/libs/cxxsupp/libcxx/include/__memory_resource | |
parent | f5eb715f103692e7c7536e13bef3f281fd78e5e7 (diff) |
Update libcxx to llvmorg-17.0.6
Update libcxx to llvmorg-17.0.6
c871ef572c71b4fef22d4a9e65bcebc57e625aea
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx/include/__memory_resource')
6 files changed, 60 insertions, 37 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory_resource/memory_resource.h b/contrib/libs/cxxsupp/libcxx/include/__memory_resource/memory_resource.h index 02fdd081cce..418f36dc9b3 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory_resource/memory_resource.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory_resource/memory_resource.h @@ -9,14 +9,16 @@ #ifndef _LIBCPP___MEMORY_RESOURCE_MEMORY_RESOURCE_H #define _LIBCPP___MEMORY_RESOURCE_MEMORY_RESOURCE_H +#include <__availability> #include <__config> +#include <__fwd/memory_resource.h> #include <cstddef> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -24,7 +26,7 @@ namespace pmr { // [mem.res.class] -class _LIBCPP_TYPE_VIS memory_resource { +class _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI memory_resource { static const size_t __max_align = alignof(max_align_t); public: @@ -51,25 +53,38 @@ private: // [mem.res.eq] -inline _LIBCPP_HIDE_FROM_ABI bool operator==(const memory_resource& __lhs, const memory_resource& __rhs) noexcept { +inline _LIBCPP_AVAILABILITY_PMR _LIBCPP_HIDE_FROM_ABI bool +operator==(const memory_resource& __lhs, const memory_resource& __rhs) noexcept { return &__lhs == &__rhs || __lhs.is_equal(__rhs); } -inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const memory_resource& __lhs, const memory_resource& __rhs) noexcept { +# if _LIBCPP_STD_VER <= 17 + +inline _LIBCPP_AVAILABILITY_PMR _LIBCPP_HIDE_FROM_ABI bool +operator!=(const memory_resource& __lhs, const memory_resource& __rhs) noexcept { return !(__lhs == __rhs); } +# endif + // [mem.res.global] -[[__gnu__::__returns_nonnull__]] _LIBCPP_FUNC_VIS memory_resource* get_default_resource() noexcept; -[[__gnu__::__returns_nonnull__]] _LIBCPP_FUNC_VIS memory_resource* set_default_resource(memory_resource*) noexcept; -[[using __gnu__: __returns_nonnull__, __const__]] _LIBCPP_FUNC_VIS memory_resource* new_delete_resource() noexcept; -[[using __gnu__: __returns_nonnull__, __const__]] _LIBCPP_FUNC_VIS memory_resource* null_memory_resource() noexcept; +[[__gnu__::__returns_nonnull__]] _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI memory_resource* +get_default_resource() noexcept; + +[[__gnu__::__returns_nonnull__]] _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI memory_resource* +set_default_resource(memory_resource*) noexcept; + +[[using __gnu__: __returns_nonnull__, __const__]] _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI memory_resource* +new_delete_resource() noexcept; + +[[using __gnu__: __returns_nonnull__, __const__]] _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI memory_resource* +null_memory_resource() noexcept; } // namespace pmr _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 #endif // _LIBCPP___MEMORY_RESOURCE_MEMORY_RESOURCE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory_resource/monotonic_buffer_resource.h b/contrib/libs/cxxsupp/libcxx/include/__memory_resource/monotonic_buffer_resource.h index 5b0d2462582..0c83f1ebc8d 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory_resource/monotonic_buffer_resource.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory_resource/monotonic_buffer_resource.h @@ -9,6 +9,7 @@ #ifndef _LIBCPP___MEMORY_RESOURCE_MONOTONIC_BUFFER_RESOURCE_H #define _LIBCPP___MEMORY_RESOURCE_MONOTONIC_BUFFER_RESOURCE_H +#include <__availability> #include <__config> #include <__memory/addressof.h> #include <__memory_resource/memory_resource.h> @@ -18,7 +19,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -26,7 +27,7 @@ namespace pmr { // [mem.res.monotonic.buffer] -class _LIBCPP_TYPE_VIS monotonic_buffer_resource : public memory_resource { +class _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI monotonic_buffer_resource : public memory_resource { static const size_t __default_buffer_capacity = 1024; static const size_t __default_buffer_alignment = 16; @@ -35,7 +36,9 @@ class _LIBCPP_TYPE_VIS monotonic_buffer_resource : public memory_resource { char* __start_; char* __cur_; size_t __align_; - size_t __allocation_size() { return (reinterpret_cast<char*>(this) - __start_) + sizeof(*this); } + _LIBCPP_HIDE_FROM_ABI size_t __allocation_size() { + return (reinterpret_cast<char*>(this) - __start_) + sizeof(*this); + } void* __try_allocate_from_chunk(size_t, size_t); }; @@ -115,6 +118,6 @@ private: _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 #endif // _LIBCPP___MEMORY_RESOURCE_MONOTONIC_BUFFER_RESOURCE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory_resource/polymorphic_allocator.h b/contrib/libs/cxxsupp/libcxx/include/__memory_resource/polymorphic_allocator.h index f7b9a0b408c..8fcce65ad2f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory_resource/polymorphic_allocator.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory_resource/polymorphic_allocator.h @@ -10,6 +10,7 @@ #define _LIBCPP___MEMORY_RESOURCE_POLYMORPHIC_ALLOCATOR_H #include <__assert> +#include <__availability> #include <__config> #include <__memory_resource/memory_resource.h> #include <__utility/exception_guard.h> @@ -26,7 +27,7 @@ _LIBCPP_PUSH_MACROS #include <__undef_macros> -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -39,7 +40,7 @@ template <class _ValueType = byte # endif > -class _LIBCPP_TEMPLATE_VIS polymorphic_allocator { +class _LIBCPP_AVAILABILITY_PMR _LIBCPP_TEMPLATE_VIS polymorphic_allocator { public: using value_type = _ValueType; @@ -50,7 +51,7 @@ public: _LIBCPP_HIDE_FROM_ABI polymorphic_allocator(memory_resource* __r) noexcept : __res_(__r) {} - polymorphic_allocator(const polymorphic_allocator&) = default; + _LIBCPP_HIDE_FROM_ABI polymorphic_allocator(const polymorphic_allocator&) = default; template <class _Tp> _LIBCPP_HIDE_FROM_ABI polymorphic_allocator(const polymorphic_allocator<_Tp>& __other) noexcept @@ -68,35 +69,35 @@ public: } _LIBCPP_HIDE_FROM_ABI void deallocate(_ValueType* __p, size_t __n) { - _LIBCPP_ASSERT(__n <= __max_size(), "deallocate called for size which exceeds max_size()"); + _LIBCPP_ASSERT_UNCATEGORIZED(__n <= __max_size(), "deallocate called for size which exceeds max_size()"); __res_->deallocate(__p, __n * sizeof(_ValueType), alignof(_ValueType)); } # if _LIBCPP_STD_VER >= 20 - [[nodiscard]] [[using __gnu__: __alloc_size__(2), __alloc_align__(3)]] void* + [[nodiscard]] [[using __gnu__: __alloc_size__(2), __alloc_align__(3)]] _LIBCPP_HIDE_FROM_ABI void* allocate_bytes(size_t __nbytes, size_t __alignment = alignof(max_align_t)) { return __res_->allocate(__nbytes, __alignment); } - void deallocate_bytes(void* __ptr, size_t __nbytes, size_t __alignment = alignof(max_align_t)) { + _LIBCPP_HIDE_FROM_ABI void deallocate_bytes(void* __ptr, size_t __nbytes, size_t __alignment = alignof(max_align_t)) { __res_->deallocate(__ptr, __nbytes, __alignment); } template <class _Type> - [[nodiscard]] _Type* allocate_object(size_t __n = 1) { + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _Type* allocate_object(size_t __n = 1) { if (numeric_limits<size_t>::max() / sizeof(_Type) < __n) std::__throw_bad_array_new_length(); return static_cast<_Type*>(allocate_bytes(__n * sizeof(_Type), alignof(_Type))); } template <class _Type> - void deallocate_object(_Type* __ptr, size_t __n = 1) { + _LIBCPP_HIDE_FROM_ABI void deallocate_object(_Type* __ptr, size_t __n = 1) { deallocate_bytes(__ptr, __n * sizeof(_Type), alignof(_Type)); } template <class _Type, class... _CtorArgs> - [[nodiscard]] _Type* new_object(_CtorArgs&&... __ctor_args) { + [[nodiscard]] _LIBCPP_HIDE_FROM_ABI _Type* new_object(_CtorArgs&&... __ctor_args) { _Type* __ptr = allocate_object<_Type>(); auto __guard = std::__make_exception_guard([&] { deallocate_object(__ptr); }); construct(__ptr, std::forward<_CtorArgs>(__ctor_args)...); @@ -105,7 +106,7 @@ public: } template <class _Type> - void delete_object(_Type* __ptr) { + _LIBCPP_HIDE_FROM_ABI void delete_object(_Type* __ptr) { destroy(__ptr); deallocate_object(__ptr); } @@ -207,17 +208,21 @@ operator==(const polymorphic_allocator<_Tp>& __lhs, const polymorphic_allocator< return *__lhs.resource() == *__rhs.resource(); } +# if _LIBCPP_STD_VER <= 17 + template <class _Tp, class _Up> inline _LIBCPP_HIDE_FROM_ABI bool operator!=(const polymorphic_allocator<_Tp>& __lhs, const polymorphic_allocator<_Up>& __rhs) noexcept { return !(__lhs == __rhs); } +# endif + } // namespace pmr _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 _LIBCPP_POP_MACROS diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory_resource/pool_options.h b/contrib/libs/cxxsupp/libcxx/include/__memory_resource/pool_options.h index 11585a0e3bc..442959836c7 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory_resource/pool_options.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory_resource/pool_options.h @@ -16,7 +16,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -24,7 +24,7 @@ namespace pmr { // [mem.res.pool.options] -struct _LIBCPP_TYPE_VIS pool_options { +struct _LIBCPP_EXPORTED_FROM_ABI pool_options { size_t max_blocks_per_chunk = 0; size_t largest_required_pool_block = 0; }; @@ -33,6 +33,6 @@ struct _LIBCPP_TYPE_VIS pool_options { _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 #endif // _LIBCPP___MEMORY_RESOURCE_POOL_OPTIONS_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory_resource/synchronized_pool_resource.h b/contrib/libs/cxxsupp/libcxx/include/__memory_resource/synchronized_pool_resource.h index 1877147ca16..b261fb0b194 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory_resource/synchronized_pool_resource.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory_resource/synchronized_pool_resource.h @@ -9,20 +9,19 @@ #ifndef _LIBCPP___MEMORY_RESOURCE_SYNCHRONIZED_POOL_RESOURCE_H #define _LIBCPP___MEMORY_RESOURCE_SYNCHRONIZED_POOL_RESOURCE_H +#include <__availability> #include <__config> #include <__memory_resource/memory_resource.h> #include <__memory_resource/pool_options.h> #include <__memory_resource/unsynchronized_pool_resource.h> #include <cstddef> -#if !defined(_LIBCPP_HAS_NO_THREADS) -# include <mutex> -#endif +#include <mutex> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -30,7 +29,7 @@ namespace pmr { // [mem.res.pool.overview] -class _LIBCPP_TYPE_VIS synchronized_pool_resource : public memory_resource { +class _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI synchronized_pool_resource : public memory_resource { public: _LIBCPP_HIDE_FROM_ABI synchronized_pool_resource(const pool_options& __opts, memory_resource* __upstream) : __unsync_(__opts, __upstream) {} @@ -46,7 +45,7 @@ public: synchronized_pool_resource(const synchronized_pool_resource&) = delete; - ~synchronized_pool_resource() override = default; + _LIBCPP_HIDE_FROM_ABI_VIRTUAL ~synchronized_pool_resource() override = default; synchronized_pool_resource& operator=(const synchronized_pool_resource&) = delete; @@ -89,6 +88,6 @@ private: _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 #endif // _LIBCPP___MEMORY_RESOURCE_SYNCHRONIZED_POOL_RESOURCE_H diff --git a/contrib/libs/cxxsupp/libcxx/include/__memory_resource/unsynchronized_pool_resource.h b/contrib/libs/cxxsupp/libcxx/include/__memory_resource/unsynchronized_pool_resource.h index 91d38aac0df..81d5f9ec4da 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__memory_resource/unsynchronized_pool_resource.h +++ b/contrib/libs/cxxsupp/libcxx/include/__memory_resource/unsynchronized_pool_resource.h @@ -9,6 +9,7 @@ #ifndef _LIBCPP___MEMORY_RESOURCE_UNSYNCHRONIZED_POOL_RESOURCE_H #define _LIBCPP___MEMORY_RESOURCE_UNSYNCHRONIZED_POOL_RESOURCE_H +#include <__availability> #include <__config> #include <__memory_resource/memory_resource.h> #include <__memory_resource/pool_options.h> @@ -19,7 +20,7 @@ # pragma GCC system_header #endif -#if _LIBCPP_STD_VER > 14 +#if _LIBCPP_STD_VER >= 17 _LIBCPP_BEGIN_NAMESPACE_STD @@ -27,7 +28,7 @@ namespace pmr { // [mem.res.pool.overview] -class _LIBCPP_TYPE_VIS unsynchronized_pool_resource : public memory_resource { +class _LIBCPP_AVAILABILITY_PMR _LIBCPP_EXPORTED_FROM_ABI unsynchronized_pool_resource : public memory_resource { class __fixed_pool; class __adhoc_pool { @@ -101,6 +102,6 @@ private: _LIBCPP_END_NAMESPACE_STD -#endif // _LIBCPP_STD_VER > 14 +#endif // _LIBCPP_STD_VER >= 17 #endif // _LIBCPP___MEMORY_RESOURCE_UNSYNCHRONIZED_POOL_RESOURCE_H |