Skip to content

Commit

Permalink
[libc++][Modules] Make module exports consistent with header includes
Browse files Browse the repository at this point in the history
Some modules export modules that they don't import (i.e. that their header doesn't directly include). That sometimes works when the exported submodule is in the same module, but when the `std` mega module is broken up (D144322), some of the exports stop working. Make the exports and includes consistent, either by adding includes for the exports, or by removing exports for missing includes.

The `concepts.equality_comparable` export in `std.iterator.__iterator.concepts` isn't doing anything because 1) it's resolved as `std.iterator.__iterator.concepts.equality_comparable` and 2) there's a `__concepts` submodule in between `std.concepts` and `equality_comparable`. Fix it to be `std.concepts.__concepts.equality_comparable`.

<span> is listed in both `std.span` and `std.experimental.span`. Delete the latter module.
There is no `__errc` module or header, so remove that export from `std.system_error`.

Reviewed By: ldionne, #libc

Differential Revision: https://reviews.llvm.org/D153211
  • Loading branch information
ian-twilightcoder committed Jun 29, 2023
1 parent f78c9be commit 40cdb22
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 23 deletions.
1 change: 1 addition & 0 deletions libcxx/include/__filesystem/path.h
Expand Up @@ -14,6 +14,7 @@
#include <__algorithm/replace_copy.h>
#include <__availability>
#include <__config>
#include <__functional/hash.h>
#include <__functional/unary_function.h>
#include <__fwd/hash.h>
#include <__iterator/back_insert_iterator.h>
Expand Down
1 change: 1 addition & 0 deletions libcxx/include/__memory/concepts.h
Expand Up @@ -19,6 +19,7 @@
#include <__ranges/concepts.h>
#include <__type_traits/is_reference.h>
#include <__type_traits/remove_cvref.h>
#include <__type_traits/remove_reference.h> // TODO(modules): This should not be required

#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
Expand Down
2 changes: 2 additions & 0 deletions libcxx/include/__ranges/all.h
Expand Up @@ -11,6 +11,8 @@
#define _LIBCPP___RANGES_ALL_H

#include <__config>
#include <__functional/compose.h> // TODO(modules): Those should not be required
#include <__functional/perfect_forward.h> //
#include <__iterator/concepts.h>
#include <__iterator/iterator_traits.h>
#include <__ranges/access.h>
Expand Down
1 change: 1 addition & 0 deletions libcxx/include/__ranges/transform_view.h
Expand Up @@ -20,6 +20,7 @@
#include <__config>
#include <__functional/bind_back.h>
#include <__functional/invoke.h>
#include <__functional/perfect_forward.h>
#include <__iterator/concepts.h>
#include <__iterator/iterator_traits.h>
#include <__memory/addressof.h>
Expand Down
1 change: 1 addition & 0 deletions libcxx/include/__system_error/error_condition.h
Expand Up @@ -12,6 +12,7 @@

#include <__compare/ordering.h>
#include <__config>
#include <__functional/hash.h>
#include <__functional/unary_function.h>
#include <__system_error/errc.h>
#include <__system_error/error_category.h>
Expand Down
39 changes: 16 additions & 23 deletions libcxx/include/module.modulemap.in
Expand Up @@ -117,8 +117,6 @@ module std [system] {
}
module tgmath_h {
header "tgmath.h"
export ccomplex
export cmath
export *
}

Expand Down Expand Up @@ -226,7 +224,6 @@ module std [system] {
module cwchar {
@requires_LIBCXX_ENABLE_WIDE_CHARACTERS@
header "cwchar"
export depr.stdio_h
export *
}
module cwctype {
Expand Down Expand Up @@ -502,12 +499,11 @@ module std [system] {
}
module ranges_partial_sort {
private header "__algorithm/ranges_partial_sort.h"
export algorithm.__algorithm.in_out_result
export functional.__functional.ranges_operations
}
module ranges_partial_sort_copy {
private header "__algorithm/ranges_partial_sort_copy.h"
export algorithm.__algorithm.in_out_out_result
export algorithm.__algorithm.in_out_result
export functional.__functional.ranges_operations
}
module ranges_partition { private header "__algorithm/ranges_partition.h" }
Expand Down Expand Up @@ -763,7 +759,6 @@ module std [system] {
private header "__chrono/high_resolution_clock.h"
export steady_clock
export system_clock
export time_point
}
module literals { private header "__chrono/literals.h" }
module month { private header "__chrono/month.h" }
Expand All @@ -778,8 +773,14 @@ module std [system] {
private header "__chrono/parser_std_format_spec.h"
}
module statically_widen { private header "__chrono/statically_widen.h" }
module steady_clock { private header "__chrono/steady_clock.h" }
module system_clock { private header "__chrono/system_clock.h" }
module steady_clock {
private header "__chrono/steady_clock.h"
export time_point
}
module system_clock {
private header "__chrono/system_clock.h"
export time_point
}
module time_point { private header "__chrono/time_point.h" }
module weekday { private header "__chrono/weekday.h" }
module year { private header "__chrono/year.h" }
Expand Down Expand Up @@ -939,7 +940,6 @@ module std [system] {
private header "__format/format_context.h"
export optional
export locale
export __locale
}
module format_error { private header "__format/format_error.h" }
module format_functions {
Expand Down Expand Up @@ -1085,7 +1085,7 @@ module std [system] {
module cpp17_iterator_concepts { private header "__iterator/cpp17_iterator_concepts.h" }
module concepts {
private header "__iterator/concepts.h"
export concepts.equality_comparable
export std.concepts.__concepts.equality_comparable
export type_traits.common_reference
}
module counted_iterator { private header "__iterator/counted_iterator.h" }
Expand Down Expand Up @@ -1120,10 +1120,7 @@ module std [system] {
module permutable { private header "__iterator/permutable.h" }
module prev { private header "__iterator/prev.h" }
module projected { private header "__iterator/projected.h" }
module readable_traits {
private header "__iterator/readable_traits.h"
export __iterator.iterator_traits
}
module readable_traits { private header "__iterator/readable_traits.h" }
module reverse_access { private header "__iterator/reverse_access.h" }
module reverse_iterator { private header "__iterator/reverse_iterator.h" }
module segmented_iterator { private header "__iterator/segmented_iterator.h" }
Expand Down Expand Up @@ -1168,12 +1165,14 @@ module std [system] {
}
module mdspan {
header "mdspan"
export array
export span
export *

module __mdspan {
module extents { private header "__mdspan/extents.h" }
module extents {
private header "__mdspan/extents.h"
export array
export span
}
module layout_left { private header "__mdspan/layout_left.h" }
module layout_right { private header "__mdspan/layout_right.h" }
module mdspan_fwd { private header "__fwd/mdspan.h" }
Expand Down Expand Up @@ -1500,7 +1499,6 @@ module std [system] {
}
module string_view {
header "string_view"
export initializer_list
export *
module string_view_fwd { private header "__fwd/string_view.h" }
}
Expand All @@ -1511,7 +1509,6 @@ module std [system] {
}
module system_error {
header "system_error"
export __errc
export *
module __system_error {
module errc { private header "__system_error/errc.h" }
Expand Down Expand Up @@ -1876,10 +1873,6 @@ module std [system] {
header "experimental/set"
export *
}
module span {
header "span"
export *
}
module string {
header "experimental/string"
export *
Expand Down
1 change: 1 addition & 0 deletions libcxx/test/libcxx/transitive_includes/cxx03.csv
Expand Up @@ -285,6 +285,7 @@ filesystem concepts
filesystem cstddef
filesystem cstdint
filesystem cstdlib
filesystem cstring
filesystem ctime
filesystem iomanip
filesystem iosfwd
Expand Down
1 change: 1 addition & 0 deletions libcxx/test/libcxx/transitive_includes/cxx11.csv
Expand Up @@ -285,6 +285,7 @@ filesystem concepts
filesystem cstddef
filesystem cstdint
filesystem cstdlib
filesystem cstring
filesystem ctime
filesystem iomanip
filesystem iosfwd
Expand Down
1 change: 1 addition & 0 deletions libcxx/test/libcxx/transitive_includes/cxx14.csv
Expand Up @@ -287,6 +287,7 @@ filesystem concepts
filesystem cstddef
filesystem cstdint
filesystem cstdlib
filesystem cstring
filesystem ctime
filesystem iomanip
filesystem iosfwd
Expand Down
1 change: 1 addition & 0 deletions libcxx/test/libcxx/transitive_includes/cxx17.csv
Expand Up @@ -287,6 +287,7 @@ filesystem concepts
filesystem cstddef
filesystem cstdint
filesystem cstdlib
filesystem cstring
filesystem ctime
filesystem iomanip
filesystem iosfwd
Expand Down
1 change: 1 addition & 0 deletions libcxx/test/libcxx/transitive_includes/cxx20.csv
Expand Up @@ -294,6 +294,7 @@ filesystem concepts
filesystem cstddef
filesystem cstdint
filesystem cstdlib
filesystem cstring
filesystem ctime
filesystem iomanip
filesystem iosfwd
Expand Down
1 change: 1 addition & 0 deletions libcxx/test/libcxx/transitive_includes/cxx23.csv
Expand Up @@ -191,6 +191,7 @@ experimental/vector vector
filesystem compare
filesystem cstddef
filesystem cstdint
filesystem cstring
filesystem ctime
filesystem iomanip
filesystem iosfwd
Expand Down
1 change: 1 addition & 0 deletions libcxx/test/libcxx/transitive_includes/cxx26.csv
Expand Up @@ -191,6 +191,7 @@ experimental/vector vector
filesystem compare
filesystem cstddef
filesystem cstdint
filesystem cstring
filesystem ctime
filesystem iomanip
filesystem iosfwd
Expand Down

0 comments on commit 40cdb22

Please sign in to comment.