Skip to content

Commit 6f05da6

Browse files
[libc++][Modules] Add missing submodules
Several headers that are included by the modular headers are missing from the module map, add those in. The either/or implementation headers `<__algorithm/pstl_backends/cpu_backends/serial.h>`/`<__algorithm/pstl_backends/cpu_backends/thread.h>` need to be textual, as does `<__undef_macros>`. Reviewed By: ldionne, #libc Differential Revision: https://reviews.llvm.org/D153213
1 parent 7b54626 commit 6f05da6

File tree

3 files changed

+79
-7
lines changed

3 files changed

+79
-7
lines changed

libcxx/include/__algorithm/pstl_replace.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <__algorithm/pstl_backend.h>
1313
#include <__algorithm/pstl_for_each.h>
1414
#include <__algorithm/pstl_frontend_dispatch.h>
15+
#include <__algorithm/pstl_transform.h>
1516
#include <__config>
1617
#include <__iterator/iterator_traits.h>
1718
#include <__type_traits/enable_if.h>

libcxx/include/module.modulemap.in

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,20 @@ module std [system] {
2828
header "fenv.h"
2929
export *
3030
}
31-
// <float.h> provided by compiler or C library.
31+
module float_t {
32+
header "float.h"
33+
export *
34+
}
3235
module inttypes_h {
3336
header "inttypes.h"
3437
export stdint_h
3538
export *
3639
}
3740
// <iso646.h> provided by compiler.
38-
// <limits.h> provided by compiler or C library.
41+
module limits_h {
42+
header "limits.h"
43+
export *
44+
}
3945
module locale_h {
4046
@requires_LIBCXX_ENABLE_LOCALIZATION@
4147
header "locale.h"
@@ -263,7 +269,10 @@ module std [system] {
263269
module equal_range { private header "__algorithm/equal_range.h" }
264270
module fill { private header "__algorithm/fill.h" }
265271
module fill_n { private header "__algorithm/fill_n.h" }
266-
module find { private header "__algorithm/find.h" }
272+
module find {
273+
private header "__algorithm/find.h"
274+
export algorithm.__algorithm.unwrap_iter
275+
}
267276
module find_end { private header "__algorithm/find_end.h" }
268277
module find_first_of { private header "__algorithm/find_first_of.h" }
269278
module find_if { private header "__algorithm/find_if.h" }
@@ -324,6 +333,11 @@ module std [system] {
324333
module partition_point { private header "__algorithm/partition_point.h" }
325334
module pop_heap { private header "__algorithm/pop_heap.h" }
326335
module prev_permutation { private header "__algorithm/prev_permutation.h" }
336+
module pstl_any_all_none_of { private header "__algorithm/pstl_any_all_none_of.h" }
337+
module pstl_backend {
338+
private header "__algorithm/pstl_backend.h"
339+
export *
340+
}
327341
module pstl_backends_cpu_backend {
328342
private header "__algorithm/pstl_backends/cpu_backend.h"
329343
export *
@@ -346,20 +360,45 @@ module std [system] {
346360
private header "__algorithm/pstl_backends/cpu_backends/merge.h"
347361
}
348362
module pstl_backends_cpu_backends_serial {
349-
private header "__algorithm/pstl_backends/cpu_backends/serial.h"
363+
private textual header "__algorithm/pstl_backends/cpu_backends/serial.h"
350364
}
351365
module pstl_backends_cpu_backends_stable_sort {
352366
private header "__algorithm/pstl_backends/cpu_backends/stable_sort.h"
353367
}
354368
module pstl_backends_cpu_backends_thread {
355-
private header "__algorithm/pstl_backends/cpu_backends/thread.h"
369+
private textual header "__algorithm/pstl_backends/cpu_backends/thread.h"
356370
}
357371
module pstl_backends_cpu_backends_transform {
358372
private header "__algorithm/pstl_backends/cpu_backends/transform.h"
359373
}
360374
module pstl_backends_cpu_backends_transform_reduce {
361375
private header "__algorithm/pstl_backends/cpu_backends/transform_reduce.h"
362376
}
377+
module pstl_copy { private header "__algorithm/pstl_copy.h" }
378+
module pstl_count { private header "__algorithm/pstl_count.h" }
379+
module pstl_fill { private header "__algorithm/pstl_fill.h" }
380+
module pstl_find {
381+
private header "__algorithm/pstl_find.h"
382+
export *
383+
}
384+
module pstl_for_each {
385+
private header "__algorithm/pstl_for_each.h"
386+
export algorithm.__algorithm.pstl_backend
387+
export iterator.__iterator.iterator_traits
388+
}
389+
module pstl_frontend_dispatch {
390+
private header "__algorithm/pstl_frontend_dispatch.h"
391+
export utility.__utility.forward
392+
}
393+
module pstl_generate { private header "__algorithm/pstl_generate.h" }
394+
module pstl_is_partitioned { private header "__algorithm/pstl_is_partitioned.h" }
395+
module pstl_merge { private header "__algorithm/pstl_merge.h" }
396+
module pstl_replace { private header "__algorithm/pstl_replace.h" }
397+
module pstl_stable_sort {
398+
private header "__algorithm/pstl_stable_sort.h"
399+
export functional.__functional.operations
400+
}
401+
module pstl_transform { private header "__algorithm/pstl_transform.h" }
363402
module push_heap { private header "__algorithm/push_heap.h" }
364403
module ranges_adjacent_find { private header "__algorithm/ranges_adjacent_find.h" }
365404
module ranges_all_of { private header "__algorithm/ranges_all_of.h" }
@@ -1205,6 +1244,12 @@ module std [system] {
12051244
@requires_LIBCXX_ENABLE_LOCALIZATION@
12061245
header "locale"
12071246
export *
1247+
1248+
module __locale {
1249+
module locale_base_api_bsd_locale_defaults { private textual header "__locale_dir/locale_base_api/bsd_locale_defaults.h" }
1250+
module locale_base_api_bsd_locale_fallbacks { private textual header "__locale_dir/locale_base_api/bsd_locale_fallbacks.h" }
1251+
module locale_base_api_locale_guard { private header "__locale_dir/locale_base_api/locale_guard.h" }
1252+
}
12081253
}
12091254
module map {
12101255
header "map"
@@ -1327,6 +1372,11 @@ module std [system] {
13271372
module iota { private header "__numeric/iota.h" }
13281373
module midpoint { private header "__numeric/midpoint.h" }
13291374
module partial_sum { private header "__numeric/partial_sum.h" }
1375+
module pstl_reduce { private header "__numeric/pstl_reduce.h" }
1376+
module pstl_transform_reduce {
1377+
private header "__numeric/pstl_transform_reduce.h"
1378+
export *
1379+
}
13301380
module reduce { private header "__numeric/reduce.h" }
13311381
module transform_exclusive_scan { private header "__numeric/transform_exclusive_scan.h" }
13321382
module transform_inclusive_scan { private header "__numeric/transform_inclusive_scan.h" }
@@ -1722,7 +1772,10 @@ module std [system] {
17221772
private header "__type_traits/is_equality_comparable.h"
17231773
export integral_constant
17241774
}
1725-
module is_execution_policy { private header "__type_traits/is_execution_policy.h" }
1775+
module is_execution_policy {
1776+
private header "__type_traits/is_execution_policy.h"
1777+
export type_traits.remove_cvref
1778+
}
17261779
module is_final { private header "__type_traits/is_final.h" }
17271780
module is_floating_point { private header "__type_traits/is_floating_point.h" }
17281781
module is_function { private header "__type_traits/is_function.h" }
@@ -1957,7 +2010,7 @@ module std [system] {
19572010
module __std_mbstate_t { private header "__std_mbstate_t.h" export * }
19582011
module __threading_support { header "__threading_support" export * }
19592012
module __tree { header "__tree" export * }
1960-
module __undef_macros { header "__undef_macros" export * }
2013+
module __undef_macros { textual header "__undef_macros" export * }
19612014
module __verbose_abort { header "__verbose_abort" export * }
19622015

19632016
// This one needs to appear after __tree to work around issues with modules in Objective-C++ mode.
@@ -2042,6 +2095,10 @@ module std [system] {
20422095
header "experimental/vector"
20432096
export *
20442097
}
2098+
module __config {
2099+
private textual header "experimental/__config"
2100+
export *
2101+
}
20452102
// FIXME these should be private
20462103
module __memory {
20472104
header "experimental/__memory"

libcxx/utils/libcxx/test/header_information.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,19 @@
7070
"__verbose_abort",
7171
]
7272

73+
# Headers that can't be included on their own. Most of these are conceptually
74+
# part of another header that were split out just for organization, but aren't
75+
# meant to be included by anything else.
76+
non_standalone_headers = frozenset((
77+
# Alternate implementations for __algorithm/pstl_backends/cpu_backends/backend.h
78+
"__algorithm/pstl_backends/cpu_backends/serial.h",
79+
"__algorithm/pstl_backends/cpu_backends/thread.h",
80+
81+
# Alternate implementations for locale.
82+
"__locale_dir/locale_base_api/bsd_locale_defaults.h",
83+
"__locale_dir/locale_base_api/bsd_locale_fallbacks.h",
84+
))
85+
7386
# This table was produced manually, by grepping the TeX source of the Standard's
7487
# library clauses for the string "#include". Each header's synopsis contains
7588
# explicit "#include" directives for its mandatory inclusions.
@@ -139,4 +152,5 @@ def is_header(file):
139152
p.relative_to(include).as_posix() for p in include.rglob("*") if is_header(p)
140153
and str(p.relative_to(include)).startswith("__")
141154
and not p.name.startswith("pstl")
155+
and str(p.relative_to(include)) not in non_standalone_headers
142156
)

0 commit comments

Comments
 (0)