[libcxx-commits] [libcxx] [libc++][modules] Rewrite the modulemap to have fewer top-level modules (PR #107638)

Ian Anderson via libcxx-commits libcxx-commits at lists.llvm.org
Mon Sep 9 13:59:54 PDT 2024


================
@@ -1,2111 +1,1843 @@
-// Main C++ standard library interfaces
-module std_algorithm [system] {
-  header "algorithm"
-  export *
-}
-module std_any [system] {
-  header "any"
-  export *
-}
-module std_array [system] {
-  header "array"
-  export *
-}
-module std_atomic [system] {
-  header "atomic"
-  export *
-}
-module std_barrier [system] {
-  header "barrier"
-  export *
-}
-module std_bit [system] {
-  header "bit"
-  export *
-}
-module std_bitset [system] {
-  header "bitset"
-  export *
-}
-module std_charconv [system] {
-  header "charconv"
-  module chars_format            { header "__charconv/chars_format.h" }
-  module from_chars_integral     { header "__charconv/from_chars_integral.h" }
-  module from_chars_result       { header "__charconv/from_chars_result.h" }
-  module tables                  { header "__charconv/tables.h" }
-  module to_chars                { header "__charconv/to_chars.h" }
-  module to_chars_base_10        { header "__charconv/to_chars_base_10.h" }
-  module to_chars_floating_point { header "__charconv/to_chars_floating_point.h" }
-  module to_chars_integral       { header "__charconv/to_chars_integral.h" }
-  module to_chars_result         { header "__charconv/to_chars_result.h" }
-  module traits                  { header "__charconv/traits.h" }
-  export *
-}
-module std_chrono [system] {
-  header "chrono"
-  export *
-}
-module std_codecvt [system] {
-  header "codecvt"
-  export *
-}
-module std_compare [system] {
-  header "compare"
-  export *
-}
-module std_complex [system] {
-  header "complex"
-  export *
-}
-module std_concepts [system] {
-  header "concepts"
-  export *
-}
-module std_condition_variable [system] {
-  header "condition_variable"
-  module condition_variable { header "__condition_variable/condition_variable.h" }
-  export *
-}
-module std_coroutine [system] {
-  header "coroutine"
-  module coroutine_handle      { header "__coroutine/coroutine_handle.h" }
-  module coroutine_traits      { header "__coroutine/coroutine_traits.h" }
-  module noop_coroutine_handle { header "__coroutine/noop_coroutine_handle.h" }
-  module trivial_awaitables    { header "__coroutine/trivial_awaitables.h" }
-  export *
-}
-module std_deque [system] {
-  header "deque"
-  export *
-}
-module std_exception [system] {
-  header "exception"
-  export *
-}
-module std_execution [system] {
-  header "execution"
-  export *
-}
-module std_expected [system] {
-  header "expected"
-  export *
-}
-module std_filesystem [system] {
-  header "filesystem"
-  module copy_options                 { header "__filesystem/copy_options.h" }
-  module directory_entry              { header "__filesystem/directory_entry.h" }
-  module directory_iterator           { header "__filesystem/directory_iterator.h" }
-  module directory_options            { header "__filesystem/directory_options.h" }
-  module file_status                  { header "__filesystem/file_status.h" }
-  module file_time_type               { header "__filesystem/file_time_type.h" }
-  module file_type                    { header "__filesystem/file_type.h" }
-  module filesystem_error             {
-    header "__filesystem/filesystem_error.h"
-    export std_private_memory_shared_ptr
-  }
-  module operations                   { header "__filesystem/operations.h" }
-  module path                         {
-    header "__filesystem/path.h"
-    export std_string // returned by various methods
-  }
-  module path_iterator                { header "__filesystem/path_iterator.h" }
-  module perm_options                 { header "__filesystem/perm_options.h" }
-  module perms                        { header "__filesystem/perms.h" }
-  module recursive_directory_iterator { header "__filesystem/recursive_directory_iterator.h" }
-  module space_info                   { header "__filesystem/space_info.h" }
-  module u8path                       { header "__filesystem/u8path.h" }
-  export *
-}
-module std_format [system] {
-  header "format"
-  export *
-}
-module std_forward_list [system] {
-  header "forward_list"
-  export *
-}
-module std_fstream [system] {
-  header "fstream"
-  export *
-}
-module std_functional [system] {
-  header "functional"
-  export *
-}
-module std_future [system] {
-  header "future"
-  export *
-}
-module std_initializer_list [system] {
-  header "initializer_list"
-  export *
-}
-module std_iomanip [system] {
-  header "iomanip"
-  export *
-}
-module std_ios [system] {
-  header "ios"
-  export *
-}
-module std_iosfwd [system] {
-  header "iosfwd"
-  export *
-}
-module std_iostream [system] {
-  header "iostream"
-  export *
-}
-module std_istream [system] {
-  header "istream"
-  export *
-}
-module std_iterator [system] {
-  header "iterator"
-  export *
-}
-module std_latch [system] {
-  header "latch"
-  export *
-}
-module std_limits [system] {
-  header "limits"
-  export *
-}
-module std_list [system] {
-  header "list"
-  export *
-}
-module std_locale [system] {
-  header "locale"
-  export *
-}
-module std_map [system] {
-  header "map"
+// This module contains headers related to the configuration of the library. These headers
+// are free of any dependency on the rest of libc++.
+module std_config [system] {
+  textual header "__config"
+  textual header "__configuration/abi.h"
+  textual header "__configuration/availability.h"
+  textual header "__configuration/compiler.h"
+  textual header "__configuration/language.h"
+  textual header "__configuration/platform.h"
+  textual header "version"
   export *
 }
-module std_mdspan [system] {
-  header "mdspan"
-  module default_accessor { header "__mdspan/default_accessor.h" }
-  module extents          { header "__mdspan/extents.h" }
-  module fwd              { header "__fwd/mdspan.h" }
-  module layout_left      { header "__mdspan/layout_left.h" }
-  module layout_right     { header "__mdspan/layout_right.h" }
-  module layout_stride    { header "__mdspan/layout_stride.h" }
-  module mdspan           {
-    header "__mdspan/mdspan.h"
-    export std_array // for strides()
+
+module std_core [system] {
+  module cstddef {
+    module byte         { header "__cstddef/byte.h" }
+    module max_align_t  { header "__cstddef/max_align_t.h" }
+    module nullptr_t    { header "__cstddef/nullptr_t.h" }
+    module ptrdiff_t    { header "__cstddef/ptrdiff_t.h" }
+    module size_t       { header "__cstddef/size_t.h" }
+    export *
+  }
+
+  module cstdint {
+    header "cstdint"
+    export *
+  }
+
+  module fwd {
+    module byte         { header "__fwd/byte.h" }
+    module functional   { header "__fwd/functional.h" }
+    module pair         { header "__fwd/pair.h" }
+    module tuple        { header "__fwd/tuple.h" }
+    export *
+  }
+
+  module limits {
+    header "limits"
+    export *
+  }
+
+  module math {
+    module abs                              { header "__math/abs.h" }
+    module copysign                         { header "__math/copysign.h" }
+    module error_functions                  { header "__math/error_functions.h" }
+    module exponential_functions            { header "__math/exponential_functions.h" }
+    module fdim                             { header "__math/fdim.h" }
+    module fma                              { header "__math/fma.h" }
+    module gamma                            { header "__math/gamma.h" }
+    module hyperbolic_functions             { header "__math/hyperbolic_functions.h" }
+    module hypot                            { header "__math/hypot.h" }
+    module inverse_hyperbolic_functions     { header "__math/inverse_hyperbolic_functions.h" }
+    module inverse_trigonometric_functions  { header "__math/inverse_trigonometric_functions.h" }
+    module logarithms                       { header "__math/logarithms.h" }
+    module min_max                          { header "__math/min_max.h" }
+    module modulo                           { header "__math/modulo.h" }
+    module remainder                        { header "__math/remainder.h" }
+    module roots                            { header "__math/roots.h" }
+    module rounding_functions               { header "__math/rounding_functions.h" }
+    module special_functions                { header "__math/special_functions.h" }
+    module traits                           { header "__math/traits.h" }
+    module trigonometric_functions          { header "__math/trigonometric_functions.h" }
+    export *
+  }
+
+  module type_traits {
+    module add_const                                  { header "__type_traits/add_const.h" }
+    module add_cv                                     { header "__type_traits/add_cv.h" }
+    module add_lvalue_reference                       { header "__type_traits/add_lvalue_reference.h" }
+    module add_pointer                                { header "__type_traits/add_pointer.h" }
+    module add_rvalue_reference                       { header "__type_traits/add_rvalue_reference.h" }
+    module add_volatile                               { header "__type_traits/add_volatile.h" }
+    module aligned_storage                            { header "__type_traits/aligned_storage.h" }
+    module aligned_union                              { header "__type_traits/aligned_union.h" }
+    module alignment_of                               { header "__type_traits/alignment_of.h" }
+    module can_extract_key                            { header "__type_traits/can_extract_key.h" }
+    module common_reference                           { header "__type_traits/common_reference.h" }
+    module common_type                                { header "__type_traits/common_type.h" }
+    module conditional                                { header "__type_traits/conditional.h" }
+    module conjunction                                { header "__type_traits/conjunction.h" }
+    module copy_cv                                    { header "__type_traits/copy_cv.h" }
+    module copy_cvref                                 { header "__type_traits/copy_cvref.h" }
+    module datasizeof                                 { header "__type_traits/datasizeof.h" }
+    module decay                                      { header "__type_traits/decay.h" }
+    module dependent_type                             { header "__type_traits/dependent_type.h" }
+    module desugars_to                                { header "__type_traits/desugars_to.h" }
+    module disjunction                                { header "__type_traits/disjunction.h" }
+    module enable_if                                  { header "__type_traits/enable_if.h" }
+    module extent                                     { header "__type_traits/extent.h" }
+    module has_unique_object_representation           { header "__type_traits/has_unique_object_representation.h" }
+    module has_virtual_destructor                     { header "__type_traits/has_virtual_destructor.h" }
+    module integral_constant                          { header "__type_traits/integral_constant.h" }
+    module invoke                                     { header "__type_traits/invoke.h" }
+    module is_abstract {
+      header "__type_traits/is_abstract.h"
+      export integral_constant
+    }
+    module is_aggregate {
+      header "__type_traits/is_aggregate.h"
+      export integral_constant
+    }
+    module is_allocator {
+      header "__type_traits/is_allocator.h"
+      export integral_constant
+    }
+    module is_always_bitcastable {
+      header "__type_traits/is_always_bitcastable.h"
+      export integral_constant
+    }
+    module is_arithmetic {
+      header "__type_traits/is_arithmetic.h"
+      export integral_constant
+    }
+    module is_array {
+      header "__type_traits/is_array.h"
+      export integral_constant
+    }
+    module is_assignable {
+      header "__type_traits/is_assignable.h"
+      export integral_constant
+    }
+    module is_base_of {
+      header "__type_traits/is_base_of.h"
+      export integral_constant
+    }
+    module is_bounded_array {
+      header "__type_traits/is_bounded_array.h"
+      export integral_constant
+    }
+    module is_callable {
+      header "__type_traits/is_callable.h"
+      export integral_constant
+    }
+    module is_char_like_type {
+      header "__type_traits/is_char_like_type.h"
+      export integral_constant
+    }
+    module is_class {
+      header "__type_traits/is_class.h"
+      export integral_constant
+    }
+    module is_compound {
+      header "__type_traits/is_compound.h"
+      export integral_constant
+    }
+    module is_const {
+      header "__type_traits/is_const.h"
+      export integral_constant
+    }
+    module is_constant_evaluated {
+      header "__type_traits/is_constant_evaluated.h"
+      export integral_constant
+    }
+    module is_constructible {
+      header "__type_traits/is_constructible.h"
+      export integral_constant
+    }
+    module is_convertible {
+      header "__type_traits/is_convertible.h"
+      export integral_constant
+    }
+    module is_core_convertible {
+      header "__type_traits/is_core_convertible.h"
+      export integral_constant
+    }
+    module is_destructible {
+      header "__type_traits/is_destructible.h"
+      export integral_constant
+    }
+    module is_empty {
+      header "__type_traits/is_empty.h"
+      export integral_constant
+    }
+    module is_enum {
+      header "__type_traits/is_enum.h"
+      export integral_constant
+    }
+    module is_equality_comparable {
+      header "__type_traits/is_equality_comparable.h"
+      export integral_constant
+    }
+    module is_execution_policy {
+      header "__type_traits/is_execution_policy.h"
+      export integral_constant
+    }
+    module is_final {
+      header "__type_traits/is_final.h"
+      export integral_constant
+    }
+    module is_floating_point {
+      header "__type_traits/is_floating_point.h"
+      export integral_constant
+    }
+    module is_function {
+      header "__type_traits/is_function.h"
+      export integral_constant
+    }
+    module is_fundamental {
+      header "__type_traits/is_fundamental.h"
+      export integral_constant
+    }
+    module is_implicitly_default_constructible {
+      header "__type_traits/is_implicitly_default_constructible.h"
+      export integral_constant
+    }
+    module is_integral {
+      header "__type_traits/is_integral.h"
+      export integral_constant
+    }
+    module is_literal_type {
+      header "__type_traits/is_literal_type.h"
+      export integral_constant
+    }
+    module is_member_pointer {
+      header "__type_traits/is_member_pointer.h"
+      export integral_constant
+    }
+    module is_nothrow_assignable {
+      header "__type_traits/is_nothrow_assignable.h"
+      export integral_constant
+    }
+    module is_nothrow_constructible {
+      header "__type_traits/is_nothrow_constructible.h"
+      export integral_constant
+    }
+    module is_nothrow_convertible {
+      header "__type_traits/is_nothrow_convertible.h"
+      export integral_constant
+    }
+    module is_nothrow_destructible {
+      header "__type_traits/is_nothrow_destructible.h"
+      export integral_constant
+    }
+    module is_null_pointer {
+      header "__type_traits/is_null_pointer.h"
+      export integral_constant
+    }
+    module is_object {
+      header "__type_traits/is_object.h"
+      export integral_constant
+    }
+    module is_pod {
+      header "__type_traits/is_pod.h"
+      export integral_constant
+    }
+    module is_pointer {
+      header "__type_traits/is_pointer.h"
+      export integral_constant
+    }
+    module is_polymorphic {
+      header "__type_traits/is_polymorphic.h"
+      export integral_constant
+    }
+    module is_primary_template {
+      header "__type_traits/is_primary_template.h"
+      export integral_constant
+    }
+    module is_reference_wrapper {
+      header "__type_traits/is_reference_wrapper.h"
+      export integral_constant
+    }
+    module is_reference {
+      header "__type_traits/is_reference.h"
+      export integral_constant
+    }
+    module is_referenceable {
+      header "__type_traits/is_referenceable.h"
+      export integral_constant
+    }
+    module is_same {
+      header "__type_traits/is_same.h"
+      export integral_constant
+    }
+    module is_scalar {
+      header "__type_traits/is_scalar.h"
+      export integral_constant
+    }
+    module is_signed_integer {
+      header "__type_traits/is_signed_integer.h"
+      export integral_constant
+    }
+    module is_signed {
+      header "__type_traits/is_signed.h"
+      export integral_constant
+    }
+    module is_specialization {
+      header "__type_traits/is_specialization.h"
+      export integral_constant
+    }
+    module is_standard_layout {
+      header "__type_traits/is_standard_layout.h"
+      export integral_constant
+    }
+    module is_swappable {
+      header "__type_traits/is_swappable.h"
+      export integral_constant
+    }
+    module is_trivial {
+      header "__type_traits/is_trivial.h"
+      export integral_constant
+    }
+    module is_trivially_assignable {
+      header "__type_traits/is_trivially_assignable.h"
+      export integral_constant
+    }
+    module is_trivially_constructible {
+      header "__type_traits/is_trivially_constructible.h"
+      export integral_constant
+    }
+    module is_trivially_copyable {
+      header "__type_traits/is_trivially_copyable.h"
+      export integral_constant
+    }
+    module is_trivially_destructible {
+      header "__type_traits/is_trivially_destructible.h"
+      export integral_constant
+    }
+    module is_trivially_lexicographically_comparable {
+      header "__type_traits/is_trivially_lexicographically_comparable.h"
+      export integral_constant
+    }
+    module is_trivially_relocatable {
+      header "__type_traits/is_trivially_relocatable.h"
+      export integral_constant
+    }
+    module is_unbounded_array {
+      header "__type_traits/is_unbounded_array.h"
+      export integral_constant
+    }
+    module is_union {
+      header "__type_traits/is_union.h"
+      export integral_constant
+    }
+    module is_unsigned_integer {
+      header "__type_traits/is_unsigned_integer.h"
+      export integral_constant
+    }
+    module is_unsigned {
+      header "__type_traits/is_unsigned.h"
+      export integral_constant
+    }
+    module is_valid_expansion {
+      header "__type_traits/is_valid_expansion.h"
+      export integral_constant
+    }
+    module is_void {
+      header "__type_traits/is_void.h"
+      export integral_constant
+    }
+    module is_volatile {
+      header "__type_traits/is_volatile.h"
+      export integral_constant
+    }
+    module lazy                                       { header "__type_traits/lazy.h" }
+    module make_32_64_or_128_bit                      { header "__type_traits/make_32_64_or_128_bit.h" }
+    module make_const_lvalue_ref                      { header "__type_traits/make_const_lvalue_ref.h" }
+    module make_signed                                { header "__type_traits/make_signed.h" }
+    module make_unsigned                              { header "__type_traits/make_unsigned.h" }
+    module maybe_const                                { header "__type_traits/maybe_const.h" }
+    module nat                                        { header "__type_traits/nat.h" }
+    module negation                                   { header "__type_traits/negation.h" }
+    module promote                                    { header "__type_traits/promote.h" }
+    module rank                                       { header "__type_traits/rank.h" }
+    module remove_all_extents                         { header "__type_traits/remove_all_extents.h" }
+    module remove_const_ref                           { header "__type_traits/remove_const_ref.h" }
+    module remove_const                               { header "__type_traits/remove_const.h" }
+    module remove_cv                                  { header "__type_traits/remove_cv.h" }
+    module remove_cvref                               { header "__type_traits/remove_cvref.h" }
+    module remove_extent                              { header "__type_traits/remove_extent.h" }
+    module remove_pointer                             { header "__type_traits/remove_pointer.h" }
+    module remove_reference                           { header "__type_traits/remove_reference.h" }
+    module remove_volatile                            { header "__type_traits/remove_volatile.h" }
+    module result_of                                  { header "__type_traits/result_of.h" }
+    module strip_signature                            { header "__type_traits/strip_signature.h" }
+    module type_identity                              { header "__type_traits/type_identity.h" }
+    module type_list                                  { header "__type_traits/type_list.h" }
+    module underlying_type                            { header "__type_traits/underlying_type.h" }
+    module unwrap_ref                                 { header "__type_traits/unwrap_ref.h" }
+    module void_t                                     { header "__type_traits/void_t.h" }
+
+    header "type_traits"
+    export *
+  } // module type_traits
+
+  // Only the truly dependency-free parts of __utility are here
+  module utility_core {
----------------
ian-twilightcoder wrote:

I guess? Still results in a weird module name and you could get for `"utility"` instead. It's not the weirdest one every, however the rest of you want it.

https://github.com/llvm/llvm-project/pull/107638


More information about the libcxx-commits mailing list