Skip to content
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++] Include the rest of the detail headers by version in the umbrella headers #96032

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

philnik777
Copy link
Contributor

This is a follow-up to #83740.

@philnik777 philnik777 force-pushed the include_by_dialect branch 5 times, most recently from 9d77060 to 8862e11 Compare July 15, 2024 07:30
@philnik777 philnik777 marked this pull request as ready for review July 16, 2024 12:34
@philnik777 philnik777 requested a review from a team as a code owner July 16, 2024 12:34
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Jul 16, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Jul 16, 2024

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

Changes

This is a follow-up to #83740.


Patch is 53.52 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/96032.diff

55 Files Affected:

  • (modified) libcxx/include/__type_traits/make_signed.h (+1)
  • (modified) libcxx/include/atomic (+4-1)
  • (modified) libcxx/include/expected (+14-4)
  • (modified) libcxx/include/filesystem (+20-16)
  • (modified) libcxx/include/format (+53-28)
  • (modified) libcxx/include/forward_list (+1)
  • (modified) libcxx/include/functional (+33-14)
  • (modified) libcxx/include/iterator (+33-23)
  • (modified) libcxx/include/mdspan (+20-7)
  • (modified) libcxx/include/memory (+18-10)
  • (modified) libcxx/include/memory_resource (+20-6)
  • (modified) libcxx/include/module.modulemap (+13-3)
  • (modified) libcxx/include/numeric (+19-10)
  • (modified) libcxx/include/ostream (+8-1)
  • (modified) libcxx/include/random (-3)
  • (modified) libcxx/include/ranges (+55-40)
  • (modified) libcxx/include/stop_token (+6-3)
  • (modified) libcxx/include/string_view (+1)
  • (modified) libcxx/include/type_traits (+31-32)
  • (modified) libcxx/include/utility (+26-12)
  • (modified) libcxx/test/libcxx/containers/sequences/deque/abi.compile.pass.cpp (+1)
  • (modified) libcxx/test/libcxx/containers/sequences/list/abi.compile.pass.cpp (+1)
  • (modified) libcxx/test/libcxx/iterators/bounded_iter/arithmetic.pass.cpp (+1-1)
  • (modified) libcxx/test/libcxx/iterators/bounded_iter/comparison.pass.cpp (+1-1)
  • (modified) libcxx/test/libcxx/iterators/bounded_iter/dereference.pass.cpp (+1-1)
  • (modified) libcxx/test/libcxx/iterators/bounded_iter/pointer_traits.pass.cpp (+2-1)
  • (modified) libcxx/test/libcxx/iterators/bounded_iter/types.compile.pass.cpp (+1)
  • (modified) libcxx/test/libcxx/memory/allocation_guard.pass.cpp (+1-1)
  • (modified) libcxx/test/libcxx/memory/compressed_pair/compressed_pair.pass.cpp (+1-1)
  • (modified) libcxx/test/libcxx/numerics/clamp_to_integral.pass.cpp (+1-1)
  • (modified) libcxx/test/libcxx/ranges/range.adaptors/range.adaptor.helpers/as-lvalue.lifetimebound.verify.cpp (+1-1)
  • (modified) libcxx/test/libcxx/ranges/range.adaptors/range.adaptor.helpers/as-lvalue.pass.cpp (+1)
  • (modified) libcxx/test/libcxx/transitive_includes/cxx03.csv (+1)
  • (modified) libcxx/test/libcxx/transitive_includes/cxx11.csv (+1)
  • (modified) libcxx/test/libcxx/transitive_includes/cxx14.csv (+1)
  • (modified) libcxx/test/libcxx/transitive_includes/cxx17.csv (+1)
  • (modified) libcxx/test/libcxx/transitive_includes/cxx20.csv (+2)
  • (modified) libcxx/test/libcxx/transitive_includes/cxx23.csv (-1)
  • (modified) libcxx/test/libcxx/transitive_includes/cxx26.csv (-1)
  • (modified) libcxx/test/libcxx/type_traits/is_callable.compile.pass.cpp (+1-1)
  • (modified) libcxx/test/libcxx/type_traits/is_constant_evaluated.pass.cpp (+1-1)
  • (modified) libcxx/test/libcxx/type_traits/is_implicitly_default_constructible.pass.cpp (+1-2)
  • (modified) libcxx/test/libcxx/type_traits/is_specialization.compile.pass.cpp (+1-4)
  • (modified) libcxx/test/libcxx/type_traits/is_specialization.verify.cpp (+1-2)
  • (modified) libcxx/test/libcxx/type_traits/lazy_metafunctions.pass.cpp (+3)
  • (modified) libcxx/test/libcxx/utilities/exception_guard.no_exceptions.pass.cpp (+1)
  • (modified) libcxx/test/libcxx/utilities/exception_guard.pass.cpp (+1)
  • (modified) libcxx/test/libcxx/utilities/function.objects/func.bind.partial/compose.pass.cpp (+1-1)
  • (modified) libcxx/test/libcxx/utilities/meta/meta_base.pass.cpp (+4-1)
  • (modified) libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/ranges_make_heap.pass.cpp (+1)
  • (modified) libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/ranges_pop_heap.pass.cpp (+1)
  • (modified) libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/ranges_push_heap.pass.cpp (+1)
  • (modified) libcxx/test/std/ranges/range.adaptors/range.all/range.owning.view/begin_end.pass.cpp (+1)
  • (modified) libcxx/test/std/ranges/range.factories/range.repeat.view/iterator/plus_eq.pass.cpp (+2-1)
  • (modified) libcxx/test/support/test_iterators.h (+1)
diff --git a/libcxx/include/__type_traits/make_signed.h b/libcxx/include/__type_traits/make_signed.h
index c1fc009d9ba2e..d09d6ed4a1e7c 100644
--- a/libcxx/include/__type_traits/make_signed.h
+++ b/libcxx/include/__type_traits/make_signed.h
@@ -10,6 +10,7 @@
 #define _LIBCPP___TYPE_TRAITS_MAKE_SIGNED_H
 
 #include <__config>
+#include <__type_traits/copy_cv.h>
 #include <__type_traits/is_enum.h>
 #include <__type_traits/is_integral.h>
 #include <__type_traits/nat.h>
diff --git a/libcxx/include/atomic b/libcxx/include/atomic
index 80a0f9ee373e9..0d13619d6ce45 100644
--- a/libcxx/include/atomic
+++ b/libcxx/include/atomic
@@ -599,7 +599,6 @@ template <class T>
 #include <__atomic/atomic_flag.h>
 #include <__atomic/atomic_init.h>
 #include <__atomic/atomic_lock_free.h>
-#include <__atomic/atomic_ref.h>
 #include <__atomic/atomic_sync.h>
 #include <__atomic/check_memory_order.h>
 #include <__atomic/contention_t.h>
@@ -610,6 +609,10 @@ template <class T>
 #include <__atomic/memory_order.h>
 #include <version>
 
+#if _LIBCPP_STD_VER >= 20
+#  include <__atomic/atomic_ref.h>
+#endif
+
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif
diff --git a/libcxx/include/expected b/libcxx/include/expected
index f455ab7d5d61c..6a2f12f2bf3b5 100644
--- a/libcxx/include/expected
+++ b/libcxx/include/expected
@@ -39,14 +39,24 @@ namespace std {
 */
 
 #include <__config>
-#include <__expected/bad_expected_access.h>
-#include <__expected/expected.h>
-#include <__expected/unexpect.h>
-#include <__expected/unexpected.h>
+
+#if _LIBCPP_STD_VER >= 23
+#  include <__expected/bad_expected_access.h>
+#  include <__expected/expected.h>
+#  include <__expected/unexpect.h>
+#  include <__expected/unexpected.h>
+#endif
+
 #include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif
 
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#  include <cstddef>
+#  include <initializer_list>
+#  include <new>
+#endif
+
 #endif // _LIBCPP_EXPECTED
diff --git a/libcxx/include/filesystem b/libcxx/include/filesystem
index eff7dff4a4551..6ea04df0a089b 100644
--- a/libcxx/include/filesystem
+++ b/libcxx/include/filesystem
@@ -534,22 +534,26 @@ inline constexpr bool std::ranges::enable_view<std::filesystem::recursive_direct
 */
 
 #include <__config>
-#include <__filesystem/copy_options.h>
-#include <__filesystem/directory_entry.h>
-#include <__filesystem/directory_iterator.h>
-#include <__filesystem/directory_options.h>
-#include <__filesystem/file_status.h>
-#include <__filesystem/file_time_type.h>
-#include <__filesystem/file_type.h>
-#include <__filesystem/filesystem_error.h>
-#include <__filesystem/operations.h>
-#include <__filesystem/path.h>
-#include <__filesystem/path_iterator.h>
-#include <__filesystem/perm_options.h>
-#include <__filesystem/perms.h>
-#include <__filesystem/recursive_directory_iterator.h>
-#include <__filesystem/space_info.h>
-#include <__filesystem/u8path.h>
+
+#if _LIBCPP_STD_VER >= 17
+#  include <__filesystem/copy_options.h>
+#  include <__filesystem/directory_entry.h>
+#  include <__filesystem/directory_iterator.h>
+#  include <__filesystem/directory_options.h>
+#  include <__filesystem/file_status.h>
+#  include <__filesystem/file_time_type.h>
+#  include <__filesystem/file_type.h>
+#  include <__filesystem/filesystem_error.h>
+#  include <__filesystem/operations.h>
+#  include <__filesystem/path.h>
+#  include <__filesystem/path_iterator.h>
+#  include <__filesystem/perm_options.h>
+#  include <__filesystem/perms.h>
+#  include <__filesystem/recursive_directory_iterator.h>
+#  include <__filesystem/space_info.h>
+#  include <__filesystem/u8path.h>
+#endif
+
 #include <version>
 
 // standard-mandated includes
diff --git a/libcxx/include/format b/libcxx/include/format
index 07c2ba083199e..c3f2b45f0f730 100644
--- a/libcxx/include/format
+++ b/libcxx/include/format
@@ -189,40 +189,65 @@ namespace std {
 */
 
 #include <__config>
-#include <__format/buffer.h>
-#include <__format/concepts.h>
-#include <__format/container_adaptor.h>
-#include <__format/enable_insertable.h>
-#include <__format/escaped_output_table.h>
-#include <__format/extended_grapheme_cluster_table.h>
-#include <__format/format_arg.h>
-#include <__format/format_arg_store.h>
-#include <__format/format_args.h>
-#include <__format/format_context.h>
-#include <__format/format_error.h>
-#include <__format/format_functions.h>
-#include <__format/format_parse_context.h>
-#include <__format/format_string.h>
-#include <__format/format_to_n_result.h>
-#include <__format/formatter.h>
-#include <__format/formatter_bool.h>
-#include <__format/formatter_char.h>
-#include <__format/formatter_floating_point.h>
-#include <__format/formatter_integer.h>
-#include <__format/formatter_pointer.h>
-#include <__format/formatter_string.h>
-#include <__format/formatter_tuple.h>
-#include <__format/parser_std_format_spec.h>
-#include <__format/range_default_formatter.h>
-#include <__format/range_formatter.h>
-#include <__format/unicode.h>
-#include <__fwd/format.h>
+
+#if _LIBCPP_STD_VER >= 20
+#  include <__format/buffer.h>
+#  include <__format/concepts.h>
+#  include <__format/container_adaptor.h>
+#  include <__format/enable_insertable.h>
+#  include <__format/escaped_output_table.h>
+#  include <__format/extended_grapheme_cluster_table.h>
+#  include <__format/format_arg.h>
+#  include <__format/format_arg_store.h>
+#  include <__format/format_args.h>
+#  include <__format/format_context.h>
+#  include <__format/format_error.h>
+#  include <__format/format_functions.h>
+#  include <__format/format_parse_context.h>
+#  include <__format/format_string.h>
+#  include <__format/format_to_n_result.h>
+#  include <__format/formatter.h>
+#  include <__format/formatter_bool.h>
+#  include <__format/formatter_char.h>
+#  include <__format/formatter_floating_point.h>
+#  include <__format/formatter_integer.h>
+#  include <__format/formatter_pointer.h>
+#  include <__format/formatter_string.h>
+#  include <__format/formatter_tuple.h>
+#  include <__format/parser_std_format_spec.h>
+#  include <__format/range_default_formatter.h>
+#  include <__format/range_formatter.h>
+#  include <__format/unicode.h>
+#  include <__fwd/format.h>
+#endif
+
 #include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif
 
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#  include <array>
+#  include <cctype>
+#  include <cerrno>
+#  include <clocale>
+#  include <cmath>
+#  include <cstddef>
+#  include <cstdint>
+#  include <cstdlib>
+#  include <cstring>
+#  include <cwchar>
+#  include <initializer_list>
+#  include <limits>
+#  include <new>
+#  include <optional>
+#  include <stdexcept>
+#  include <string>
+#  include <string_view>
+#  include <tuple>
+#endif
+
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <locale>
 #  include <queue>
diff --git a/libcxx/include/forward_list b/libcxx/include/forward_list
index 1ae19d23f88cc..b14d2cb6c7803 100644
--- a/libcxx/include/forward_list
+++ b/libcxx/include/forward_list
@@ -224,6 +224,7 @@ template <class T, class Allocator, class Predicate>
 #include <__type_traits/is_nothrow_constructible.h>
 #include <__type_traits/is_pointer.h>
 #include <__type_traits/is_same.h>
+#include <__type_traits/is_swappable.h>
 #include <__type_traits/type_identity.h>
 #include <__utility/forward.h>
 #include <__utility/move.h>
diff --git a/libcxx/include/functional b/libcxx/include/functional
index 27cf21e1a4c8b..3d39f654ddb08 100644
--- a/libcxx/include/functional
+++ b/libcxx/include/functional
@@ -527,41 +527,60 @@ POLICY:  For non-variadic implementations, the number of arguments is limited
 
 */
 
-#include <__algorithm/search.h>
-#include <__compare/compare_three_way.h>
 #include <__config>
+
 #include <__functional/binary_function.h>
 #include <__functional/binary_negate.h>
 #include <__functional/bind.h>
-#include <__functional/bind_back.h>
-#include <__functional/bind_front.h>
 #include <__functional/binder1st.h>
 #include <__functional/binder2nd.h>
-#include <__functional/boyer_moore_searcher.h>
-#include <__functional/compose.h>
-#include <__functional/default_searcher.h>
-#include <__functional/function.h>
 #include <__functional/hash.h>
-#include <__functional/identity.h>
-#include <__functional/invoke.h>
 #include <__functional/mem_fn.h> // TODO: deprecate
 #include <__functional/mem_fun_ref.h>
-#include <__functional/not_fn.h>
 #include <__functional/operations.h>
 #include <__functional/pointer_to_binary_function.h>
 #include <__functional/pointer_to_unary_function.h>
-#include <__functional/ranges_operations.h>
 #include <__functional/reference_wrapper.h>
 #include <__functional/unary_function.h>
 #include <__functional/unary_negate.h>
-#include <__type_traits/unwrap_ref.h>
-#include <__utility/forward.h>
+
+#ifndef _LIBCPP_CXX03_LANG
+#  include <__functional/function.h>
+#endif
+
+#if _LIBCPP_STD_VER >= 17
+#  include <__functional/boyer_moore_searcher.h>
+#  include <__functional/default_searcher.h>
+#  include <__functional/invoke.h>
+#  include <__functional/not_fn.h>
+#endif
+
+#if _LIBCPP_STD_VER >= 20
+#  include <__functional/bind_back.h>
+#  include <__functional/bind_front.h>
+#  include <__functional/identity.h>
+#  include <__functional/ranges_operations.h>
+#  include <__type_traits/unwrap_ref.h>
+#endif
+
 #include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif
 
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && defined(_LIBCPP_CXX03_LANG)
+#  include <limits>
+#  include <new>
+#endif
+
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 14
+#  include <array>
+#  include <initializer_list>
+#  include <unordered_map>
+#  include <vector>
+#endif
+
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <atomic>
 #  include <concepts>
diff --git a/libcxx/include/iterator b/libcxx/include/iterator
index 1b9e7eaf0c1e8..fca75f0a19ed1 100644
--- a/libcxx/include/iterator
+++ b/libcxx/include/iterator
@@ -683,43 +683,49 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept;
 #include <__iterator/access.h>
 #include <__iterator/advance.h>
 #include <__iterator/back_insert_iterator.h>
-#include <__iterator/bounded_iter.h>
-#include <__iterator/common_iterator.h>
-#include <__iterator/concepts.h>
-#include <__iterator/counted_iterator.h>
-#include <__iterator/data.h>
-#include <__iterator/default_sentinel.h>
 #include <__iterator/distance.h>
-#include <__iterator/empty.h>
-#include <__iterator/erase_if_container.h>
 #include <__iterator/front_insert_iterator.h>
-#include <__iterator/incrementable_traits.h>
-#include <__iterator/indirectly_comparable.h>
 #include <__iterator/insert_iterator.h>
 #include <__iterator/istream_iterator.h>
 #include <__iterator/istreambuf_iterator.h>
-#include <__iterator/iter_move.h>
-#include <__iterator/iter_swap.h>
 #include <__iterator/iterator.h>
 #include <__iterator/iterator_traits.h>
-#include <__iterator/mergeable.h>
 #include <__iterator/move_iterator.h>
-#include <__iterator/move_sentinel.h>
 #include <__iterator/next.h>
 #include <__iterator/ostream_iterator.h>
 #include <__iterator/ostreambuf_iterator.h>
-#include <__iterator/permutable.h>
 #include <__iterator/prev.h>
-#include <__iterator/projected.h>
-#include <__iterator/readable_traits.h>
-#include <__iterator/reverse_access.h>
 #include <__iterator/reverse_iterator.h>
-#include <__iterator/size.h>
-#include <__iterator/sortable.h>
-#include <__iterator/unreachable_sentinel.h>
 #include <__iterator/wrap_iter.h>
-#include <__memory/addressof.h>
-#include <__memory/pointer_traits.h>
+
+#if _LIBCPP_STD_VER >= 14
+#  include <__iterator/reverse_access.h>
+#endif
+
+#if _LIBCPP_STD_VER >= 17
+#  include <__iterator/data.h>
+#  include <__iterator/empty.h>
+#  include <__iterator/size.h>
+#endif
+
+#if _LIBCPP_STD_VER >= 20
+#  include <__iterator/common_iterator.h>
+#  include <__iterator/concepts.h>
+#  include <__iterator/counted_iterator.h>
+#  include <__iterator/default_sentinel.h>
+#  include <__iterator/incrementable_traits.h>
+#  include <__iterator/indirectly_comparable.h>
+#  include <__iterator/iter_move.h>
+#  include <__iterator/iter_swap.h>
+#  include <__iterator/mergeable.h>
+#  include <__iterator/move_sentinel.h>
+#  include <__iterator/permutable.h>
+#  include <__iterator/projected.h>
+#  include <__iterator/readable_traits.h>
+#  include <__iterator/sortable.h>
+#  include <__iterator/unreachable_sentinel.h>
+#endif
+
 #include <version>
 
 // standard-mandated includes
@@ -732,6 +738,10 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept;
 #  pragma GCC system_header
 #endif
 
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 17
+#  include <variant>
+#endif
+
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <cstdlib>
 #  include <exception>
diff --git a/libcxx/include/mdspan b/libcxx/include/mdspan
index 8d443f4acd1dd..813af6839dbd0 100644
--- a/libcxx/include/mdspan
+++ b/libcxx/include/mdspan
@@ -405,17 +405,30 @@ namespace std {
 #define _LIBCPP_MDSPAN
 
 #include <__config>
-#include <__fwd/mdspan.h>
-#include <__mdspan/default_accessor.h>
-#include <__mdspan/extents.h>
-#include <__mdspan/layout_left.h>
-#include <__mdspan/layout_right.h>
-#include <__mdspan/layout_stride.h>
-#include <__mdspan/mdspan.h>
+
+#if _LIBCPP_STD_VER >= 23
+#  include <__fwd/mdspan.h>
+#  include <__mdspan/default_accessor.h>
+#  include <__mdspan/extents.h>
+#  include <__mdspan/layout_left.h>
+#  include <__mdspan/layout_right.h>
+#  include <__mdspan/layout_stride.h>
+#  include <__mdspan/mdspan.h>
+#endif
+
 #include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif
 
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
+#  include <array>
+#  include <cinttypes>
+#  include <concepts>
+#  include <cstddef>
+#  include <limits>
+#  include <span>
+#endif
+
 #endif // _LIBCPP_MDSPAN
diff --git a/libcxx/include/memory b/libcxx/include/memory
index a8c0264eb9eb7..d52ee7b4c8eee 100644
--- a/libcxx/include/memory
+++ b/libcxx/include/memory
@@ -920,30 +920,38 @@ template<size_t N, class T>
 #include <__config>
 #include <__memory/addressof.h>
 #include <__memory/align.h>
-#include <__memory/allocate_at_least.h>
-#include <__memory/allocation_guard.h>
 #include <__memory/allocator.h>
 #include <__memory/allocator_arg_t.h>
 #include <__memory/allocator_traits.h>
-#include <__memory/assume_aligned.h>
 #include <__memory/auto_ptr.h>
-#include <__memory/compressed_pair.h>
-#include <__memory/concepts.h>
-#include <__memory/construct_at.h>
 #include <__memory/pointer_traits.h>
-#include <__memory/ranges_construct_at.h>
-#include <__memory/ranges_uninitialized_algorithms.h>
 #include <__memory/raw_storage_iterator.h>
 #include <__memory/shared_ptr.h>
 #include <__memory/temporary_buffer.h>
 #include <__memory/uninitialized_algorithms.h>
 #include <__memory/unique_ptr.h>
 #include <__memory/uses_allocator.h>
-#include <__memory/uses_allocator_construction.h>
-#include <version>
 
 // standard-mandated includes
 
+#if _LIBCPP_STD_VER >= 17
+#  include <__memory/construct_at.h>
+#endif
+
+#if _LIBCPP_STD_VER >= 20
+#  include <__memory/assume_aligned.h>
+#  include <__memory/concepts.h>
+#  include <__memory/ranges_construct_at.h>
+#  include <__memory/ranges_uninitialized_algorithms.h>
+#  include <__memory/uses_allocator_construction.h>
+#endif
+
+#if _LIBCPP_STD_VER >= 23
+#  include <__memory/allocate_at_least.h>
+#endif
+
+#include <version>
+
 // [memory.syn]
 #include <compare>
 
diff --git a/libcxx/include/memory_resource b/libcxx/include/memory_resource
index e9c87777e8f75..67411054820a1 100644
--- a/libcxx/include/memory_resource
+++ b/libcxx/include/memory_resource
@@ -50,18 +50,32 @@ namespace std::pmr {
  */
 
 #include <__config>
-#include <__memory_resource/memory_resource.h>
-#include <__memory_resource/monotonic_buffer_resource.h>
-#include <__memory_resource/polymorphic_allocator.h>
-#include <__memory_resource/pool_options.h>
-#include <__memory_resource/synchronized_pool_resource.h>
-#include <__memory_resource/unsynchronized_pool_resource.h>
+
+#if _LIBCPP_STD_VER >= 17
+#  include <__memory_resource/memory_resource.h>
+#  include <__memory_resource/monotonic_buffer_resource.h>
+#  include <__memory_resource/polymorphic_allocator.h>
+#  include <__memory_resource/pool_options.h>
+#  include <__memory_resource/synchronized_pool_resource.h>
+#  include <__memory_resource/unsynchronized_pool_resource.h>
+#endif
+
 #include <version>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif
 
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 14
+#  include <cstddef>
+#  include <cstdint>
+#  include <limits>
+#  include <mutex>
+#  include <new>
+#  include <stdexcept>
+#  include <tuple>
+#endif
+
 #if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
 #  include <stdexcept>
 #endif
diff --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap
index 4ad506781c489..94042da750b59 100644
--- a/libcxx/include/module.modulemap
+++ b/libcxx/include/module.modulemap
@@ -1081,7 +1081,10 @@ module std_private_charconv_tables                  [system] { header "__charcon
 module std_private_charconv_to_chars                [system] { header "__charconv/to_chars.h" }
 module std_private_charconv_to_chars_base_10        [system] { header "__charconv/to_chars_base_10.h" }
 module std_private_charconv_to_chars_floating_point [system] { header "__charconv/to_chars_floating_point.h" }
-module std_private_charconv_to_chars_integral       [system] { header "__charconv/to_chars_integral.h" }
+module std_private_charconv_to_chars_integral       [system] {
+  header "__charconv/to_chars_integral.h"
+  export std_private_charconv_traits
+}
 module std_private_charconv_to_chars_result         [system] {
   header "__charconv/to_chars_result.h"
   export *
@@ -1130,6 +1133,7 @@ module std_private_chrono_steady_clock           [system] {
 }
 module std_private_chrono_time_zone              [system] {
   header "__chrono/time_zone.h"
+  export std_private_memory_unique_ptr
 }
 module std_private_chrono_time_zone_link         [system] {
   header "__chrono/time_zone_link.h"
@@ -1924,7 +1928,10 @@ module std_private_type_traits_is_array                                  [system
 module std_private_type_traits_is_assignable                             [system] { header "__type_traits/is_assignable.h" }
 module std_private_type_traits_is_base_of                                [system] { header "__type_traits/is_base_of.h" }
 module std_private_type_traits_is_bounded_array                          [system] { header "__type_traits/is_bounded_array.h" }
-module std_private_type_traits_is_callable                               [system] { header "__type_traits/is_callable.h" }
+module std_private_type_traits_is_callable                               [system] {
+  header "__type_traits/is_callable.h"
+  export std_private_type_traits_integral_constant
+}
 module std_private_type_traits_is_char_like_type                         [system] { header "__type_traits/is_char_like_type.h" }
 module std_private_type_traits_is_class                                  [system] { header "__type_traits/is_class.h" }
 module std_private_type_traits_is_compound                               [system] { header "__type_traits/is_compound.h" }
@@ -1959,7 +1966,10 @@ module std_private_type_traits_is_final                                  [system
 module std_private_type_traits_is_floating_point                         [system] { header "__type_traits/is_floating_point.h" }
 module std_private_type_traits_is_function                               [system] { header "__type_traits/is_function.h" }
 module std_private_type_traits_is_fundamental                            [system] { header "__type_traits/is_fundamental.h" }
-module std_private_type_traits_is_implicitly_default_constructible       [system] { header "__type_traits/is_implicitly_default_constructible.h" }
+module std_private_type_traits_is_implicitly_default_constructible       [system] {
+  header "__type_traits/is_implicitly_de...
[truncated]

@philnik777 philnik777 added this to the LLVM 19.X Release milestone Jul 16, 2024
Copy link
Member

@ldionne ldionne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM but I have a question.

Also, is this exhaustive or are some umbrella headers still not fully following this pattern?

@@ -682,6 +682,7 @@ ranges optional
ranges span
ranges tuple
ranges type_traits
ranges variant
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary? Why does that happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variant is used as an implementation detail of common_iterator, which is used by common_view. It probably didn't show up before because it's been swallowed by iterator.

Copy link
Contributor Author

@philnik777 philnik777 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, is this exhaustive or are some umbrella headers still not fully following this pattern?

This should be exhaustive unless I missed a header.

@@ -682,6 +682,7 @@ ranges optional
ranges span
ranges tuple
ranges type_traits
ranges variant
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

variant is used as an implementation detail of common_iterator, which is used by common_view. It probably didn't show up before because it's been swallowed by iterator.

Copy link
Member

@ldionne ldionne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with green CI and conflicts resolved.

Copy link

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 30cc12cd818d4b52914d1033d1ed79af4a0f78fa 528d3e6d72d3c32912d7db677ef7970c4ed315b9 --extensions ,h,cpp -- libcxx/include/__type_traits/make_signed.h libcxx/include/atomic libcxx/include/expected libcxx/include/filesystem libcxx/include/format libcxx/include/forward_list libcxx/include/functional libcxx/include/iterator libcxx/include/mdspan libcxx/include/memory libcxx/include/memory_resource libcxx/include/numeric libcxx/include/ostream libcxx/include/random libcxx/include/ranges libcxx/include/stop_token libcxx/include/string_view libcxx/include/type_traits libcxx/include/utility libcxx/test/libcxx/containers/sequences/deque/abi.compile.pass.cpp libcxx/test/libcxx/containers/sequences/list/abi.compile.pass.cpp libcxx/test/libcxx/iterators/bounded_iter/arithmetic.pass.cpp libcxx/test/libcxx/iterators/bounded_iter/comparison.pass.cpp libcxx/test/libcxx/iterators/bounded_iter/dereference.pass.cpp libcxx/test/libcxx/iterators/bounded_iter/pointer_traits.pass.cpp libcxx/test/libcxx/iterators/bounded_iter/types.compile.pass.cpp libcxx/test/libcxx/memory/allocation_guard.pass.cpp libcxx/test/libcxx/memory/compressed_pair/compressed_pair.pass.cpp libcxx/test/libcxx/numerics/clamp_to_integral.pass.cpp libcxx/test/libcxx/ranges/range.adaptors/range.adaptor.helpers/as-lvalue.lifetimebound.verify.cpp libcxx/test/libcxx/ranges/range.adaptors/range.adaptor.helpers/as-lvalue.pass.cpp libcxx/test/libcxx/type_traits/is_callable.compile.pass.cpp libcxx/test/libcxx/type_traits/is_constant_evaluated.pass.cpp libcxx/test/libcxx/type_traits/is_implicitly_default_constructible.pass.cpp libcxx/test/libcxx/type_traits/is_specialization.compile.pass.cpp libcxx/test/libcxx/type_traits/is_specialization.verify.cpp libcxx/test/libcxx/type_traits/lazy_metafunctions.pass.cpp libcxx/test/libcxx/utilities/exception_guard.no_exceptions.pass.cpp libcxx/test/libcxx/utilities/exception_guard.pass.cpp libcxx/test/libcxx/utilities/function.objects/func.bind.partial/compose.pass.cpp libcxx/test/libcxx/utilities/meta/meta_base.pass.cpp libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/make.heap/ranges_make_heap.pass.cpp libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/pop.heap/ranges_pop_heap.pass.cpp libcxx/test/std/algorithms/alg.sorting/alg.heap.operations/push.heap/ranges_push_heap.pass.cpp libcxx/test/std/ranges/range.adaptors/range.all/range.owning.view/begin_end.pass.cpp libcxx/test/std/ranges/range.factories/range.repeat.view/iterator/plus_eq.pass.cpp libcxx/test/support/test_iterators.h
View the diff from clang-format here.
diff --git a/libcxx/include/stop_token b/libcxx/include/stop_token
index f4662cbfeb..d4e651d954 100644
--- a/libcxx/include/stop_token
+++ b/libcxx/include/stop_token
@@ -35,13 +35,13 @@ namespace std {
 
 #if !defined(_LIBCPP_HAS_NO_THREADS)
 
-#if _LIBCPP_STD_VER >= 20
-#  include <__stop_token/stop_callback.h>
-#  include <__stop_token/stop_source.h>
-#  include <__stop_token/stop_token.h>
-#endif
+#  if _LIBCPP_STD_VER >= 20
+#    include <__stop_token/stop_callback.h>
+#    include <__stop_token/stop_source.h>
+#    include <__stop_token/stop_token.h>
+#  endif
 
-#include <version>
+#  include <version>
 
 #  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #    pragma GCC system_header

@mordante
Copy link
Member

Thanks for working on this!

@philnik777 philnik777 merged commit dfddc0c into llvm:main Jul 18, 2024
9 of 11 checks passed
@philnik777 philnik777 deleted the include_by_dialect branch July 18, 2024 09:00
Harini0924 pushed a commit to Harini0924/llvm-project that referenced this pull request Jul 22, 2024
stuij added a commit to stuij/llvm-project that referenced this pull request Jul 22, 2024
Pull request llvm#96032 unconditionall adds the `cwchar` include in the `format`
umbrella header. However support for wchar_t can be disabled in the build
system (LIBCXX_ENABLE_WIDE_CHARACTERS).

This patch guards against inclusion of `cwchar` in `format` by checking the
`_LIBCPP_HAS_NO_WIDE_CHARACTERS` define.
stuij added a commit to stuij/llvm-project that referenced this pull request Jul 23, 2024
Pull request llvm#96032 unconditionall adds the `cwchar` include in the `format`
umbrella header. However support for wchar_t can be disabled in the build
system (LIBCXX_ENABLE_WIDE_CHARACTERS).

This patch guards against inclusion of `cwchar` in `format` by checking the
`_LIBCPP_HAS_NO_WIDE_CHARACTERS` define.
stuij added a commit to stuij/llvm-project that referenced this pull request Jul 23, 2024
Pull request llvm#96032 unconditionall adds the `cwchar` include in the `format`
umbrella header. However support for wchar_t can be disabled in the build
system (LIBCXX_ENABLE_WIDE_CHARACTERS).

This patch guards against inclusion of `cwchar` in `format` by checking the
`_LIBCPP_HAS_NO_WIDE_CHARACTERS` define.

For clarity I've also merged the include header section that cwchar was in with
the one above as they were both guarded by the same #if logic.
stuij added a commit that referenced this pull request Jul 23, 2024
Pull request #96032 unconditionall adds the `cwchar` include in the
`format` umbrella header. However support for wchar_t can be disabled in
the build system (LIBCXX_ENABLE_WIDE_CHARACTERS).

This patch guards against inclusion of `cwchar` in `format` by checking
the `_LIBCPP_HAS_NO_WIDE_CHARACTERS` define.

For clarity I've also merged the include header section that `cwchar`
was in with the one above as they were both guarded by the same `#if`
logic.
sgundapa pushed a commit to sgundapa/upstream_effort that referenced this pull request Jul 23, 2024
sgundapa pushed a commit to sgundapa/upstream_effort that referenced this pull request Jul 23, 2024
…#99911)

Pull request llvm#96032 unconditionall adds the `cwchar` include in the
`format` umbrella header. However support for wchar_t can be disabled in
the build system (LIBCXX_ENABLE_WIDE_CHARACTERS).

This patch guards against inclusion of `cwchar` in `format` by checking
the `_LIBCPP_HAS_NO_WIDE_CHARACTERS` define.

For clarity I've also merged the include header section that `cwchar`
was in with the one above as they were both guarded by the same `#if`
logic.
yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
…rella headers (#96032)

Summary: This is a follow-up to #83740.

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60250970
yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
Summary:
Pull request #96032 unconditionall adds the `cwchar` include in the
`format` umbrella header. However support for wchar_t can be disabled in
the build system (LIBCXX_ENABLE_WIDE_CHARACTERS).

This patch guards against inclusion of `cwchar` in `format` by checking
the `_LIBCPP_HAS_NO_WIDE_CHARACTERS` define.

For clarity I've also merged the include header section that `cwchar`
was in with the one above as they were both guarded by the same `#if`
logic.

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60251114
llvmbot pushed a commit to llvmbot/llvm-project that referenced this pull request Aug 30, 2024
…#99911)

Pull request llvm#96032 unconditionall adds the `cwchar` include in the
`format` umbrella header. However support for wchar_t can be disabled in
the build system (LIBCXX_ENABLE_WIDE_CHARACTERS).

This patch guards against inclusion of `cwchar` in `format` by checking
the `_LIBCPP_HAS_NO_WIDE_CHARACTERS` define.

For clarity I've also merged the include header section that `cwchar`
was in with the one above as they were both guarded by the same `#if`
logic.

(cherry picked from commit ec56790)
tru pushed a commit to llvmbot/llvm-project that referenced this pull request Sep 1, 2024
…#99911)

Pull request llvm#96032 unconditionall adds the `cwchar` include in the
`format` umbrella header. However support for wchar_t can be disabled in
the build system (LIBCXX_ENABLE_WIDE_CHARACTERS).

This patch guards against inclusion of `cwchar` in `format` by checking
the `_LIBCPP_HAS_NO_WIDE_CHARACTERS` define.

For clarity I've also merged the include header section that `cwchar`
was in with the one above as they were both guarded by the same `#if`
logic.

(cherry picked from commit ec56790)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants