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

via libcxx-commits libcxx-commits at lists.llvm.org
Sat Sep 28 13:25:11 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Chris B (llvm-beanz)

<details>
<summary>Changes</summary>

This reverts commit bc6bd3bc1e99c7ec9e22dff23b4f4373fa02cae3.

The GitHub pre-merge CI has been broken since this PR went in. This change reverts it to see if I can get the pre-merge CI working again.

---

Patch is 214.27 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/110384.diff


8 Files Affected:

- (modified) libcxx/include/CMakeLists.txt (+1) 
- (modified) libcxx/include/__format/formatter_integral.h (-1) 
- (added) libcxx/include/__std_clang_module (+193) 
- (modified) libcxx/include/module.modulemap (+2063-2174) 
- (modified) libcxx/test/libcxx/clang_modules_include.gen.py (+3-11) 
- (added) libcxx/test/std/experimental/utilities/utility/utility.synop/includes.pass.cpp (+23) 
- (modified) libcxx/utils/CMakeLists.txt (+5) 
- (added) libcxx/utils/generate_std_clang_module_header.py (+63) 


``````````diff
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 8a63280053340f..0be6c1ae591822 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -688,6 +688,7 @@ set(files
   __ranges/views.h
   __ranges/zip_view.h
   __split_buffer
+  __std_clang_module
   __std_mbstate_t.h
   __stop_token/atomic_unique_lock.h
   __stop_token/intrusive_list_view.h
diff --git a/libcxx/include/__format/formatter_integral.h b/libcxx/include/__format/formatter_integral.h
index 0c04cce855a08c..beed3ab8d93df1 100644
--- a/libcxx/include/__format/formatter_integral.h
+++ b/libcxx/include/__format/formatter_integral.h
@@ -27,7 +27,6 @@
 #include <__type_traits/make_unsigned.h>
 #include <__utility/unreachable.h>
 #include <array>
-#include <cstdint>
 #include <limits>
 #include <string>
 #include <string_view>
diff --git a/libcxx/include/__std_clang_module b/libcxx/include/__std_clang_module
new file mode 100644
index 00000000000000..a21ed26addfe8e
--- /dev/null
+++ b/libcxx/include/__std_clang_module
@@ -0,0 +1,193 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// WARNING, this entire header is generated by
+// utils/generate_std_clang_module_header.py
+// DO NOT MODIFY!
+
+// This header should not be directly included, it's exclusively to import all
+// of the libc++ public clang modules for the `std` clang module to export. In
+// other words, it's to facilitate `@import std;` in Objective-C++ and `import std`
+// in Swift to expose all of the libc++ interfaces. This is generally not
+// recommended, however there are some clients that need to import all of libc++
+// without knowing what "all" is.
+#if !__building_module(std)
+#  error "Do not include this header directly, include individual headers instead"
+#endif
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#include <algorithm>
+#include <any>
+#include <array>
+#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
+#  include <atomic>
+#endif
+#include <barrier>
+#include <bit>
+#include <bitset>
+#include <cassert>
+#include <ccomplex>
+#include <cctype>
+#include <cerrno>
+#include <cfenv>
+#include <cfloat>
+#include <charconv>
+#include <chrono>
+#include <cinttypes>
+#include <ciso646>
+#include <climits>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  include <clocale>
+#endif
+#include <cmath>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  include <codecvt>
+#endif
+#include <compare>
+#include <complex.h>
+#include <complex>
+#include <concepts>
+#include <condition_variable>
+#include <coroutine>
+#include <csetjmp>
+#include <csignal>
+#include <cstdarg>
+#include <cstdbool>
+#include <cstddef>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctgmath>
+#include <ctime>
+#include <ctype.h>
+#include <cuchar>
+#include <cwchar>
+#include <cwctype>
+#include <deque>
+#include <errno.h>
+#include <exception>
+#include <execution>
+#include <expected>
+#include <experimental/iterator>
+#include <experimental/memory>
+#include <experimental/propagate_const>
+#include <experimental/simd>
+#include <experimental/type_traits>
+#include <experimental/utility>
+#include <fenv.h>
+#include <filesystem>
+#include <float.h>
+#include <format>
+#include <forward_list>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  include <fstream>
+#endif
+#include <functional>
+#include <future>
+#include <initializer_list>
+#include <inttypes.h>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  include <iomanip>
+#endif
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  include <ios>
+#endif
+#include <iosfwd>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  include <iostream>
+#endif
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  include <istream>
+#endif
+#include <iterator>
+#include <latch>
+#include <limits>
+#include <list>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  include <locale.h>
+#endif
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  include <locale>
+#endif
+#include <map>
+#include <math.h>
+#include <mdspan>
+#include <memory>
+#include <memory_resource>
+#include <mutex>
+#include <new>
+#include <numbers>
+#include <numeric>
+#include <optional>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  include <ostream>
+#endif
+#include <print>
+#include <queue>
+#include <random>
+#include <ranges>
+#include <ratio>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  include <regex>
+#endif
+#include <scoped_allocator>
+#include <semaphore>
+#include <set>
+#include <shared_mutex>
+#include <source_location>
+#include <span>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  include <sstream>
+#endif
+#include <stack>
+#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
+#  include <stdatomic.h>
+#endif
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdexcept>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stop_token>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  include <streambuf>
+#endif
+#include <string.h>
+#include <string>
+#include <string_view>
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  include <strstream>
+#endif
+#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
+#  include <syncstream>
+#endif
+#include <system_error>
+#include <tgmath.h>
+#include <thread>
+#include <tuple>
+#include <type_traits>
+#include <typeindex>
+#include <typeinfo>
+#include <uchar.h>
+#include <unordered_map>
+#include <unordered_set>
+#include <utility>
+#include <valarray>
+#include <variant>
+#include <vector>
+#include <version>
+#include <wchar.h>
+#include <wctype.h>
diff --git a/libcxx/include/module.modulemap b/libcxx/include/module.modulemap
index aa05bde939f6c2..ef4a242cf8bf7f 100644
--- a/libcxx/include/module.modulemap
+++ b/libcxx/include/module.modulemap
@@ -1,2235 +1,2124 @@
-// 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"
+// Main C++ standard library interfaces
+module std_algorithm [system] {
+  header "algorithm"
+  export *
 }
-
-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" }
-  }
-
-  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" }
-  }
-
-  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" }
-  }
-
-  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 std_core.type_traits.integral_constant
-    }
-    module is_aggregate {
-      header "__type_traits/is_aggregate.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_allocator {
-      header "__type_traits/is_allocator.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_always_bitcastable {
-      header "__type_traits/is_always_bitcastable.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_arithmetic {
-      header "__type_traits/is_arithmetic.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_array {
-      header "__type_traits/is_array.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_assignable {
-      header "__type_traits/is_assignable.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_base_of {
-      header "__type_traits/is_base_of.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_bounded_array {
-      header "__type_traits/is_bounded_array.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_callable {
-      header "__type_traits/is_callable.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_char_like_type {
-      header "__type_traits/is_char_like_type.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_class {
-      header "__type_traits/is_class.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_compound {
-      header "__type_traits/is_compound.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_const {
-      header "__type_traits/is_const.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_constant_evaluated {
-      header "__type_traits/is_constant_evaluated.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_constructible {
-      header "__type_traits/is_constructible.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_convertible {
-      header "__type_traits/is_convertible.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_core_convertible {
-      header "__type_traits/is_core_convertible.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_destructible {
-      header "__type_traits/is_destructible.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_empty {
-      header "__type_traits/is_empty.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_enum {
-      header "__type_traits/is_enum.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_equality_comparable {
-      header "__type_traits/is_equality_comparable.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_execution_policy {
-      header "__type_traits/is_execution_policy.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_final {
-      header "__type_traits/is_final.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_floating_point {
-      header "__type_traits/is_floating_point.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_function {
-      header "__type_traits/is_function.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_fundamental {
-      header "__type_traits/is_fundamental.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_implicitly_default_constructible {
-      header "__type_traits/is_implicitly_default_constructible.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_integral {
-      header "__type_traits/is_integral.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_literal_type {
-      header "__type_traits/is_literal_type.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_member_pointer {
-      header "__type_traits/is_member_pointer.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_nothrow_assignable {
-      header "__type_traits/is_nothrow_assignable.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_nothrow_constructible {
-      header "__type_traits/is_nothrow_constructible.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_nothrow_convertible {
-      header "__type_traits/is_nothrow_convertible.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_nothrow_destructible {
-      header "__type_traits/is_nothrow_destructible.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_null_pointer {
-      header "__type_traits/is_null_pointer.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_object {
-      header "__type_traits/is_object.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_pod {
-      header "__type_traits/is_pod.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_pointer {
-      header "__type_traits/is_pointer.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_polymorphic {
-      header "__type_traits/is_polymorphic.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_primary_template {
-      header "__type_traits/is_primary_template.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_reference_wrapper {
-      header "__type_traits/is_reference_wrapper.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_reference {
-      header "__type_traits/is_reference.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_referenceable {
-      header "__type_traits/is_referenceable.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_same {
-      header "__type_traits/is_same.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_scalar {
-      header "__type_traits/is_scalar.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_signed_integer {
-      header "__type_traits/is_signed_integer.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_signed {
-      header "__type_traits/is_signed.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_specialization {
-      header "__type_traits/is_specialization.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_standard_layout {
-      header "__type_traits/is_standard_layout.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_swappable {
-      header "__type_traits/is_swappable.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_trivial {
-      header "__type_traits/is_trivial.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_trivially_assignable {
-      header "__type_traits/is_trivially_assignable.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_trivially_constructible {
-      header "__type_traits/is_trivially_constructible.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_trivially_copyable {
-      header "__type_traits/is_trivially_copyable.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_trivially_destructible {
-      header "__type_traits/is_trivially_destructible.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_trivially_lexicographically_comparable {
-      header "__type_traits/is_trivially_lexicographically_comparable.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_trivially_relocatable {
-      header "__type_traits/is_trivially_relocatable.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_unbounded_array {
-      header "__type_traits/is_unbounded_array.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_union {
-      header "__type_traits/is_union.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_unsigned_integer {
-      header "__type_traits/is_unsigned_integer.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_unsigned {
-      header "__type_traits/is_unsigned.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_valid_expansion {
-      header "__type_traits/is_valid_expansion.h"
-      export std_core.type_traits.integral_constant
-    }
-    module is_voi...
[truncated]

``````````

</details>


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


More information about the libcxx-commits mailing list