diff --git a/libcxx/docs/ReleaseNotes.rst b/libcxx/docs/ReleaseNotes.rst --- a/libcxx/docs/ReleaseNotes.rst +++ b/libcxx/docs/ReleaseNotes.rst @@ -44,6 +44,8 @@ - P0591R4 - Utility functions to implement uses-allocator construction - P2291R3 - Add Constexpr Modifiers to Functions ``to_chars`` and ``from_chars`` for Integral Types in ```` Header +- P0220R1 - Adopt Library Fundamentals V1 TS Components for C++17 +- P0482R6 - char8_t: A type for UTF-8 characters and strings Improvements and New Features ----------------------------- diff --git a/libcxx/docs/Status/Cxx17Issues.csv b/libcxx/docs/Status/Cxx17Issues.csv --- a/libcxx/docs/Status/Cxx17Issues.csv +++ b/libcxx/docs/Status/Cxx17Issues.csv @@ -176,7 +176,7 @@ "`2720 `__","permissions function incorrectly specified for symlinks","Oulu","|Complete|","" "`2721 `__","remove_all has incorrect post conditions","Oulu","|Complete|","" "`2723 `__","Do directory_iterator and recursive_directory_iterator become the end iterator upon error?","Oulu","|Complete|","" -"`2724 `__","The protected virtual member functions of memory_resource should be private","Oulu","","" +"`2724 `__","The protected virtual member functions of memory_resource should be private","Oulu","|Complete|","16.0" "`2725 `__","filesystem::exists(const path&, error_code&) error reporting","Oulu","|Complete|","" "`2726 `__","``[recursive_]directory_iterator::increment(error_code&)`` is underspecified","Oulu","|Complete|","" "`2727 `__","Parallel algorithms with constexpr specifier","Oulu","","" diff --git a/libcxx/docs/Status/Cxx17Papers.csv b/libcxx/docs/Status/Cxx17Papers.csv --- a/libcxx/docs/Status/Cxx17Papers.csv +++ b/libcxx/docs/Status/Cxx17Papers.csv @@ -27,7 +27,7 @@ "","","","","","" "`P0024R2 `__","LWG","The Parallelism TS Should be Standardized","Jacksonville","","" "`P0226R1 `__","LWG","Mathematical Special Functions for C++17","Jacksonville","","" -"`P0220R1 `__","LWG","Adopt Library Fundamentals V1 TS Components for C++17","Jacksonville","|In Progress|","" +"`P0220R1 `__","LWG","Adopt Library Fundamentals V1 TS Components for C++17","Jacksonville","|Complete|","16.0" "`P0218R1 `__","LWG","Adopt the File System TS for C++17","Jacksonville","|Complete|","7.0" "`P0033R1 `__","LWG","Re-enabling shared_from_this","Jacksonville","|Complete|","3.9" "`P0005R4 `__","LWG","Adopt not_fn from Library Fundamentals 2 for C++17","Jacksonville","|Complete|","3.9" diff --git a/libcxx/docs/Status/Cxx20.rst b/libcxx/docs/Status/Cxx20.rst --- a/libcxx/docs/Status/Cxx20.rst +++ b/libcxx/docs/Status/Cxx20.rst @@ -50,9 +50,6 @@ .. [#note-P0883.1] P0883: shared_ptr and floating-point changes weren't applied as they themselves aren't implemented yet. .. [#note-P0883.2] P0883: ``ATOMIC_FLAG_INIT`` was marked deprecated in version 14.0, but was undeprecated with the implementation of LWG3659 in version 15.0. .. [#note-P2231] P2231: Optional is complete. The changes to variant haven't been implemented yet. - .. [#note-P0482] P0482: Declarations of ``std::pmr::u8string`` and ``std::hash`` are blocked pending implementation - of polymorphic allocator support from P0220. - .. _issues-status-cxx20: diff --git a/libcxx/docs/Status/Cxx20Issues.csv b/libcxx/docs/Status/Cxx20Issues.csv --- a/libcxx/docs/Status/Cxx20Issues.csv +++ b/libcxx/docs/Status/Cxx20Issues.csv @@ -9,7 +9,7 @@ "`2940 `__","``result_of``\ specification also needs a little cleanup","Toronto","|Nothing To Do|","" "`2942 `__","LWG 2873's resolution missed ``weak_ptr::owner_before``\ ","Toronto","|Complete|","" "`2954 `__","Specialization of the convenience variable templates should be prohibited","Toronto","|Complete|","" -"`2961 `__","Bad postcondition for ``set_default_resource``\ ","Toronto","","" +"`2961 `__","Bad postcondition for ``set_default_resource``\ ","Toronto","|Complete|","16.0" "`2966 `__","Incomplete resolution of US 74","Toronto","|Nothing To Do|","" "`2974 `__","Diagnose out of bounds ``tuple_element/variant_alternative``\ ","Toronto","|Complete|","" "","","","","" @@ -29,7 +29,7 @@ "`2972 `__","What is ``is_trivially_destructible_v``\ ?","Albuquerque","|Complete|","" "`2976 `__","Dangling uses_allocator specialization for packaged_task","Albuquerque","|Complete|","" "`2977 `__","unordered_meow::merge() has incorrect Throws: clause","Albuquerque","|Nothing To Do|","" -"`2978 `__","Hash support for pmr::string and friends","Albuquerque","","" +"`2978 `__","Hash support for pmr::string and friends","Albuquerque","|Complete|","16.0" "`2979 `__","aligned_union should require complete object types","Albuquerque","|Complete|","" "`2980 `__","Cannot compare_exchange empty pointers","Albuquerque","","" "`2981 `__","Remove redundant deduction guides from standard library","Albuquerque","|Nothing To Do|","" @@ -50,7 +50,7 @@ "`2969 `__","``polymorphic_allocator::construct()``\ shouldn't pass ``resource()``\ ","Jacksonville","|Complete|","" "`2975 `__","Missing case for ``pair``\ construction in scoped and polymorphic allocators","Jacksonville","","" "`2989 `__","``path``\ 's stream insertion operator lets you insert everything under the sun","Jacksonville","|Complete|","" -"`3000 `__","``monotonic_memory_resource::do_is_equal``\ uses ``dynamic_cast``\ unnecessarily","Jacksonville","","" +"`3000 `__","``monotonic_memory_resource::do_is_equal``\ uses ``dynamic_cast``\ unnecessarily","Jacksonville","|Complete|","16.0" "`3002 `__","[networking.ts] ``basic_socket_acceptor::is_open()``\ isn't ``noexcept``\ ","Jacksonville","","" "`3004 `__","|sect|\ [string.capacity] and |sect|\ [vector.capacity] should specify time complexity for ``capacity()``\ ","Jacksonville","|Nothing To Do|","" "`3005 `__","Destruction order of arrays by ``make_shared/allocate_shared``\ only recommended?","Jacksonville","","" @@ -107,7 +107,7 @@ "`3022 `__","``is_convertible``\ may lead to ODR","San Diego","Resolved by 1285R0","" "`3025 `__","Map-like container deduction guides should use ``pair``\ , not ``pair``\ ","San Diego","|Complete|","" "`3031 `__","Algorithms and predicates with non-const reference arguments","San Diego","","" -"`3037 `__","``polymorphic_allocator``\ and incomplete types","San Diego","","" +"`3037 `__","``polymorphic_allocator``\ and incomplete types","San Diego","|Complete|","16.0" "`3038 `__","``polymorphic_allocator::allocate``\ should not allow integer overflow to create vulnerabilities","San Diego","|Complete|","14.0" "`3054 `__","``uninitialized_copy``\ appears to not be able to meet its exception-safety guarantee","San Diego","|Nothing To Do|","" "`3065 `__","LWG 2989 missed that all ``path``\ 's other operators should be hidden friends as well","San Diego","|Complete|","" diff --git a/libcxx/docs/Status/Cxx20Papers.csv b/libcxx/docs/Status/Cxx20Papers.csv --- a/libcxx/docs/Status/Cxx20Papers.csv +++ b/libcxx/docs/Status/Cxx20Papers.csv @@ -53,7 +53,7 @@ "`P0318R1 `__","LWG","unwrap_ref_decay and unwrap_reference","San Diego","|Complete|","8.0" "`P0356R5 `__","LWG","Simplified partial function application","San Diego","|Complete|","13.0" "`P0357R3 `__","LWG","reference_wrapper for incomplete types","San Diego","|Complete|","8.0" -"`P0482R6 `__","CWG","char8_t: A type for UTF-8 characters and strings","San Diego","|Partial| [#note-P0482]_","16.0" +"`P0482R6 `__","CWG","char8_t: A type for UTF-8 characters and strings","San Diego","|Complete|","16.0" "`P0487R1 `__","LWG","Fixing ``operator>>(basic_istream&, CharT*)``\ (LWG 2499)","San Diego","|Complete|","8.0" "`P0591R4 `__","LWG","Utility functions to implement uses-allocator construction","San Diego","|Partial| [#note-P0591]_","" "`P0595R2 `__","CWG","std::is_constant_evaluated()","San Diego","|Complete|","9.0" diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt --- a/libcxx/include/CMakeLists.txt +++ b/libcxx/include/CMakeLists.txt @@ -341,8 +341,10 @@ __fwd/array.h __fwd/get.h __fwd/hash.h + __fwd/memory_resource.h __fwd/pair.h __fwd/span.h + __fwd/string.h __fwd/string_view.h __fwd/tuple.h __hash_table diff --git a/libcxx/include/__availability b/libcxx/include/__availability --- a/libcxx/include/__availability +++ b/libcxx/include/__availability @@ -172,6 +172,8 @@ // be avoided. // # define _LIBCPP_HAS_NO_VERBOSE_ABORT_IN_LIBRARY +# define _LIBCPP_AVAILABILITY_MEMORY_RESOURCE + #elif defined(__APPLE__) # define _LIBCPP_AVAILABILITY_SHARED_MUTEX \ @@ -273,6 +275,8 @@ # define _LIBCPP_HAS_NO_VERBOSE_ABORT_IN_LIBRARY +# define _LIBCPP_AVAILABILITY_MEMORY_RESOURCE __attribute__((__unavailable__)) + #else // ...New vendors can add availability markup here... diff --git a/libcxx/include/__fwd/memory_resource.h b/libcxx/include/__fwd/memory_resource.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__fwd/memory_resource.h @@ -0,0 +1,27 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___FWD_MEMORY_RESOURCE_H +#define _LIBCPP___FWD_MEMORY_RESOURCE_H + +#include <__config> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +namespace pmr { +template +class _LIBCPP_TEMPLATE_VIS polymorphic_allocator; +} // namespace pmr + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___FWD_MEMORY_RESOURCE_H diff --git a/libcxx/include/__fwd/string.h b/libcxx/include/__fwd/string.h new file mode 100644 --- /dev/null +++ b/libcxx/include/__fwd/string.h @@ -0,0 +1,110 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP___FWD_STRING_H +#define _LIBCPP___FWD_STRING_H + +#include <__config> +#include <__fwd/memory_resource.h> + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +# pragma GCC system_header +#endif + +_LIBCPP_BEGIN_NAMESPACE_STD + +template +struct _LIBCPP_TEMPLATE_VIS char_traits; +template <> +struct char_traits; + +#ifndef _LIBCPP_HAS_NO_CHAR8_T +template <> +struct char_traits; +#endif + +template <> +struct char_traits; +template <> +struct char_traits; + +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +template <> +struct char_traits; +#endif + +template +class _LIBCPP_TEMPLATE_VIS allocator; + +template , class _Allocator = allocator<_CharT> > +class basic_string; + +using string = basic_string; + +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +using wstring = basic_string; +#endif + +#ifndef _LIBCPP_HAS_NO_CHAR8_T +using u8string = basic_string; +#endif + +using u16string = basic_string; +using u32string = basic_string; + +#if _LIBCPP_STD_VER >= 17 + +namespace pmr { +template > +using basic_string = std::basic_string<_CharT, _Traits, polymorphic_allocator<_CharT>>; + +using string = basic_string; + +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +using wstring = basic_string; +# endif + +# ifndef _LIBCPP_HAS_NO_CHAR8_T +using u8string = basic_string; +# endif + +using u16string = basic_string; +using u32string = basic_string; + +} // namespace pmr + +#endif // _LIBCPP_STD_VER >= 17 + +// clang-format off +template +class _LIBCPP_PREFERRED_NAME(string) +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS + _LIBCPP_PREFERRED_NAME(wstring) +#endif +#ifndef _LIBCPP_HAS_NO_CHAR8_T + _LIBCPP_PREFERRED_NAME(u8string) +#endif + _LIBCPP_PREFERRED_NAME(u16string) + _LIBCPP_PREFERRED_NAME(u32string) +#if _LIBCPP_STD_VER >= 17 + _LIBCPP_PREFERRED_NAME(pmr::string) +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS + _LIBCPP_PREFERRED_NAME(pmr::wstring) +# endif +# ifndef _LIBCPP_HAS_NO_CHAR8_T + _LIBCPP_PREFERRED_NAME(pmr::u8string) +# endif + _LIBCPP_PREFERRED_NAME(pmr::u16string) + _LIBCPP_PREFERRED_NAME(pmr::u32string) +#endif + basic_string; +// clang-format on + +_LIBCPP_END_NAMESPACE_STD + +#endif // _LIBCPP___FWD_STRING_H diff --git a/libcxx/include/__fwd/string_view.h b/libcxx/include/__fwd/string_view.h --- a/libcxx/include/__fwd/string_view.h +++ b/libcxx/include/__fwd/string_view.h @@ -32,6 +32,19 @@ typedef basic_string_view wstring_view; #endif +// clang-format off +template +class _LIBCPP_PREFERRED_NAME(string_view) +#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS + _LIBCPP_PREFERRED_NAME(wstring_view) +#endif +#ifndef _LIBCPP_HAS_NO_CHAR8_T + _LIBCPP_PREFERRED_NAME(u8string_view) +#endif + _LIBCPP_PREFERRED_NAME(u16string_view) + _LIBCPP_PREFERRED_NAME(u32string_view) + basic_string_view; +// clang-format on _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP___FWD_STRING_VIEW_H diff --git a/libcxx/include/__memory_resource/memory_resource.h b/libcxx/include/__memory_resource/memory_resource.h --- a/libcxx/include/__memory_resource/memory_resource.h +++ b/libcxx/include/__memory_resource/memory_resource.h @@ -26,17 +26,19 @@ _LIBCPP_DIAGNOSTIC_PUSH _LIBCPP_CLANG_DIAGNOSTIC_IGNORED("-Wweak-vtables") // TODO: move destructor into the dylib -class _LIBCPP_TYPE_VIS memory_resource { +class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_MEMORY_RESOURCE memory_resource { static const size_t __max_align = alignof(max_align_t); public: virtual ~memory_resource() = default; - _LIBCPP_HIDE_FROM_ABI void* allocate(size_t __bytes, size_t __align = __max_align) { + [[using __gnu__: __returns_nonnull__, __alloc_size__(2), __alloc_align__(3)]] _LIBCPP_HIDE_FROM_ABI void* + allocate(size_t __bytes, size_t __align = __max_align) { return do_allocate(__bytes, __align); } - _LIBCPP_HIDE_FROM_ABI void deallocate(void* __p, size_t __bytes, size_t __align = __max_align) { + [[__gnu__::__nonnull__]] _LIBCPP_HIDE_FROM_ABI void + deallocate(void* __p, size_t __bytes, size_t __align = __max_align) { do_deallocate(__p, __bytes, __align); } @@ -61,13 +63,14 @@ // [mem.res.global] -_LIBCPP_FUNC_VIS memory_resource* get_default_resource() noexcept; - -_LIBCPP_FUNC_VIS memory_resource* set_default_resource(memory_resource*) noexcept; - -_LIBCPP_FUNC_VIS memory_resource* new_delete_resource() noexcept; - -_LIBCPP_FUNC_VIS memory_resource* null_memory_resource() noexcept; +[[__gnu__::__returns_nonnull__]] _LIBCPP_AVAILABILITY_MEMORY_RESOURCE _LIBCPP_FUNC_VIS memory_resource* +get_default_resource() noexcept; +[[__gnu__::__returns_nonnull__]] _LIBCPP_AVAILABILITY_MEMORY_RESOURCE _LIBCPP_FUNC_VIS memory_resource* +set_default_resource(memory_resource*) noexcept; +[[using __gnu__: __returns_nonnull__, __const__]] _LIBCPP_AVAILABILITY_MEMORY_RESOURCE _LIBCPP_FUNC_VIS memory_resource* +new_delete_resource() noexcept; +[[using __gnu__: __returns_nonnull__, __const__]] _LIBCPP_AVAILABILITY_MEMORY_RESOURCE _LIBCPP_FUNC_VIS memory_resource* +null_memory_resource() noexcept; } // namespace pmr diff --git a/libcxx/include/__memory_resource/monotonic_buffer_resource.h b/libcxx/include/__memory_resource/monotonic_buffer_resource.h --- a/libcxx/include/__memory_resource/monotonic_buffer_resource.h +++ b/libcxx/include/__memory_resource/monotonic_buffer_resource.h @@ -26,7 +26,7 @@ // [mem.res.monotonic.buffer] -class _LIBCPP_TYPE_VIS monotonic_buffer_resource : public memory_resource { +class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_MEMORY_RESOURCE monotonic_buffer_resource : public memory_resource { static const size_t __default_buffer_capacity = 1024; static const size_t __default_buffer_alignment = 16; diff --git a/libcxx/include/__memory_resource/polymorphic_allocator.h b/libcxx/include/__memory_resource/polymorphic_allocator.h --- a/libcxx/include/__memory_resource/polymorphic_allocator.h +++ b/libcxx/include/__memory_resource/polymorphic_allocator.h @@ -34,7 +34,7 @@ // [mem.poly.allocator.class] template -class _LIBCPP_TEMPLATE_VIS polymorphic_allocator { +class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_MEMORY_RESOURCE polymorphic_allocator { public: using value_type = _ValueType; diff --git a/libcxx/include/__memory_resource/synchronized_pool_resource.h b/libcxx/include/__memory_resource/synchronized_pool_resource.h --- a/libcxx/include/__memory_resource/synchronized_pool_resource.h +++ b/libcxx/include/__memory_resource/synchronized_pool_resource.h @@ -30,7 +30,7 @@ // [mem.res.pool.overview] -class _LIBCPP_TYPE_VIS synchronized_pool_resource : public memory_resource { +class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_MEMORY_RESOURCE synchronized_pool_resource : public memory_resource { public: _LIBCPP_HIDE_FROM_ABI synchronized_pool_resource(const pool_options& __opts, memory_resource* __upstream) : __unsync_(__opts, __upstream) {} diff --git a/libcxx/include/__memory_resource/unsynchronized_pool_resource.h b/libcxx/include/__memory_resource/unsynchronized_pool_resource.h --- a/libcxx/include/__memory_resource/unsynchronized_pool_resource.h +++ b/libcxx/include/__memory_resource/unsynchronized_pool_resource.h @@ -27,7 +27,7 @@ // [mem.res.pool.overview] -class _LIBCPP_TYPE_VIS unsynchronized_pool_resource : public memory_resource { +class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_MEMORY_RESOURCE unsynchronized_pool_resource : public memory_resource { class __fixed_pool; class __adhoc_pool { @@ -78,7 +78,7 @@ _LIBCPP_HIDE_FROM_ABI memory_resource* upstream_resource() const { return __res_; } - pool_options options() const; + [[__gnu__::__pure__]] pool_options options() const; protected: void* do_allocate(size_t __bytes, size_t __align) override; // key function diff --git a/libcxx/include/iosfwd b/libcxx/include/iosfwd --- a/libcxx/include/iosfwd +++ b/libcxx/include/iosfwd @@ -96,6 +96,7 @@ #include <__assert> // all public C++ headers provide the assertion handler #include <__config> +#include <__fwd/string.h> #include <__mbstate_t.h> #include @@ -107,19 +108,6 @@ class _LIBCPP_TYPE_VIS ios_base; -template struct _LIBCPP_TEMPLATE_VIS char_traits; -template<> struct char_traits; -#ifndef _LIBCPP_HAS_NO_CHAR8_T -template<> struct char_traits; -#endif -template<> struct char_traits; -template<> struct char_traits; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -template<> struct char_traits; -#endif - -template class _LIBCPP_TEMPLATE_VIS allocator; - template > class _LIBCPP_TEMPLATE_VIS basic_ios; @@ -242,18 +230,6 @@ typedef long long streamoff; // for char_traits in #endif -template - class _Traits = char_traits<_CharT>, - class _Allocator = allocator<_CharT> > - class _LIBCPP_TEMPLATE_VIS basic_string; -typedef basic_string, allocator > string; -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS -typedef basic_string, allocator > wstring; -#endif - -template - class _LIBCPP_PREFERRED_NAME(string) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wstring)) basic_string; - // Include other forward declarations here template > class _LIBCPP_TEMPLATE_VIS vector; diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in --- a/libcxx/include/module.modulemap.in +++ b/libcxx/include/module.modulemap.in @@ -887,6 +887,7 @@ export * module __memory_resource { + module memory_resource_fwd { private header "__fwd/memory_resource.h" } module memory_resource { private header "__memory_resource/memory_resource.h" } module monotonic_buffer_resource { private header "__memory_resource/monotonic_buffer_resource.h" } module polymorphic_allocator { private header "__memory_resource/polymorphic_allocator.h" } @@ -1117,6 +1118,7 @@ module __string { module char_traits { private header "__string/char_traits.h" } module extern_template_lists { private header "__string/extern_template_lists.h" } + module string_fwd { private header "__fwd/string.h" } } export * } diff --git a/libcxx/include/string b/libcxx/include/string --- a/libcxx/include/string +++ b/libcxx/include/string @@ -539,6 +539,7 @@ #include <__format/enable_insertable.h> #include <__functional/hash.h> #include <__functional/unary_function.h> +#include <__fwd/string.h> #include <__ios/fpos.h> #include <__iterator/distance.h> #include <__iterator/iterator_traits.h> @@ -565,7 +566,6 @@ #include // EOF #include #include -#include #include #include #include @@ -655,14 +655,7 @@ struct __uninitialized_size_tag {}; template -class - _LIBCPP_TEMPLATE_VIS -#ifndef _LIBCPP_HAS_NO_CHAR8_T - _LIBCPP_PREFERRED_NAME(u8string) -#endif - _LIBCPP_PREFERRED_NAME(u16string) - _LIBCPP_PREFERRED_NAME(u32string) - basic_string +class basic_string { public: typedef basic_string __self; @@ -4674,20 +4667,6 @@ _LIBCPP_END_NAMESPACE_STD -#if _LIBCPP_STD_VER > 14 -_LIBCPP_BEGIN_NAMESPACE_STD -namespace pmr { -template > -using basic_string = std::basic_string<_CharT, _TraitsT, polymorphic_allocator<_CharT>>; - -using string = basic_string; -using u16string = basic_string; -using u32string = basic_string; -using wstring = basic_string; -} // namespace pmr -_LIBCPP_END_NAMESPACE_STD -#endif - _LIBCPP_POP_MACROS #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20 diff --git a/libcxx/include/string_view b/libcxx/include/string_view --- a/libcxx/include/string_view +++ b/libcxx/include/string_view @@ -256,15 +256,7 @@ } template -class - _LIBCPP_PREFERRED_NAME(string_view) -#ifndef _LIBCPP_HAS_NO_CHAR8_T - _LIBCPP_PREFERRED_NAME(u8string_view) -#endif - _LIBCPP_PREFERRED_NAME(u16string_view) - _LIBCPP_PREFERRED_NAME(u32string_view) - _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wstring_view)) - basic_string_view { +class basic_string_view { public: // types typedef _Traits traits_type; diff --git a/libcxx/test/libcxx/mem/mem.res/availability.verify.cpp b/libcxx/test/libcxx/mem/mem.res/availability.verify.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/libcxx/mem/mem.res/availability.verify.cpp @@ -0,0 +1,24 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++03, c++11, c++14 +// REQUIRES: use_system_cxx_lib && (target={{.+}}-apple-macosx10.{{9|10|11|12|13|14|15}} || target={{.+}}-apple-macosx{{11.0|12.0}}) + +#include + +void f() { + [[maybe_unused]] std::pmr::polymorphic_allocator poly; // expected-error {{is unavailable}} + [[maybe_unused]] std::pmr::memory_resource* res; // expected-error {{is unavailable}} + [[maybe_unused]] std::pmr::synchronized_pool_resource r1; // expected-error {{is unavailable}} + [[maybe_unused]] std::pmr::monotonic_buffer_resource r2; // expected-error {{is unavailable}} + [[maybe_unused]] std::pmr::unsynchronized_pool_resource r3; // expected-error {{is unavailable}} + (void)std::pmr::get_default_resource(); // expected-error {{is unavailable}} + (void)std::pmr::set_default_resource(nullptr); // expected-error {{is unavailable}} + (void)std::pmr::new_delete_resource(); // expected-error {{is unavailable}} + (void)std::pmr::null_memory_resource(); // expected-error {{is unavailable}} +} diff --git a/libcxx/test/libcxx/private_headers.verify.cpp b/libcxx/test/libcxx/private_headers.verify.cpp --- a/libcxx/test/libcxx/private_headers.verify.cpp +++ b/libcxx/test/libcxx/private_headers.verify.cpp @@ -373,8 +373,10 @@ #include <__fwd/array.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/array.h'}} #include <__fwd/get.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/get.h'}} #include <__fwd/hash.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/hash.h'}} +#include <__fwd/memory_resource.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/memory_resource.h'}} #include <__fwd/pair.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/pair.h'}} #include <__fwd/span.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/span.h'}} +#include <__fwd/string.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/string.h'}} #include <__fwd/string_view.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/string_view.h'}} #include <__fwd/tuple.h> // expected-error@*:* {{use of private header from outside its module: '__fwd/tuple.h'}} #include <__ios/fpos.h> // expected-error@*:* {{use of private header from outside its module: '__ios/fpos.h'}}