Skip to content

Commit 5e19fd1

Browse files
authored
[libc++][modules] Consolidate leaf modules into their own top-level modules (#107147)
Some modules are leaf modules in the sense that they are not used by any other part of the headers. These leaf modules are easy to consolidate since there is no risk to create a cycle. As a result of regrouping these modules, several missing includes were found and fixed in this patch.
1 parent 23f6c33 commit 5e19fd1

File tree

90 files changed

+234
-146
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+234
-146
lines changed

libcxx/include/__filesystem/directory_entry.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <__filesystem/operations.h>
2121
#include <__filesystem/path.h>
2222
#include <__filesystem/perms.h>
23+
#include <__fwd/ostream.h>
2324
#include <__system_error/errc.h>
2425
#include <__system_error/error_code.h>
2526
#include <__utility/move.h>

libcxx/include/__filesystem/path.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <__type_traits/is_pointer.h>
2222
#include <__type_traits/remove_const.h>
2323
#include <__type_traits/remove_pointer.h>
24+
#include <__utility/move.h>
2425
#include <cstddef>
2526
#include <string>
2627
#include <string_view>

libcxx/include/__mdspan/layout_left.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <__config>
2222
#include <__fwd/mdspan.h>
2323
#include <__mdspan/extents.h>
24+
#include <__type_traits/common_type.h>
2425
#include <__type_traits/is_constructible.h>
2526
#include <__type_traits/is_convertible.h>
2627
#include <__type_traits/is_nothrow_constructible.h>

libcxx/include/__mdspan/layout_right.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <__config>
2222
#include <__fwd/mdspan.h>
2323
#include <__mdspan/extents.h>
24+
#include <__type_traits/common_type.h>
2425
#include <__type_traits/is_constructible.h>
2526
#include <__type_traits/is_convertible.h>
2627
#include <__type_traits/is_nothrow_constructible.h>

libcxx/include/__mdspan/layout_stride.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,23 @@
1818
#define _LIBCPP___MDSPAN_LAYOUT_STRIDE_H
1919

2020
#include <__assert>
21+
#include <__concepts/same_as.h>
2122
#include <__config>
2223
#include <__fwd/mdspan.h>
2324
#include <__mdspan/extents.h>
25+
#include <__type_traits/common_type.h>
2426
#include <__type_traits/is_constructible.h>
2527
#include <__type_traits/is_convertible.h>
2628
#include <__type_traits/is_nothrow_constructible.h>
29+
#include <__type_traits/is_same.h>
2730
#include <__utility/as_const.h>
2831
#include <__utility/integer_sequence.h>
2932
#include <__utility/swap.h>
3033
#include <array>
3134
#include <cinttypes>
3235
#include <cstddef>
3336
#include <limits>
37+
#include <span>
3438

3539
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
3640
# pragma GCC system_header

libcxx/include/module.modulemap

Lines changed: 47 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ module std_bitset [system] {
2929
}
3030
module std_charconv [system] {
3131
header "charconv"
32+
module chars_format { header "__charconv/chars_format.h" }
33+
module from_chars_integral { header "__charconv/from_chars_integral.h" }
34+
module from_chars_result { header "__charconv/from_chars_result.h" }
35+
module tables { header "__charconv/tables.h" }
36+
module to_chars { header "__charconv/to_chars.h" }
37+
module to_chars_base_10 { header "__charconv/to_chars_base_10.h" }
38+
module to_chars_floating_point { header "__charconv/to_chars_floating_point.h" }
39+
module to_chars_integral { header "__charconv/to_chars_integral.h" }
40+
module to_chars_result { header "__charconv/to_chars_result.h" }
41+
module traits { header "__charconv/traits.h" }
3242
export *
3343
}
3444
module std_chrono [system] {
@@ -53,10 +63,15 @@ module std_concepts [system] {
5363
}
5464
module std_condition_variable [system] {
5565
header "condition_variable"
66+
module condition_variable { header "__condition_variable/condition_variable.h" }
5667
export *
5768
}
5869
module std_coroutine [system] {
5970
header "coroutine"
71+
module coroutine_handle { header "__coroutine/coroutine_handle.h" }
72+
module coroutine_traits { header "__coroutine/coroutine_traits.h" }
73+
module noop_coroutine_handle { header "__coroutine/noop_coroutine_handle.h" }
74+
module trivial_awaitables { header "__coroutine/trivial_awaitables.h" }
6075
export *
6176
}
6277
module std_deque [system] {
@@ -77,6 +92,28 @@ module std_expected [system] {
7792
}
7893
module std_filesystem [system] {
7994
header "filesystem"
95+
module copy_options { header "__filesystem/copy_options.h" }
96+
module directory_entry { header "__filesystem/directory_entry.h" }
97+
module directory_iterator { header "__filesystem/directory_iterator.h" }
98+
module directory_options { header "__filesystem/directory_options.h" }
99+
module file_status { header "__filesystem/file_status.h" }
100+
module file_time_type { header "__filesystem/file_time_type.h" }
101+
module file_type { header "__filesystem/file_type.h" }
102+
module filesystem_error {
103+
header "__filesystem/filesystem_error.h"
104+
export std_private_memory_shared_ptr
105+
}
106+
module operations { header "__filesystem/operations.h" }
107+
module path {
108+
header "__filesystem/path.h"
109+
export std_string // returned by various methods
110+
}
111+
module path_iterator { header "__filesystem/path_iterator.h" }
112+
module perm_options { header "__filesystem/perm_options.h" }
113+
module perms { header "__filesystem/perms.h" }
114+
module recursive_directory_iterator { header "__filesystem/recursive_directory_iterator.h" }
115+
module space_info { header "__filesystem/space_info.h" }
116+
module u8path { header "__filesystem/u8path.h" }
80117
export *
81118
}
82119
module std_format [system] {
@@ -149,6 +186,16 @@ module std_map [system] {
149186
}
150187
module std_mdspan [system] {
151188
header "mdspan"
189+
module default_accessor { header "__mdspan/default_accessor.h" }
190+
module extents { header "__mdspan/extents.h" }
191+
module fwd { header "__fwd/mdspan.h" }
192+
module layout_left { header "__mdspan/layout_left.h" }
193+
module layout_right { header "__mdspan/layout_right.h" }
194+
module layout_stride { header "__mdspan/layout_stride.h" }
195+
module mdspan {
196+
header "__mdspan/mdspan.h"
197+
export std_array // for strides()
198+
}
152199
export *
153200
}
154201
module std_memory [system] {
@@ -1082,23 +1129,6 @@ module std_private_bit_invert_if [system] { header "__bit/invert_if.h" }
10821129
module std_private_bit_popcount [system] { header "__bit/popcount.h" }
10831130
module std_private_bit_rotate [system] { header "__bit/rotate.h" }
10841131

1085-
module std_private_charconv_chars_format [system] { header "__charconv/chars_format.h" }
1086-
module std_private_charconv_from_chars_integral [system] { header "__charconv/from_chars_integral.h" }
1087-
module std_private_charconv_from_chars_result [system] { header "__charconv/from_chars_result.h" }
1088-
module std_private_charconv_tables [system] { header "__charconv/tables.h" }
1089-
module std_private_charconv_to_chars [system] { header "__charconv/to_chars.h" }
1090-
module std_private_charconv_to_chars_base_10 [system] { header "__charconv/to_chars_base_10.h" }
1091-
module std_private_charconv_to_chars_floating_point [system] { header "__charconv/to_chars_floating_point.h" }
1092-
module std_private_charconv_to_chars_integral [system] {
1093-
header "__charconv/to_chars_integral.h"
1094-
export std_private_charconv_traits
1095-
}
1096-
module std_private_charconv_to_chars_result [system] {
1097-
header "__charconv/to_chars_result.h"
1098-
export *
1099-
}
1100-
module std_private_charconv_traits [system] { header "__charconv/traits.h" }
1101-
11021132
module std_private_chrono_calendar [system] { header "__chrono/calendar.h" }
11031133
module std_private_chrono_concepts [system] { header "__chrono/concepts.h" }
11041134
module std_private_chrono_convert_to_timespec [system] { header "__chrono/convert_to_timespec.h" }
@@ -1223,16 +1253,6 @@ module std_private_concepts_semiregular [system] { header "__concepts/
12231253
module std_private_concepts_swappable [system] { header "__concepts/swappable.h" }
12241254
module std_private_concepts_totally_ordered [system] { header "__concepts/totally_ordered.h" }
12251255

1226-
module std_private_condition_variable_condition_variable [system] {
1227-
header "__condition_variable/condition_variable.h"
1228-
export *
1229-
}
1230-
1231-
module std_private_coroutine_coroutine_handle [system] { header "__coroutine/coroutine_handle.h" }
1232-
module std_private_coroutine_coroutine_traits [system] { header "__coroutine/coroutine_traits.h" }
1233-
module std_private_coroutine_noop_coroutine_handle [system] { header "__coroutine/noop_coroutine_handle.h" }
1234-
module std_private_coroutine_trivial_awaitables [system] { header "__coroutine/trivial_awaitables.h" }
1235-
12361256
module std_private_debug_utils_randomize_range [system] { header "__debug_utils/randomize_range.h" }
12371257
module std_private_debug_utils_sanitizers [system] { header "__debug_utils/sanitizers.h" }
12381258
module std_private_debug_utils_strict_weak_ordering_check [system] {
@@ -1256,38 +1276,6 @@ module std_private_expected_expected [system] { header "__expected/ex
12561276
module std_private_expected_unexpect [system] { header "__expected/unexpect.h" }
12571277
module std_private_expected_unexpected [system] { header "__expected/unexpected.h" }
12581278

1259-
module std_private_filesystem_copy_options [system] { header "__filesystem/copy_options.h" }
1260-
module std_private_filesystem_directory_entry [system] {
1261-
header "__filesystem/directory_entry.h"
1262-
export *
1263-
}
1264-
module std_private_filesystem_directory_iterator [system] {
1265-
header "__filesystem/directory_iterator.h"
1266-
export *
1267-
}
1268-
module std_private_filesystem_directory_options [system] { header "__filesystem/directory_options.h" }
1269-
module std_private_filesystem_file_status [system] { header "__filesystem/file_status.h" }
1270-
module std_private_filesystem_file_time_type [system] { header "__filesystem/file_time_type.h" }
1271-
module std_private_filesystem_file_type [system] { header "__filesystem/file_type.h" }
1272-
module std_private_filesystem_filesystem_error [system] {
1273-
header "__filesystem/filesystem_error.h"
1274-
export *
1275-
}
1276-
module std_private_filesystem_operations [system] { header "__filesystem/operations.h" }
1277-
module std_private_filesystem_path [system] {
1278-
header "__filesystem/path.h"
1279-
export *
1280-
}
1281-
module std_private_filesystem_path_iterator [system] { header "__filesystem/path_iterator.h" }
1282-
module std_private_filesystem_perm_options [system] { header "__filesystem/perm_options.h" }
1283-
module std_private_filesystem_perms [system] { header "__filesystem/perms.h" }
1284-
module std_private_filesystem_recursive_directory_iterator [system] {
1285-
header "__filesystem/recursive_directory_iterator.h"
1286-
export *
1287-
}
1288-
module std_private_filesystem_space_info [system] { header "__filesystem/space_info.h" }
1289-
module std_private_filesystem_u8path [system] { header "__filesystem/u8path.h" }
1290-
12911279
module std_private_format_buffer [system] { header "__format/buffer.h" }
12921280
module std_private_format_concepts [system] { header "__format/concepts.h" }
12931281
module std_private_format_container_adaptor [system] { header "__format/container_adaptor.h" }
@@ -1496,17 +1484,6 @@ module std_private_math_special_functions [system] { header "__mat
14961484
module std_private_math_traits [system] { header "__math/traits.h" }
14971485
module std_private_math_trigonometric_functions [system] { header "__math/trigonometric_functions.h" }
14981486

1499-
module std_private_mdspan_default_accessor [system] { header "__mdspan/default_accessor.h" }
1500-
module std_private_mdspan_extents [system] {
1501-
header "__mdspan/extents.h"
1502-
export *
1503-
}
1504-
module std_private_mdspan_layout_left [system] { header "__mdspan/layout_left.h" }
1505-
module std_private_mdspan_layout_right [system] { header "__mdspan/layout_right.h" }
1506-
module std_private_mdspan_layout_stride [system] { header "__mdspan/layout_stride.h" }
1507-
module std_private_mdspan_mdspan [system] { header "__mdspan/mdspan.h" }
1508-
module std_private_mdspan_mdspan_fwd [system] { header "__fwd/mdspan.h" }
1509-
15101487
module std_private_memory_addressof [system] { header "__memory/addressof.h" }
15111488
module std_private_memory_align [system] { header "__memory/align.h" }
15121489
module std_private_memory_aligned_alloc [system] { header "__memory/aligned_alloc.h" }

libcxx/test/std/containers/views/mdspan/CustomTestLayouts.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <cstddef>
2626
#include <limits>
2727
#include <mdspan>
28+
#include <span> // dynamic_extent
2829
#include <type_traits>
2930
#include <utility>
3031

libcxx/test/std/containers/views/mdspan/extents/comparison.pass.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818
//
1919

2020
#include <mdspan>
21-
#include <type_traits>
22-
#include <concepts>
2321
#include <cassert>
22+
#include <concepts>
23+
#include <span> // dynamic_extent
24+
#include <type_traits>
2425

2526
#include "test_macros.h"
2627

libcxx/test/std/containers/views/mdspan/extents/conversion.pass.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@
2929
// (numeric_limits<index_type>::max() < numeric_limits<OtherIndexType>::max())
3030

3131
#include <mdspan>
32-
#include <type_traits>
33-
#include <concepts>
3432
#include <cassert>
33+
#include <concepts>
3534
#include <limits>
35+
#include <span> // dynamic_extent
36+
#include <type_traits>
3637

3738
#include "test_macros.h"
3839

libcxx/test/std/containers/views/mdspan/extents/ctad.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <mdspan>
2020
#include <cassert>
21+
#include <span> // dynamic_extent
2122
#include <type_traits>
2223

2324
#include "../ConvertibleToIntegral.h"

libcxx/test/std/containers/views/mdspan/extents/dextents.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <mdspan>
2020
#include <cstddef>
21+
#include <span> // dynamic_extent
2122

2223
#include "test_macros.h"
2324

libcxx/test/std/containers/views/mdspan/extents/dims.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
#include <mdspan>
2020
#include <cstddef>
21+
#include <span> // dynamic_extent
2122

2223
#include "test_macros.h"
2324

libcxx/test/std/containers/views/mdspan/extents/index_type.verify.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <cstddef>
2020
#include <climits>
2121
#include <mdspan>
22+
#include <span> // dynamic_extent
2223

2324
void invalid_index_types() {
2425
// expected-error@*:* {{static assertion failed: extents::index_type must be a signed or unsigned integer type}}

libcxx/test/std/containers/views/mdspan/extents/obs_static.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
#include <mdspan>
3030
#include <cassert>
31+
#include <span> // dynamic_extent
3132
#include <utility>
3233

3334
#include "test_macros.h"

libcxx/test/std/containers/views/mdspan/extents/types.pass.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@
2323
// }
2424

2525
#include <mdspan>
26-
#include <type_traits>
27-
#include <concepts>
2826
#include <cassert>
27+
#include <concepts>
28+
#include <span> // dynamic_extent
29+
#include <type_traits>
2930

3031
#include "test_macros.h"
3132

libcxx/test/std/containers/views/mdspan/layout_left/comparison.pass.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
// Constraints: extents_type::rank() == OtherExtents::rank() is true.
1717

1818
#include <mdspan>
19-
#include <type_traits>
20-
#include <concepts>
2119
#include <cassert>
20+
#include <concepts>
21+
#include <span> // dynamic_extent
22+
#include <type_traits>
2223

2324
#include "test_macros.h"
2425

libcxx/test/std/containers/views/mdspan/layout_left/ctor.default.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <mdspan>
1818
#include <cassert>
1919
#include <cstdint>
20+
#include <span> // dynamic_extent
2021

2122
#include "test_macros.h"
2223

libcxx/test/std/containers/views/mdspan/layout_left/ctor.extents.pass.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <mdspan>
2121
#include <cassert>
2222
#include <cstdint>
23+
#include <span> // dynamic_extent
2324

2425
#include "test_macros.h"
2526

libcxx/test/std/containers/views/mdspan/layout_left/ctor.layout_right.pass.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@
2121
// Preconditions: other.required_span_size() is representable as a value of type index_type
2222

2323
#include <mdspan>
24-
#include <type_traits>
2524
#include <cassert>
2625
#include <limits>
26+
#include <span> // dynamic_extent
27+
#include <type_traits>
2728

2829
#include "test_macros.h"
2930

libcxx/test/std/containers/views/mdspan/layout_left/ctor.layout_stride.pass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@
2424
// Effects: Direct-non-list-initializes extents_ with other.extents().
2525

2626
#include <mdspan>
27-
#include <type_traits>
27+
#include <array>
2828
#include <cassert>
2929
#include <limits>
30+
#include <span> // dynamic_extent
31+
#include <type_traits>
3032

3133
#include "test_macros.h"
3234

libcxx/test/std/containers/views/mdspan/layout_left/ctor.mapping.pass.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
// Preconditions: other.required_span_size() is representable as a value of type index_type
2020

2121
#include <mdspan>
22-
#include <type_traits>
2322
#include <cassert>
2423
#include <limits>
24+
#include <span> // dynamic_extent
25+
#include <type_traits>
2526

2627
#include "test_macros.h"
2728

libcxx/test/std/containers/views/mdspan/layout_left/index_operator.pass.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@
2424
// * extents_type::index-cast(i) is a multidimensional index in extents_.
2525

2626
#include <mdspan>
27+
#include <type_traits>
2728
#include <cassert>
2829
#include <cstdint>
30+
#include <span> // dynamic_extent
2931

3032
#include "test_macros.h"
3133

0 commit comments

Comments
 (0)