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

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Sat Sep 7 00:04:59 PDT 2024


================
@@ -1,2111 +1,1609 @@
-// 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"
+// 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_expected [system] {
-  header "expected"
+
+module std_core [system] {
+  module cstddef {
+    header "__cstddef/byte.h"
+    header "__cstddef/max_align_t.h"
+    header "__cstddef/nullptr_t.h"
+    header "__cstddef/ptrdiff_t.h"
+    header "__cstddef/size_t.h"
+    export *
+  }
+
+  module cstdint {
+    header "cstdint"
+    export *
+  }
+
+  module fwd {
+    header "__fwd/byte.h"
+    header "__fwd/functional.h"
+    header "__fwd/pair.h"
+    header "__fwd/tuple.h"
+    export *
+  }
+
+  module limits {
+    header "limits"
+    export *
+  }
+
+  module math {
+    header "__math/abs.h"
+    header "__math/copysign.h"
+    header "__math/error_functions.h"
+    header "__math/exponential_functions.h"
+    header "__math/fdim.h"
+    header "__math/fma.h"
+    header "__math/gamma.h"
+    header "__math/hyperbolic_functions.h"
+    header "__math/hypot.h"
+    header "__math/inverse_hyperbolic_functions.h"
+    header "__math/inverse_trigonometric_functions.h"
+    header "__math/logarithms.h"
+    header "__math/min_max.h"
+    header "__math/modulo.h"
+    header "__math/remainder.h"
+    header "__math/roots.h"
+    header "__math/rounding_functions.h"
+    header "__math/special_functions.h"
+    header "__math/traits.h"
+    header "__math/trigonometric_functions.h"
+    export *
+  }
+
+  module type_traits {
+    header "type_traits"
+    header "__type_traits/add_const.h"
+    header "__type_traits/add_cv.h"
+    header "__type_traits/add_lvalue_reference.h"
+    header "__type_traits/add_pointer.h"
+    header "__type_traits/add_rvalue_reference.h"
+    header "__type_traits/add_volatile.h"
+    header "__type_traits/aligned_storage.h"
+    header "__type_traits/aligned_union.h"
+    header "__type_traits/alignment_of.h"
+    header "__type_traits/can_extract_key.h"
+    header "__type_traits/common_reference.h"
+    header "__type_traits/common_type.h"
+    header "__type_traits/conditional.h"
+    header "__type_traits/conjunction.h"
+    header "__type_traits/copy_cv.h"
+    header "__type_traits/copy_cvref.h"
+    header "__type_traits/datasizeof.h"
+    header "__type_traits/decay.h"
+    header "__type_traits/dependent_type.h"
+    header "__type_traits/desugars_to.h"
+    header "__type_traits/disjunction.h"
+    header "__type_traits/enable_if.h"
+    header "__type_traits/extent.h"
+    header "__type_traits/has_unique_object_representation.h"
+    header "__type_traits/has_virtual_destructor.h"
+    header "__type_traits/integral_constant.h"
+    header "__type_traits/invoke.h"
+    header "__type_traits/is_abstract.h"
+    header "__type_traits/is_aggregate.h"
+    header "__type_traits/is_allocator.h"
+    header "__type_traits/is_always_bitcastable.h"
+    header "__type_traits/is_arithmetic.h"
+    header "__type_traits/is_array.h"
+    header "__type_traits/is_assignable.h"
+    header "__type_traits/is_base_of.h"
+    header "__type_traits/is_bounded_array.h"
+    header "__type_traits/is_callable.h"
+    header "__type_traits/is_char_like_type.h"
+    header "__type_traits/is_class.h"
+    header "__type_traits/is_compound.h"
+    header "__type_traits/is_const.h"
+    header "__type_traits/is_constant_evaluated.h"
+    header "__type_traits/is_constructible.h"
+    header "__type_traits/is_convertible.h"
+    header "__type_traits/is_core_convertible.h"
+    header "__type_traits/is_destructible.h"
+    header "__type_traits/is_empty.h"
+    header "__type_traits/is_enum.h"
+    header "__type_traits/is_equality_comparable.h"
+    header "__type_traits/is_execution_policy.h"
+    header "__type_traits/is_final.h"
+    header "__type_traits/is_floating_point.h"
+    header "__type_traits/is_function.h"
+    header "__type_traits/is_fundamental.h"
+    header "__type_traits/is_implicitly_default_constructible.h"
+    header "__type_traits/is_integral.h"
+    header "__type_traits/is_literal_type.h"
+    header "__type_traits/is_member_pointer.h"
+    header "__type_traits/is_nothrow_assignable.h"
+    header "__type_traits/is_nothrow_constructible.h"
+    header "__type_traits/is_nothrow_convertible.h"
+    header "__type_traits/is_nothrow_destructible.h"
+    header "__type_traits/is_null_pointer.h"
+    header "__type_traits/is_object.h"
+    header "__type_traits/is_pod.h"
+    header "__type_traits/is_pointer.h"
+    header "__type_traits/is_polymorphic.h"
+    header "__type_traits/is_primary_template.h"
+    header "__type_traits/is_reference_wrapper.h"
+    header "__type_traits/is_reference.h"
+    header "__type_traits/is_referenceable.h"
+    header "__type_traits/is_same.h"
+    header "__type_traits/is_scalar.h"
+    header "__type_traits/is_signed_integer.h"
+    header "__type_traits/is_signed.h"
+    header "__type_traits/is_specialization.h"
+    header "__type_traits/is_standard_layout.h"
+    header "__type_traits/is_swappable.h"
+    header "__type_traits/is_trivial.h"
+    header "__type_traits/is_trivially_assignable.h"
+    header "__type_traits/is_trivially_constructible.h"
+    header "__type_traits/is_trivially_copyable.h"
+    header "__type_traits/is_trivially_destructible.h"
+    header "__type_traits/is_trivially_lexicographically_comparable.h"
+    header "__type_traits/is_trivially_relocatable.h"
+    header "__type_traits/is_unbounded_array.h"
+    header "__type_traits/is_union.h"
+    header "__type_traits/is_unsigned_integer.h"
+    header "__type_traits/is_unsigned.h"
+    header "__type_traits/is_valid_expansion.h"
+    header "__type_traits/is_void.h"
+    header "__type_traits/is_volatile.h"
+    header "__type_traits/lazy.h"
+    header "__type_traits/make_32_64_or_128_bit.h"
+    header "__type_traits/make_const_lvalue_ref.h"
+    header "__type_traits/make_signed.h"
+    header "__type_traits/make_unsigned.h"
+    header "__type_traits/maybe_const.h"
+    header "__type_traits/nat.h"
+    header "__type_traits/negation.h"
+    header "__type_traits/promote.h"
+    header "__type_traits/rank.h"
+    header "__type_traits/remove_all_extents.h"
+    header "__type_traits/remove_const_ref.h"
+    header "__type_traits/remove_const.h"
+    header "__type_traits/remove_cv.h"
+    header "__type_traits/remove_cvref.h"
+    header "__type_traits/remove_extent.h"
+    header "__type_traits/remove_pointer.h"
+    header "__type_traits/remove_reference.h"
+    header "__type_traits/remove_volatile.h"
+    header "__type_traits/result_of.h"
+    header "__type_traits/strip_signature.h"
+    header "__type_traits/type_identity.h"
+    header "__type_traits/type_list.h"
+    header "__type_traits/underlying_type.h"
+    header "__type_traits/unwrap_ref.h"
+    header "__type_traits/void_t.h"
+    export *
+  } // module type_traits
+
+  // Only the truly dependency-free parts of __utility are here
+  module utility {
----------------
philnik777 wrote:

Could we name this `utility_core` or something like that to make it obvious this isn't the general `utility` module even when ignoring the comment above?

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


More information about the libcxx-commits mailing list