-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[libc++] Remove experimental pmr headers now shipped in mainline #73172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[libc++] Remove experimental pmr headers now shipped in mainline #73172
Conversation
@llvm/pr-subscribers-libcxx Author: Louis Dionne (ldionne) ChangesSeveral experimental headers around std::pmr have been slated for removal for a while now. This patch actually performs the removal and cleanups from the code base. Patch is 226.73 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/73172.diff 86 Files Affected:
diff --git a/libcxx/docs/DesignDocs/ExperimentalFeatures.rst b/libcxx/docs/DesignDocs/ExperimentalFeatures.rst
index 4cd6bf3a7fcd50d..dc2ae6a25aa5d01 100644
--- a/libcxx/docs/DesignDocs/ExperimentalFeatures.rst
+++ b/libcxx/docs/DesignDocs/ExperimentalFeatures.rst
@@ -106,19 +106,19 @@ Most (but not all) of the features of the LFTS were accepted into C++17.
+---------+-------------------------------------------------------+--------------------+------------------------------------------+-------------------------+
| 8.2.2 | ``weak_ptr`` enhancements | Not yet | Never added | |
+---------+-------------------------------------------------------+--------------------+------------------------------------------+-------------------------+
-| 8.5 | ``memory_resource`` | Not yet | | |
+| 8.5 | ``memory_resource`` | 16.0 | 18.0 | Removed |
+---------+-------------------------------------------------------+--------------------+------------------------------------------+-------------------------+
-| 8.6 | ``polymorphic_allocator`` | Not yet | | |
+| 8.6 | ``polymorphic_allocator`` | 16.0 | 18.0 | Removed |
+---------+-------------------------------------------------------+--------------------+------------------------------------------+-------------------------+
| 8.7 | ``resource_adaptor`` | | n/a | Not part of C++17 |
+---------+-------------------------------------------------------+--------------------+------------------------------------------+-------------------------+
-| 8.8 | Access to program-wide ``memory_resource`` objects | Not yet | | |
+| 8.8 | Access to program-wide ``memory_resource`` objects | 16.0 | 18.0 | Removed |
+---------+-------------------------------------------------------+--------------------+------------------------------------------+-------------------------+
-| 8.9 | Pool resource classes | Not yet | | |
+| 8.9 | Pool resource classes | 16.0 | 18.0 | Removed |
+---------+-------------------------------------------------------+--------------------+------------------------------------------+-------------------------+
-| 8.10 | ``monotonic_buffer_resource`` | Not yet | | |
+| 8.10 | ``monotonic_buffer_resource`` | 16.0 | 18.0 | Removed |
+---------+-------------------------------------------------------+--------------------+------------------------------------------+-------------------------+
-| 8.11 | Alias templates using polymorphic memory resources | Not yet | | |
+| 8.11 | Alias templates using polymorphic memory resources | 16.0 | 18.0 | Removed |
+---------+-------------------------------------------------------+--------------------+------------------------------------------+-------------------------+
| 8.12 | Non-owning pointers | | n/a | Not part of C++17 |
+---------+-------------------------------------------------------+--------------------+------------------------------------------+-------------------------+
diff --git a/libcxx/docs/ReleaseNotes/18.rst b/libcxx/docs/ReleaseNotes/18.rst
index 1a5b959eac6ce66..5e5a27cc0e1f6cf 100644
--- a/libcxx/docs/ReleaseNotes/18.rst
+++ b/libcxx/docs/ReleaseNotes/18.rst
@@ -87,6 +87,12 @@ Deprecations and Removals
macro is provided to restore the previous behavior, and it will be supported in the LLVM 18 release only.
In LLVM 19 and beyond, ``_LIBCPP_ENABLE_NARROWING_CONVERSIONS_IN_VARIANT`` will not be honored anymore.
+- The headers ``<experimental/deque>``, ``<experimental/forward_list>``, ``<experimental/list>``,
+ ``<experimental/map>``, ``<experimental/memory_resource>``, ``<experimental/regex>``, ``<experimental/set>``,
+ ``<experimental/string>``, ``<experimental/unordered_map>``, ``<experimental/unordered_set>``,
+ and ``<experimental/vector>`` have been removed in LLVM 18, as all their contents will have been
+ implemented in namespace ``std`` for at least two releases.
+
Upcoming Deprecations and Removals
----------------------------------
@@ -97,12 +103,6 @@ LLVM 18
Please see the updated documentation about the hardening modes in libc++ and in particular the
``_LIBCPP_VERBOSE_ABORT`` macro for details.
-- The headers ``<experimental/deque>``, ``<experimental/forward_list>``, ``<experimental/list>``,
- ``<experimental/map>``, ``<experimental/memory_resource>``, ``<experimental/regex>``, ``<experimental/set>``,
- ``<experimental/string>``, ``<experimental/unordered_map>``, ``<experimental/unordered_set>``,
- and ``<experimental/vector>`` will be removed in LLVM 18, as all their contents will have been implemented in
- namespace ``std`` for at least two releases.
-
LLVM 19
~~~~~~~
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 889d7fedbf2965f..0bc58d15f1f0910 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -920,23 +920,12 @@ set(files
experimental/__simd/traits.h
experimental/__simd/utility.h
experimental/__simd/vec_ext.h
- experimental/deque
- experimental/forward_list
experimental/iterator
- experimental/list
- experimental/map
experimental/memory
- experimental/memory_resource
experimental/propagate_const
- experimental/regex
- experimental/set
experimental/simd
- experimental/string
experimental/type_traits
- experimental/unordered_map
- experimental/unordered_set
experimental/utility
- experimental/vector
ext/__hash
ext/hash_map
ext/hash_set
diff --git a/libcxx/include/__std_clang_module b/libcxx/include/__std_clang_module
index 10ac3ccb8f329f4..18d6ce6b46c1f6e 100644
--- a/libcxx/include/__std_clang_module
+++ b/libcxx/include/__std_clang_module
@@ -86,25 +86,12 @@
#include <exception>
#include <execution>
#include <expected>
-#include <experimental/deque>
-#include <experimental/forward_list>
#include <experimental/iterator>
-#include <experimental/list>
-#include <experimental/map>
#include <experimental/memory>
-#include <experimental/memory_resource>
#include <experimental/propagate_const>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <experimental/regex>
-#endif
-#include <experimental/set>
#include <experimental/simd>
-#include <experimental/string>
#include <experimental/type_traits>
-#include <experimental/unordered_map>
-#include <experimental/unordered_set>
#include <experimental/utility>
-#include <experimental/vector>
#include <fenv.h>
#include <filesystem>
#include <float.h>
diff --git a/libcxx/include/experimental/__config b/libcxx/include/experimental/__config
index 65227c8b4052049..c86fd36dc558ea7 100644
--- a/libcxx/include/experimental/__config
+++ b/libcxx/include/experimental/__config
@@ -28,10 +28,6 @@
#define _LIBCPP_END_NAMESPACE_LFTS_V2 } } }
#define _VSTD_LFTS_V2 _VSTD_EXPERIMENTAL::fundamentals_v2
-#define _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR _LIBCPP_BEGIN_NAMESPACE_LFTS namespace pmr {
-#define _LIBCPP_END_NAMESPACE_LFTS_PMR _LIBCPP_END_NAMESPACE_LFTS }
-#define _VSTD_LFTS_PMR _VSTD_LFTS::pmr
-
// TODO: support more targets
#if defined(__AVX__)
#define _LIBCPP_NATIVE_SIMD_WIDTH_IN_BYTES 32
diff --git a/libcxx/include/experimental/deque b/libcxx/include/experimental/deque
deleted file mode 100644
index 46962afbb795eb4..000000000000000
--- a/libcxx/include/experimental/deque
+++ /dev/null
@@ -1,52 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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_EXPERIMENTAL_DEQUE
-#define _LIBCPP_EXPERIMENTAL_DEQUE
-
-/*
- experimental/deque synopsis
-
-// C++1z
-namespace std {
-namespace experimental {
-inline namespace fundamentals_v1 {
-namespace pmr {
-
- template <class T>
- using deque = std::deque<T,polymorphic_allocator<T>>;
-
-} // namespace pmr
-} // namespace fundamentals_v1
-} // namespace experimental
-} // namespace std
-
- */
-
-#include <__assert> // all public C++ headers provide the assertion handler
-#include <deque>
-#include <experimental/__config>
-#include <experimental/memory_resource>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _ValueT>
-using deque = _VSTD::deque<_ValueT, polymorphic_allocator<_ValueT>>;
-
-#endif // _LIBCPP_CXX03_LANG
-
-_LIBCPP_END_NAMESPACE_LFTS_PMR
-
-#endif /* _LIBCPP_EXPERIMENTAL_DEQUE */
diff --git a/libcxx/include/experimental/forward_list b/libcxx/include/experimental/forward_list
deleted file mode 100644
index 5d2686deb27681f..000000000000000
--- a/libcxx/include/experimental/forward_list
+++ /dev/null
@@ -1,52 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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_EXPERIMENTAL_FORWARD_LIST
-#define _LIBCPP_EXPERIMENTAL_FORWARD_LIST
-
-/*
- experimental/forward_list synopsis
-
-// C++1z
-namespace std {
-namespace experimental {
-inline namespace fundamentals_v1 {
-namespace pmr {
-
- template <class T>
- using forward_list = std::forward_list<T,polymorphic_allocator<T>>;
-
-} // namespace pmr
-} // namespace fundamentals_v1
-} // namespace experimental
-} // namespace std
-
- */
-
-#include <__assert> // all public C++ headers provide the assertion handler
-#include <experimental/__config>
-#include <experimental/memory_resource>
-#include <forward_list>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _ValueT>
-using forward_list = _VSTD::forward_list<_ValueT, polymorphic_allocator<_ValueT>>;
-
-#endif // _LIBCPP_CXX03_LANG
-
-_LIBCPP_END_NAMESPACE_LFTS_PMR
-
-#endif /* _LIBCPP_EXPERIMENTAL_FORWARD_LIST */
diff --git a/libcxx/include/experimental/list b/libcxx/include/experimental/list
deleted file mode 100644
index 06abe8702241e35..000000000000000
--- a/libcxx/include/experimental/list
+++ /dev/null
@@ -1,52 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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_EXPERIMENTAL_LIST
-#define _LIBCPP_EXPERIMENTAL_LIST
-
-/*
- experimental/list synopsis
-
-// C++1z
-namespace std {
-namespace experimental {
-inline namespace fundamentals_v1 {
-namespace pmr {
-
- template <class T>
- using list = std::list<T,polymorphic_allocator<T>>;
-
-} // namespace pmr
-} // namespace fundamentals_v1
-} // namespace experimental
-} // namespace std
-
- */
-
-#include <__assert> // all public C++ headers provide the assertion handler
-#include <experimental/__config>
-#include <experimental/memory_resource>
-#include <list>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _ValueT>
-using list = _VSTD::list<_ValueT, polymorphic_allocator<_ValueT>>;
-
-#endif // _LIBCPP_CXX03_LANG
-
-_LIBCPP_END_NAMESPACE_LFTS_PMR
-
-#endif /* _LIBCPP_EXPERIMENTAL_LIST */
diff --git a/libcxx/include/experimental/map b/libcxx/include/experimental/map
deleted file mode 100644
index 8ec94e4a5bc86dd..000000000000000
--- a/libcxx/include/experimental/map
+++ /dev/null
@@ -1,62 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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_EXPERIMENTAL_MAP
-#define _LIBCPP_EXPERIMENTAL_MAP
-
-/*
- experimental/map synopsis
-
-// C++1z
-namespace std {
-namespace experimental {
-inline namespace fundamentals_v1 {
-namespace pmr {
-
- template <class Key, class T, class Compare = less<Key>>
- using map = std::map<Key, T, Compare,
- polymorphic_allocator<pair<const Key,T>>>;
-
- template <class Key, class T, class Compare = less<Key>>
- using multimap = std::multimap<Key, T, Compare,
- polymorphic_allocator<pair<const Key,T>>>;
-
-} // namespace pmr
-} // namespace fundamentals_v1
-} // namespace experimental
-} // namespace std
-
- */
-
-#include <__assert> // all public C++ headers provide the assertion handler
-#include <experimental/__config>
-#include <experimental/memory_resource>
-#include <map>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
-
-#ifndef _LIBCPP_CXX03_LANG
-
-template <class _Key, class _Value, class _Compare = less<_Key>>
-using map = _VSTD::map<_Key, _Value, _Compare,
- polymorphic_allocator<pair<const _Key, _Value>>>;
-
-template <class _Key, class _Value, class _Compare = less<_Key>>
-using multimap = _VSTD::multimap<_Key, _Value, _Compare,
- polymorphic_allocator<pair<const _Key, _Value>>>;
-
-#endif // _LIBCPP_CXX03_LANG
-
-_LIBCPP_END_NAMESPACE_LFTS_PMR
-
-#endif /* _LIBCPP_EXPERIMENTAL_MAP */
diff --git a/libcxx/include/experimental/memory_resource b/libcxx/include/experimental/memory_resource
deleted file mode 100644
index 8ae8322ae1a63e9..000000000000000
--- a/libcxx/include/experimental/memory_resource
+++ /dev/null
@@ -1,444 +0,0 @@
-// -*- C++ -*-
-//===----------------------------------------------------------------------===//
-//
-// 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_EXPERIMENTAL_MEMORY_RESOURCE
-#define _LIBCPP_EXPERIMENTAL_MEMORY_RESOURCE
-
-/**
- experimental/memory_resource synopsis
-
-// C++1y
-
-namespace std {
-namespace experimental {
-inline namespace fundamentals_v1 {
-namespace pmr {
-
- class memory_resource;
-
- bool operator==(const memory_resource& a,
- const memory_resource& b) noexcept;
- bool operator!=(const memory_resource& a,
- const memory_resource& b) noexcept;
-
- template <class Tp> class polymorphic_allocator;
-
- template <class T1, class T2>
- bool operator==(const polymorphic_allocator<T1>& a,
- const polymorphic_allocator<T2>& b) noexcept;
- template <class T1, class T2>
- bool operator!=(const polymorphic_allocator<T1>& a,
- const polymorphic_allocator<T2>& b) noexcept;
-
- // The name resource_adaptor_imp is for exposition only.
- template <class Allocator> class resource_adaptor_imp;
-
- template <class Allocator>
- using resource_adaptor = resource_adaptor_imp<
- allocator_traits<Allocator>::rebind_alloc<char>>;
-
- // Global memory resources
- memory_resource* new_delete_resource() noexcept;
- memory_resource* null_memory_resource() noexcept;
-
- // The default memory resource
- memory_resource* set_default_resource(memory_resource* r) noexcept;
- memory_resource* get_default_resource() noexcept;
-
- // Standard memory resources
- struct pool_options;
- class synchronized_pool_resource;
- class unsynchronized_pool_resource;
- class monotonic_buffer_resource;
-
-} // namespace pmr
-} // namespace fundamentals_v1
-} // namespace experimental
-} // namespace std
-
- */
-
-#include <__assert> // all public C++ headers provide the assertion handler
-#include <__memory/allocator_traits.h>
-#include <__type_traits/aligned_storage.h>
-#include <__utility/move.h>
-#include <cstddef>
-#include <experimental/__config>
-#include <experimental/__memory>
-#include <limits>
-#include <new>
-#include <stdexcept>
-#include <tuple>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-# pragma GCC system_header
-#endif
-
-_LIBCPP_PUSH_MACROS
-#include <__undef_macros>
-
-_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
-
-#define _LIBCPP_DEPCREATED_MEMORY_RESOURCE(name) \
- _LIBCPP_DEPRECATED_("'std::experimental::pmr::" name \
- "' is deprecated and will be removed in LLVM 18. Use 'std::pmr::" name "' instead.")
-
-#ifndef _LIBCPP_CXX03_LANG
-
-// Round __s up to next multiple of __a.
-inline _LIBCPP_INLINE_VISIBILITY
-size_t __aligned_allocation_size(size_t __s, size_t __a) _NOEXCEPT
-{
- _LIBCPP_ASSERT_UNCATEGORIZED(__s + __a > __s, "aligned allocation size overflows");
- return (__s + __a - 1) & ~(__a - 1);
-}
-
-// 8.5, memory.resource
-class _LIBCPP_DEPCREATED_MEMORY_RESOURCE("memory_resource") _LIBCPP_EXPORTED_FROM_ABI memory_resource
-{
- static const size_t __max_align = _LIBCPP_ALIGNOF(max_align_t);
-
-// 8.5.2, memory.resource.public
-public:
- _LIBCPP_HIDE_FROM_ABI_VIRTUAL virtual ~memory_resource() = default;
-
- _LIBCPP_INLINE_VISIBILITY
- void* allocate(size_t __bytes, size_t __align = __max_align)
- { return do_allocate(__bytes, __align); }
-
- _LIBCPP_INLINE_VISIBILITY
- void deallocate(void * __p, size_t __bytes, size_t __align = __max_align)
- { do_deallocate(__p, __bytes, __align); }
-
- _LIBCPP_INLINE_VISIBILITY
- bool is_equal(memory_resource const & __other) const _NOEXCEPT
- { return do_is_equal(__other); }
-
-// 8.5.3, memory.resource.priv
-private:
- virtual void* do_allocate(size_t, size_t) = 0;
- virtual void do_deallocate(void*, size_t, size_t) = 0;
- virtual bool do_is_equal(memory_resource const &) const _NOEXCEPT = 0;
-};
-
-// 8.5.4, memory.resource.eq
-_LIBCPP_DEPCREATED_MEMORY_RESOURCE("operator==(memory_resource, memory_resource)") inline _LIBCPP_INLINE_VISIBILITY
-bool operator==(memory_resource const & __lhs,
- memory_resource const & __rhs) _NOEXCEPT
-{
- return &__lhs == &__rhs || __lhs.is_equal(__rhs);
-}
-
-_LIBCPP_DEPCREATED_MEMORY_RESOURCE("operator!=(memory_resource, memory_resource)") inline _LIBCPP_INLINE_VISIBILITY
-bool operator!=(memory_resource const & __lhs,
- memory_resource const & __rhs) _NOEXCEPT
-{
- return !(__lhs == __rhs);
-}
-
-_LIBCPP_DEPCREATED_MEMORY_RESOURCE("new_delete_resource()") _L...
[truncated]
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
119ccaf
to
59fd0d0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this! LGTM modulo one nit.
Several experimental headers around std::pmr have been slated for removal for a while now. This patch actually performs the removal and cleanups from the code base.
cca2937
to
3dc1978
Compare
Several experimental headers around std::pmr have been slated for removal for a while now. This patch actually performs the removal and cleanups from the code base.