[libcxx-commits] [libcxx] 79702f7 - [libc++][Modules] Add missing includes and exports

Ian Anderson via libcxx-commits libcxx-commits at lists.llvm.org
Sun May 7 17:54:54 PDT 2023


Author: Ian Anderson
Date: 2023-05-07T19:54:49-05:00
New Revision: 79702f7f593dece7afb67fec03df884d50525b96

URL: https://github.com/llvm/llvm-project/commit/79702f7f593dece7afb67fec03df884d50525b96
DIFF: https://github.com/llvm/llvm-project/commit/79702f7f593dece7afb67fec03df884d50525b96.diff

LOG: [libc++][Modules] Add missing includes and exports

Several headers are missing includes for things they use.

type_traits.is_enum needs to export type_traits.integral_constant so that clients can access its `value` member without explicitly including __type_traits/integral_constant.h themselves.

Make `subrange_fwd` a peer submodule to `subrange` rather than a submodule of it, and have `subrange` export `subrange_fwd`. That will make it easier to programmatically generate modules for the private detail headers, and it will accomplish the same effect that __ranges/subrange.h will make subrange_kind visible.

Reviewed By: Mordante, #libc

Differential Revision: https://reviews.llvm.org/D150055

Added: 
    

Modified: 
    libcxx/include/__algorithm/ranges_minmax.h
    libcxx/include/__algorithm/ranges_partition_copy.h
    libcxx/include/__format/format_arg.h
    libcxx/include/__functional/bind.h
    libcxx/include/__functional/bind_back.h
    libcxx/include/__functional/bind_front.h
    libcxx/include/__functional/boyer_moore_searcher.h
    libcxx/include/__functional/compose.h
    libcxx/include/__functional/function.h
    libcxx/include/__functional/not_fn.h
    libcxx/include/__hash_table
    libcxx/include/__locale
    libcxx/include/__ranges/copyable_box.h
    libcxx/include/__ranges/filter_view.h
    libcxx/include/__ranges/join_view.h
    libcxx/include/__ranges/range_adaptor.h
    libcxx/include/__ranges/transform_view.h
    libcxx/include/__ranges/zip_view.h
    libcxx/include/__tree
    libcxx/include/module.modulemap.in
    libcxx/include/optional
    libcxx/include/string_view
    libcxx/include/tuple
    libcxx/include/unordered_map

Removed: 
    


################################################################################
diff  --git a/libcxx/include/__algorithm/ranges_minmax.h b/libcxx/include/__algorithm/ranges_minmax.h
index 86540cc5686c9..2a966bbee84fd 100644
--- a/libcxx/include/__algorithm/ranges_minmax.h
+++ b/libcxx/include/__algorithm/ranges_minmax.h
@@ -23,6 +23,8 @@
 #include <__iterator/projected.h>
 #include <__ranges/access.h>
 #include <__ranges/concepts.h>
+#include <__type_traits/is_reference.h>
+#include <__type_traits/remove_cvref.h>
 #include <__utility/forward.h>
 #include <__utility/move.h>
 #include <__utility/pair.h>

diff  --git a/libcxx/include/__algorithm/ranges_partition_copy.h b/libcxx/include/__algorithm/ranges_partition_copy.h
index a27142880bc55..e398387bf0699 100644
--- a/libcxx/include/__algorithm/ranges_partition_copy.h
+++ b/libcxx/include/__algorithm/ranges_partition_copy.h
@@ -19,6 +19,7 @@
 #include <__ranges/access.h>
 #include <__ranges/concepts.h>
 #include <__ranges/dangling.h>
+#include <__type_traits/remove_cvref.h>
 #include <__utility/move.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)

diff  --git a/libcxx/include/__format/format_arg.h b/libcxx/include/__format/format_arg.h
index 7e37dd4f0b377..a27da8d74cc37 100644
--- a/libcxx/include/__format/format_arg.h
+++ b/libcxx/include/__format/format_arg.h
@@ -18,6 +18,8 @@
 #include <__format/format_parse_context.h>
 #include <__functional/invoke.h>
 #include <__memory/addressof.h>
+#include <__type_traits/conditional.h>
+#include <__type_traits/is_const.h>
 #include <__utility/declval.h>
 #include <__utility/forward.h>
 #include <__utility/unreachable.h>

diff  --git a/libcxx/include/__functional/bind.h b/libcxx/include/__functional/bind.h
index 1d5e531a2c696..b0c9bfe78cc79 100644
--- a/libcxx/include/__functional/bind.h
+++ b/libcxx/include/__functional/bind.h
@@ -13,6 +13,9 @@
 #include <__config>
 #include <__functional/invoke.h>
 #include <__functional/weak_result_type.h>
+#include <__type_traits/decay.h>
+#include <__type_traits/is_reference_wrapper.h>
+#include <__type_traits/is_void.h>
 #include <cstddef>
 #include <tuple>
 

diff  --git a/libcxx/include/__functional/bind_back.h b/libcxx/include/__functional/bind_back.h
index 544315d6ea55f..71dc63c86bdbe 100644
--- a/libcxx/include/__functional/bind_back.h
+++ b/libcxx/include/__functional/bind_back.h
@@ -13,6 +13,7 @@
 #include <__config>
 #include <__functional/invoke.h>
 #include <__functional/perfect_forward.h>
+#include <__type_traits/decay.h>
 #include <__utility/forward.h>
 #include <__utility/integer_sequence.h>
 #include <tuple>

diff  --git a/libcxx/include/__functional/bind_front.h b/libcxx/include/__functional/bind_front.h
index 109a83c2104f6..72bb664809596 100644
--- a/libcxx/include/__functional/bind_front.h
+++ b/libcxx/include/__functional/bind_front.h
@@ -13,6 +13,11 @@
 #include <__config>
 #include <__functional/invoke.h>
 #include <__functional/perfect_forward.h>
+#include <__type_traits/conjunction.h>
+#include <__type_traits/decay.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_constructible.h>
+#include <__type_traits/is_move_constructible.h>
 #include <__utility/forward.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)

diff  --git a/libcxx/include/__functional/boyer_moore_searcher.h b/libcxx/include/__functional/boyer_moore_searcher.h
index d5384e9009d6a..0165e062810fe 100644
--- a/libcxx/include/__functional/boyer_moore_searcher.h
+++ b/libcxx/include/__functional/boyer_moore_searcher.h
@@ -20,6 +20,7 @@
 #include <__iterator/distance.h>
 #include <__iterator/iterator_traits.h>
 #include <__memory/shared_ptr.h>
+#include <__type_traits/make_unsigned.h>
 #include <__utility/pair.h>
 #include <array>
 #include <unordered_map>

diff  --git a/libcxx/include/__functional/compose.h b/libcxx/include/__functional/compose.h
index 168131e1d9ea3..80fcd7076c831 100644
--- a/libcxx/include/__functional/compose.h
+++ b/libcxx/include/__functional/compose.h
@@ -13,6 +13,7 @@
 #include <__config>
 #include <__functional/invoke.h>
 #include <__functional/perfect_forward.h>
+#include <__type_traits/decay.h>
 #include <__utility/forward.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)

diff  --git a/libcxx/include/__functional/function.h b/libcxx/include/__functional/function.h
index 1f94d79f79837..f3abba4536c7f 100644
--- a/libcxx/include/__functional/function.h
+++ b/libcxx/include/__functional/function.h
@@ -25,8 +25,12 @@
 #include <__memory/compressed_pair.h>
 #include <__memory/unique_ptr.h>
 #include <__type_traits/aligned_storage.h>
+#include <__type_traits/decay.h>
+#include <__type_traits/is_core_convertible.h>
+#include <__type_traits/is_scalar.h>
 #include <__type_traits/is_trivially_copy_constructible.h>
 #include <__type_traits/is_trivially_destructible.h>
+#include <__type_traits/is_void.h>
 #include <__type_traits/strip_signature.h>
 #include <__utility/forward.h>
 #include <__utility/move.h>

diff  --git a/libcxx/include/__functional/not_fn.h b/libcxx/include/__functional/not_fn.h
index f148a408eeec9..0cdb1b7e238b2 100644
--- a/libcxx/include/__functional/not_fn.h
+++ b/libcxx/include/__functional/not_fn.h
@@ -13,6 +13,10 @@
 #include <__config>
 #include <__functional/invoke.h>
 #include <__functional/perfect_forward.h>
+#include <__type_traits/decay.h>
+#include <__type_traits/enable_if.h>
+#include <__type_traits/is_constructible.h>
+#include <__type_traits/is_move_constructible.h>
 #include <__utility/forward.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)

diff  --git a/libcxx/include/__hash_table b/libcxx/include/__hash_table
index 289c772092a01..570e8209cbddf 100644
--- a/libcxx/include/__hash_table
+++ b/libcxx/include/__hash_table
@@ -30,10 +30,13 @@
 #include <__type_traits/is_const.h>
 #include <__type_traits/is_copy_constructible.h>
 #include <__type_traits/is_nothrow_constructible.h>
+#include <__type_traits/is_nothrow_copy_constructible.h>
 #include <__type_traits/is_nothrow_default_constructible.h>
+#include <__type_traits/is_nothrow_move_assignable.h>
 #include <__type_traits/is_nothrow_move_constructible.h>
 #include <__type_traits/is_pointer.h>
 #include <__type_traits/is_reference.h>
+#include <__type_traits/is_swappable.h>
 #include <__type_traits/remove_const.h>
 #include <__type_traits/remove_cvref.h>
 #include <__utility/forward.h>

diff  --git a/libcxx/include/__locale b/libcxx/include/__locale
index f189ea631dfdb..4a031ef08ed92 100644
--- a/libcxx/include/__locale
+++ b/libcxx/include/__locale
@@ -12,6 +12,7 @@
 
 #include <__availability>
 #include <__config>
+#include <__type_traits/make_unsigned.h>
 #include <cctype>
 #include <clocale>
 #include <cstdint>

diff  --git a/libcxx/include/__ranges/copyable_box.h b/libcxx/include/__ranges/copyable_box.h
index 1973bbffc3cf8..9fbbb1eae90eb 100644
--- a/libcxx/include/__ranges/copyable_box.h
+++ b/libcxx/include/__ranges/copyable_box.h
@@ -16,6 +16,9 @@
 #include <__config>
 #include <__memory/addressof.h>
 #include <__memory/construct_at.h>
+#include <__type_traits/is_nothrow_constructible.h>
+#include <__type_traits/is_nothrow_copy_constructible.h>
+#include <__type_traits/is_nothrow_default_constructible.h>
 #include <__utility/move.h>
 #include <optional>
 

diff  --git a/libcxx/include/__ranges/filter_view.h b/libcxx/include/__ranges/filter_view.h
index 28d08c8a67e3b..4acbfad54cc58 100644
--- a/libcxx/include/__ranges/filter_view.h
+++ b/libcxx/include/__ranges/filter_view.h
@@ -32,6 +32,10 @@
 #include <__ranges/non_propagating_cache.h>
 #include <__ranges/range_adaptor.h>
 #include <__ranges/view_interface.h>
+#include <__type_traits/conditional.h>
+#include <__type_traits/decay.h>
+#include <__type_traits/is_nothrow_constructible.h>
+#include <__type_traits/is_object.h>
 #include <__utility/forward.h>
 #include <__utility/in_place.h>
 #include <__utility/move.h>

diff  --git a/libcxx/include/__ranges/join_view.h b/libcxx/include/__ranges/join_view.h
index 83145ffb23a92..b743425c0ac68 100644
--- a/libcxx/include/__ranges/join_view.h
+++ b/libcxx/include/__ranges/join_view.h
@@ -30,6 +30,7 @@
 #include <__ranges/non_propagating_cache.h>
 #include <__ranges/range_adaptor.h>
 #include <__ranges/view_interface.h>
+#include <__type_traits/common_type.h>
 #include <__type_traits/maybe_const.h>
 #include <__utility/forward.h>
 #include <optional>

diff  --git a/libcxx/include/__ranges/range_adaptor.h b/libcxx/include/__ranges/range_adaptor.h
index 532485b90ab8b..da78d3bd87306 100644
--- a/libcxx/include/__ranges/range_adaptor.h
+++ b/libcxx/include/__ranges/range_adaptor.h
@@ -18,6 +18,9 @@
 #include <__functional/compose.h>
 #include <__functional/invoke.h>
 #include <__ranges/concepts.h>
+#include <__type_traits/decay.h>
+#include <__type_traits/is_nothrow_constructible.h>
+#include <__type_traits/remove_cvref.h>
 #include <__utility/forward.h>
 #include <__utility/move.h>
 

diff  --git a/libcxx/include/__ranges/transform_view.h b/libcxx/include/__ranges/transform_view.h
index 14bd400e6d079..8bdfa97355476 100644
--- a/libcxx/include/__ranges/transform_view.h
+++ b/libcxx/include/__ranges/transform_view.h
@@ -31,7 +31,13 @@
 #include <__ranges/range_adaptor.h>
 #include <__ranges/size.h>
 #include <__ranges/view_interface.h>
+#include <__type_traits/conditional.h>
+#include <__type_traits/decay.h>
+#include <__type_traits/is_nothrow_constructible.h>
+#include <__type_traits/is_object.h>
+#include <__type_traits/is_reference.h>
 #include <__type_traits/maybe_const.h>
+#include <__type_traits/remove_cvref.h>
 #include <__utility/forward.h>
 #include <__utility/in_place.h>
 #include <__utility/move.h>

diff  --git a/libcxx/include/__ranges/zip_view.h b/libcxx/include/__ranges/zip_view.h
index b2067f659e341..2fd1fb30475ab 100644
--- a/libcxx/include/__ranges/zip_view.h
+++ b/libcxx/include/__ranges/zip_view.h
@@ -30,6 +30,8 @@
 #include <__ranges/enable_borrowed_range.h>
 #include <__ranges/size.h>
 #include <__ranges/view_interface.h>
+#include <__type_traits/is_nothrow_move_constructible.h>
+#include <__type_traits/make_unsigned.h>
 #include <__utility/declval.h>
 #include <__utility/forward.h>
 #include <__utility/integer_sequence.h>

diff  --git a/libcxx/include/__tree b/libcxx/include/__tree
index 02577ca2aa386..140e78cecc4da 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -27,6 +27,7 @@
 #include <__type_traits/can_extract_key.h>
 #include <__type_traits/conditional.h>
 #include <__type_traits/is_const.h>
+#include <__type_traits/is_copy_constructible.h>
 #include <__type_traits/is_nothrow_copy_constructible.h>
 #include <__type_traits/is_nothrow_default_constructible.h>
 #include <__type_traits/is_nothrow_move_assignable.h>

diff  --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in
index 9bbf7ffd810be..9d01d36e754ab 100644
--- a/libcxx/include/module.modulemap.in
+++ b/libcxx/include/module.modulemap.in
@@ -1352,9 +1352,9 @@ module std [system] {
       module split_view             { private header "__ranges/split_view.h" }
       module subrange               {
         private header "__ranges/subrange.h"
-
-        module subrange_fwd { private header "__fwd/subrange.h" }
+        export subrange_fwd
       }
+      module subrange_fwd           { private header "__fwd/subrange.h" }
       module take_view              { private header "__ranges/take_view.h" }
       module take_while_view        { private header "__ranges/take_while_view.h" }
       module transform_view         {
@@ -1558,7 +1558,10 @@ module std [system] {
     module is_default_constructible            { private header "__type_traits/is_default_constructible.h" }
     module is_destructible                     { private header "__type_traits/is_destructible.h" }
     module is_empty                            { private header "__type_traits/is_empty.h" }
-    module is_enum                             { private header "__type_traits/is_enum.h" }
+    module is_enum                             {
+      private header "__type_traits/is_enum.h"
+      export integral_constant
+    }
     module is_equality_comparable                       {
       private header "__type_traits/is_equality_comparable.h"
       export integral_constant

diff  --git a/libcxx/include/optional b/libcxx/include/optional
index 8895ed152dc82..68fb4c914eec4 100644
--- a/libcxx/include/optional
+++ b/libcxx/include/optional
@@ -185,18 +185,40 @@ namespace std {
 #include <__config>
 #include <__functional/hash.h>
 #include <__functional/invoke.h>
+#include <__functional/reference_wrapper.h>
 #include <__functional/unary_function.h>
 #include <__memory/addressof.h>
 #include <__memory/construct_at.h>
 #include <__tuple/sfinae_helpers.h>
+#include <__type_traits/add_pointer.h>
+#include <__type_traits/conditional.h>
 #include <__type_traits/conjunction.h>
+#include <__type_traits/decay.h>
 #include <__type_traits/disjunction.h>
+#include <__type_traits/is_array.h>
+#include <__type_traits/is_assignable.h>
+#include <__type_traits/is_constructible.h>
+#include <__type_traits/is_convertible.h>
+#include <__type_traits/is_copy_assignable.h>
+#include <__type_traits/is_copy_constructible.h>
+#include <__type_traits/is_destructible.h>
+#include <__type_traits/is_move_assignable.h>
+#include <__type_traits/is_move_constructible.h>
+#include <__type_traits/is_nothrow_move_assignable.h>
+#include <__type_traits/is_nothrow_move_constructible.h>
+#include <__type_traits/is_object.h>
+#include <__type_traits/is_reference.h>
+#include <__type_traits/is_scalar.h>
+#include <__type_traits/is_swappable.h>
 #include <__type_traits/is_trivially_copy_assignable.h>
 #include <__type_traits/is_trivially_copy_constructible.h>
 #include <__type_traits/is_trivially_destructible.h>
 #include <__type_traits/is_trivially_move_assignable.h>
 #include <__type_traits/is_trivially_move_constructible.h>
 #include <__type_traits/negation.h>
+#include <__type_traits/remove_const.h>
+#include <__type_traits/remove_cvref.h>
+#include <__type_traits/remove_reference.h>
 #include <__utility/declval.h>
 #include <__utility/forward.h>
 #include <__utility/in_place.h>

diff  --git a/libcxx/include/string_view b/libcxx/include/string_view
index ac7d182a7f296..d050b996ecb9e 100644
--- a/libcxx/include/string_view
+++ b/libcxx/include/string_view
@@ -227,6 +227,7 @@ namespace std {
 #include <__type_traits/remove_cvref.h>
 #include <__type_traits/remove_reference.h>
 #include <__type_traits/type_identity.h>
+#include <cstddef>
 #include <iosfwd>
 #include <limits>
 #include <stdexcept>

diff  --git a/libcxx/include/tuple b/libcxx/include/tuple
index f9e9ff2e51ba6..3c9715f6f02fe 100644
--- a/libcxx/include/tuple
+++ b/libcxx/include/tuple
@@ -208,8 +208,16 @@ template <class... Types>
 #include <__functional/invoke.h>
 #include <__functional/unwrap_ref.h>
 #include <__fwd/array.h>
+#include <__fwd/tuple.h>
 #include <__memory/allocator_arg_t.h>
 #include <__memory/uses_allocator.h>
+#include <__tuple/make_tuple_types.h>
+#include <__tuple/sfinae_helpers.h>
+#include <__tuple/tuple_element.h>
+#include <__tuple/tuple_indices.h>
+#include <__tuple/tuple_like_ext.h>
+#include <__tuple/tuple_size.h>
+#include <__tuple/tuple_types.h>
 #include <__type_traits/apply_cv.h>
 #include <__type_traits/common_reference.h>
 #include <__type_traits/common_type.h>

diff  --git a/libcxx/include/unordered_map b/libcxx/include/unordered_map
index ce3d61fafb0e5..b5afdfcf943f2 100644
--- a/libcxx/include/unordered_map
+++ b/libcxx/include/unordered_map
@@ -529,6 +529,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
 #include <__memory_resource/polymorphic_allocator.h>
 #include <__node_handle>
 #include <__type_traits/is_allocator.h>
+#include <__type_traits/type_identity.h>
 #include <__utility/forward.h>
 #include <stdexcept>
 #include <tuple>


        


More information about the libcxx-commits mailing list