[libcxx-commits] [libcxx] 40cdb22 - [libc++][Modules] Make module exports consistent with header includes
Ian Anderson via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jun 29 15:37:08 PDT 2023
Author: Ian Anderson
Date: 2023-06-29T15:37:03-07:00
New Revision: 40cdb220f5af63160679def0aee23aa1cbd49b60
URL: https://github.com/llvm/llvm-project/commit/40cdb220f5af63160679def0aee23aa1cbd49b60
DIFF: https://github.com/llvm/llvm-project/commit/40cdb220f5af63160679def0aee23aa1cbd49b60.diff
LOG: [libc++][Modules] Make module exports consistent with header includes
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
Added:
Modified:
libcxx/include/__filesystem/path.h
libcxx/include/__memory/concepts.h
libcxx/include/__ranges/all.h
libcxx/include/__ranges/transform_view.h
libcxx/include/__system_error/error_condition.h
libcxx/include/module.modulemap.in
libcxx/test/libcxx/transitive_includes/cxx03.csv
libcxx/test/libcxx/transitive_includes/cxx11.csv
libcxx/test/libcxx/transitive_includes/cxx14.csv
libcxx/test/libcxx/transitive_includes/cxx17.csv
libcxx/test/libcxx/transitive_includes/cxx20.csv
libcxx/test/libcxx/transitive_includes/cxx23.csv
libcxx/test/libcxx/transitive_includes/cxx26.csv
Removed:
################################################################################
diff --git a/libcxx/include/__filesystem/path.h b/libcxx/include/__filesystem/path.h
index da349af7305643..77699c5ae47fd8 100644
--- a/libcxx/include/__filesystem/path.h
+++ b/libcxx/include/__filesystem/path.h
@@ -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>
diff --git a/libcxx/include/__memory/concepts.h b/libcxx/include/__memory/concepts.h
index 9517a8fd5167fd..97cc3583ec9646 100644
--- a/libcxx/include/__memory/concepts.h
+++ b/libcxx/include/__memory/concepts.h
@@ -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
diff --git a/libcxx/include/__ranges/all.h b/libcxx/include/__ranges/all.h
index ecf908df1fe6a2..2c88f51b664474 100644
--- a/libcxx/include/__ranges/all.h
+++ b/libcxx/include/__ranges/all.h
@@ -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>
diff --git a/libcxx/include/__ranges/transform_view.h b/libcxx/include/__ranges/transform_view.h
index dd346fb25be5e2..3678f9d64f7b9a 100644
--- a/libcxx/include/__ranges/transform_view.h
+++ b/libcxx/include/__ranges/transform_view.h
@@ -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>
diff --git a/libcxx/include/__system_error/error_condition.h b/libcxx/include/__system_error/error_condition.h
index 80f349ca3e8b76..a43a73cdc26032 100644
--- a/libcxx/include/__system_error/error_condition.h
+++ b/libcxx/include/__system_error/error_condition.h
@@ -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>
diff --git a/libcxx/include/module.modulemap.in b/libcxx/include/module.modulemap.in
index 5e32995c1e00f3..a47e0ef0fa2ff9 100644
--- a/libcxx/include/module.modulemap.in
+++ b/libcxx/include/module.modulemap.in
@@ -117,8 +117,6 @@ module std [system] {
}
module tgmath_h {
header "tgmath.h"
- export ccomplex
- export cmath
export *
}
@@ -226,7 +224,6 @@ module std [system] {
module cwchar {
@requires_LIBCXX_ENABLE_WIDE_CHARACTERS@
header "cwchar"
- export depr.stdio_h
export *
}
module cwctype {
@@ -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" }
@@ -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" }
@@ -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" }
@@ -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 {
@@ -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" }
@@ -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" }
@@ -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" }
@@ -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" }
}
@@ -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" }
@@ -1876,10 +1873,6 @@ module std [system] {
header "experimental/set"
export *
}
- module span {
- header "span"
- export *
- }
module string {
header "experimental/string"
export *
diff --git a/libcxx/test/libcxx/transitive_includes/cxx03.csv b/libcxx/test/libcxx/transitive_includes/cxx03.csv
index 4f761f10de0c24..9f555fb7de8c79 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx03.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx03.csv
@@ -285,6 +285,7 @@ filesystem concepts
filesystem cstddef
filesystem cstdint
filesystem cstdlib
+filesystem cstring
filesystem ctime
filesystem iomanip
filesystem iosfwd
diff --git a/libcxx/test/libcxx/transitive_includes/cxx11.csv b/libcxx/test/libcxx/transitive_includes/cxx11.csv
index 7e9363072512e5..0f00c22d024bc7 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx11.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx11.csv
@@ -285,6 +285,7 @@ filesystem concepts
filesystem cstddef
filesystem cstdint
filesystem cstdlib
+filesystem cstring
filesystem ctime
filesystem iomanip
filesystem iosfwd
diff --git a/libcxx/test/libcxx/transitive_includes/cxx14.csv b/libcxx/test/libcxx/transitive_includes/cxx14.csv
index 8c6fadd38bdf4e..596ea364ece785 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx14.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx14.csv
@@ -287,6 +287,7 @@ filesystem concepts
filesystem cstddef
filesystem cstdint
filesystem cstdlib
+filesystem cstring
filesystem ctime
filesystem iomanip
filesystem iosfwd
diff --git a/libcxx/test/libcxx/transitive_includes/cxx17.csv b/libcxx/test/libcxx/transitive_includes/cxx17.csv
index 8c6fadd38bdf4e..596ea364ece785 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx17.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx17.csv
@@ -287,6 +287,7 @@ filesystem concepts
filesystem cstddef
filesystem cstdint
filesystem cstdlib
+filesystem cstring
filesystem ctime
filesystem iomanip
filesystem iosfwd
diff --git a/libcxx/test/libcxx/transitive_includes/cxx20.csv b/libcxx/test/libcxx/transitive_includes/cxx20.csv
index 8fd381c7b9391d..e80b9a0ae8c378 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx20.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx20.csv
@@ -294,6 +294,7 @@ filesystem concepts
filesystem cstddef
filesystem cstdint
filesystem cstdlib
+filesystem cstring
filesystem ctime
filesystem iomanip
filesystem iosfwd
diff --git a/libcxx/test/libcxx/transitive_includes/cxx23.csv b/libcxx/test/libcxx/transitive_includes/cxx23.csv
index 812bf3b839ba72..27e9acf5cdd87f 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx23.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx23.csv
@@ -191,6 +191,7 @@ experimental/vector vector
filesystem compare
filesystem cstddef
filesystem cstdint
+filesystem cstring
filesystem ctime
filesystem iomanip
filesystem iosfwd
diff --git a/libcxx/test/libcxx/transitive_includes/cxx26.csv b/libcxx/test/libcxx/transitive_includes/cxx26.csv
index 812bf3b839ba72..27e9acf5cdd87f 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx26.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx26.csv
@@ -191,6 +191,7 @@ experimental/vector vector
filesystem compare
filesystem cstddef
filesystem cstdint
+filesystem cstring
filesystem ctime
filesystem iomanip
filesystem iosfwd
More information about the libcxx-commits
mailing list