[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 16 12:00:24 PDT 2024


================
@@ -1,2117 +1,2190 @@
-// 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"
-  export *
+// 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"
 }
-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 std_memory [system] {
-  header "memory"
-  export *
-}
-module std_memory_resource [system] {
-  header "memory_resource"
-  export *
-}
-module std_mutex [system] {
-  header "mutex"
-  export *
-}
-module std_new [system] {
-  header "new"
-  export *
-}
-module std_numbers [system] {
-  header "numbers"
-  export *
-}
-module std_numeric [system] {
-  header "numeric"
-  export *
-}
-module std_optional [system] {
-  header "optional"
-  export *
-}
-module std_ostream [system] {
-  header "ostream"
-  export *
-}
-module std_print [system] {
-  header "print"
-  export *
-}
-module std_queue [system] {
-  header "queue"
-  export *
-}
-module std_random [system] {
-  header "random"
-  export *
-}
-module std_ranges [system] {
-  header "ranges"
-  export *
-}
-module std_ratio [system] {
-  header "ratio"
-  export *
-}
-module std_regex [system] {
-  header "regex"
-  export *
-}
-module std_scoped_allocator [system] {
-  header "scoped_allocator"
-  export *
-}
-module std_semaphore [system] {
-  header "semaphore"
-  export *
-}
-module std_set [system] {
-  header "set"
-  export *
-}
-module std_shared_mutex [system] {
-  header "shared_mutex"
-  export std_version
-}
-module std_source_location [system] {
-  header "source_location"
-  export *
-}
-module std_span [system] {
-  header "span"
-  export std_private_ranges_enable_borrowed_range
-  export std_version
-  export std_private_span_span_fwd
-}
-module std_sstream [system] {
-  header "sstream"
-  export *
-}
-module std_stack [system] {
-  header "stack"
-  export *
-}
-module std_stdexcept [system] {
-  header "stdexcept"
-  export *
-}
-module std_stop_token [system] {
-  header "stop_token"
-  private header "__stop_token/atomic_unique_lock.h"
-  private header "__stop_token/intrusive_list_view.h"
-  private header "__stop_token/intrusive_shared_ptr.h"
-  private header "__stop_token/stop_callback.h"
-  private header "__stop_token/stop_source.h"
-  private header "__stop_token/stop_state.h"
-  private header "__stop_token/stop_token.h"
-  export *
-}
-module std_streambuf [system] {
-  header "streambuf"
-  export *
-}
-module std_string [system] {
-  header "string"
-  export *
-}
-module std_string_view [system] {
-  header "string_view"
-  export *
-}
-module std_strstream [system] {
-  header "strstream"
-  export *
-}
-module std_syncstream [system] {
-  header "syncstream"
-  export *
-}
-module std_system_error [system] {
-  header "system_error"
-  export *
-}
-module std_thread [system] {
-  header "thread"
-  export *
-}
-module std_tuple [system] {
-  header "tuple"
-  export *
-}
-module std_type_traits [system] {
-  header "type_traits"
-  export *
-}
-module std_typeindex [system] {
-  header "typeindex"
-  export *
-}
-module std_typeinfo [system] {
-  header "typeinfo"
-  export *
-}
-module std_unordered_map [system] {
-  header "unordered_map"
-  export *
-}
-module std_unordered_set [system] {
-  header "unordered_set"
-  export *
-}
-module std_utility [system] {
-  header "utility"
-  export *
-}
-module std_valarray [system] {
-  header "valarray"
-  export *
-}
-module std_variant [system] {
-  header "variant"
-  export *
-}
-module std_vector [system] {
-  header "vector"
-  export *
-}
-module std_version [system] {
-  header "version"
-  export *
-}
 
-// C standard library interface wrappers
-module std_cassert [system] {
-  // <cassert>'s use of NDEBUG requires textual inclusion.
-  textual header "cassert"
-}
-module std_ccomplex [system] {
-  header "ccomplex"
-  export *
-}
-module std_cctype [system] {
-  header "cctype"
-  export *
-}
-module std_cerrno [system] {
-  header "cerrno"
-  export *
-}
-module std_cfenv [system] {
-  header "cfenv"
-  export *
-}
-module std_cfloat [system] {
-  header "cfloat"
-  export *
-}
-module std_cinttypes [system] {
-  header "cinttypes"
-  export *
-}
-module std_ciso646 [system] {
-  header "ciso646"
-  export *
-}
-module std_climits [system] {
-  header "climits"
-  export *
-}
-module std_clocale [system] {
-  header "clocale"
-  export *
-}
-module std_cmath [system] {
-  header "cmath"
-  export *
-}
-module std_csetjmp [system] {
-  header "csetjmp"
-  export *
-}
-module std_csignal [system] {
-  header "csignal"
-  export *
-}
-// FIXME: <cstdalign> is missing.
-module std_cstdarg [system] {
-  header "cstdarg"
-  export *
-}
-module std_cstdbool [system] {
-  header "cstdbool"
-  export *
-}
-module std_cstddef [system] {
-  header "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 std_cstdint [system] {
-  header "cstdint"
-  export *
-}
-module std_cstdio [system] {
-  header "cstdio"
-  export *
-}
-module std_cstdlib [system] {
-  header "cstdlib"
-  export *
-}
-module std_cstring [system] {
-  header "cstring"
-  export *
-}
-module std_ctgmath [system] {
-  header "ctgmath"
-  export *
-}
-module std_ctime [system] {
-  header "ctime"
-  export *
-}
-module std_cuchar [system] {
-  header "cuchar"
-  export *
-}
-module std_cwchar [system] {
-  header "cwchar"
-  export *
-}
-module std_cwctype [system] {
-  header "cwctype"
-  export *
-}
+  module cstdint {
+    header "cstdint"
+    export *
+  }
+
+  module fwd {
----------------
ian-twilightcoder wrote:

Well we haven't changed anything yet, right now all the top level modules are still `std_`, we were just exploring our options for top level module names. So I think std_private_ is the path of least resistance.

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


More information about the libcxx-commits mailing list