aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libcxx/modules/CMakeLists.txt245
-rw-r--r--libcxx/modules/CMakeLists.txt.in2
-rw-r--r--libcxx/modules/README.md21
-rw-r--r--libcxx/modules/std.cppm123
-rw-r--r--libcxx/modules/std.cppm.in170
-rw-r--r--libcxx/modules/std/algorithm.inc (renamed from libcxx/modules/std/algorithm.cppm)4
-rw-r--r--libcxx/modules/std/any.inc (renamed from libcxx/modules/std/any.cppm)4
-rw-r--r--libcxx/modules/std/array.inc (renamed from libcxx/modules/std/array.cppm)4
-rw-r--r--libcxx/modules/std/atomic.inc (renamed from libcxx/modules/std/atomic.cppm)4
-rw-r--r--libcxx/modules/std/barrier.inc (renamed from libcxx/modules/std/barrier.cppm)4
-rw-r--r--libcxx/modules/std/bit.inc (renamed from libcxx/modules/std/bit.cppm)4
-rw-r--r--libcxx/modules/std/bitset.inc (renamed from libcxx/modules/std/bitset.cppm)4
-rw-r--r--libcxx/modules/std/cassert.inc (renamed from libcxx/modules/std/cerrno.cppm)4
-rw-r--r--libcxx/modules/std/cctype.inc (renamed from libcxx/modules/std/cctype.cppm)4
-rw-r--r--libcxx/modules/std/cerrno.inc (renamed from libcxx/modules/std/cfloat.cppm)4
-rw-r--r--libcxx/modules/std/cfenv.inc (renamed from libcxx/modules/std/cfenv.cppm)4
-rw-r--r--libcxx/modules/std/cfloat.inc (renamed from libcxx/modules/std/climits.cppm)4
-rw-r--r--libcxx/modules/std/charconv.inc (renamed from libcxx/modules/std/charconv.cppm)4
-rw-r--r--libcxx/modules/std/chrono.inc (renamed from libcxx/modules/std/chrono.cppm)4
-rw-r--r--libcxx/modules/std/cinttypes.inc (renamed from libcxx/modules/std/cinttypes.cppm)4
-rw-r--r--libcxx/modules/std/climits.inc (renamed from libcxx/modules/std/cassert.cppm)4
-rw-r--r--libcxx/modules/std/clocale.inc (renamed from libcxx/modules/std/clocale.cppm)12
-rw-r--r--libcxx/modules/std/cmath.inc (renamed from libcxx/modules/std/cmath.cppm)4
-rw-r--r--libcxx/modules/std/codecvt.inc (renamed from libcxx/modules/std/codecvt.cppm)13
-rw-r--r--libcxx/modules/std/compare.inc (renamed from libcxx/modules/std/compare.cppm)4
-rw-r--r--libcxx/modules/std/complex.inc (renamed from libcxx/modules/std/complex.cppm)4
-rw-r--r--libcxx/modules/std/concepts.inc (renamed from libcxx/modules/std/concepts.cppm)4
-rw-r--r--libcxx/modules/std/condition_variable.inc (renamed from libcxx/modules/std/condition_variable.cppm)4
-rw-r--r--libcxx/modules/std/coroutine.inc (renamed from libcxx/modules/std/coroutine.cppm)4
-rw-r--r--libcxx/modules/std/csetjmp.inc (renamed from libcxx/modules/std/csetjmp.cppm)4
-rw-r--r--libcxx/modules/std/csignal.inc (renamed from libcxx/modules/std/csignal.cppm)4
-rw-r--r--libcxx/modules/std/cstdarg.inc (renamed from libcxx/modules/std/cstdarg.cppm)4
-rw-r--r--libcxx/modules/std/cstddef.inc (renamed from libcxx/modules/std/cstddef.cppm)4
-rw-r--r--libcxx/modules/std/cstdint.inc (renamed from libcxx/modules/std/cstdint.cppm)4
-rw-r--r--libcxx/modules/std/cstdio.inc (renamed from libcxx/modules/std/cstdio.cppm)4
-rw-r--r--libcxx/modules/std/cstdlib.inc (renamed from libcxx/modules/std/cstdlib.cppm)4
-rw-r--r--libcxx/modules/std/cstring.inc (renamed from libcxx/modules/std/cstring.cppm)4
-rw-r--r--libcxx/modules/std/ctime.inc (renamed from libcxx/modules/std/ctime.cppm)4
-rw-r--r--libcxx/modules/std/cuchar.inc (renamed from libcxx/modules/std/cuchar.cppm)6
-rw-r--r--libcxx/modules/std/cwchar.inc (renamed from libcxx/modules/std/cwchar.cppm)12
-rw-r--r--libcxx/modules/std/cwctype.inc (renamed from libcxx/modules/std/cwctype.cppm)11
-rw-r--r--libcxx/modules/std/deque.inc (renamed from libcxx/modules/std/deque.cppm)4
-rw-r--r--libcxx/modules/std/exception.inc (renamed from libcxx/modules/std/exception.cppm)3
-rw-r--r--libcxx/modules/std/execution.inc (renamed from libcxx/modules/std/execution.cppm)4
-rw-r--r--libcxx/modules/std/expected.inc (renamed from libcxx/modules/std/expected.cppm)4
-rw-r--r--libcxx/modules/std/filesystem.inc (renamed from libcxx/modules/std/filesystem.cppm)4
-rw-r--r--libcxx/modules/std/flat_map.inc (renamed from libcxx/modules/std/flat_map.cppm)7
-rw-r--r--libcxx/modules/std/flat_set.inc (renamed from libcxx/modules/std/flat_set.cppm)7
-rw-r--r--libcxx/modules/std/format.inc (renamed from libcxx/modules/std/format.cppm)4
-rw-r--r--libcxx/modules/std/forward_list.inc (renamed from libcxx/modules/std/forward_list.cppm)4
-rw-r--r--libcxx/modules/std/fstream.inc (renamed from libcxx/modules/std/fstream.cppm)11
-rw-r--r--libcxx/modules/std/functional.inc (renamed from libcxx/modules/std/functional.cppm)4
-rw-r--r--libcxx/modules/std/future.inc (renamed from libcxx/modules/std/future.cppm)4
-rw-r--r--libcxx/modules/std/generator.cppm21
-rw-r--r--libcxx/modules/std/generator.inc14
-rw-r--r--libcxx/modules/std/hazard_pointer.inc (renamed from libcxx/modules/std/hazard_pointer.cppm)7
-rw-r--r--libcxx/modules/std/initializer_list.inc (renamed from libcxx/modules/std/initializer_list.cppm)4
-rw-r--r--libcxx/modules/std/iomanip.inc (renamed from libcxx/modules/std/iomanip.cppm)11
-rw-r--r--libcxx/modules/std/ios.inc (renamed from libcxx/modules/std/ios.cppm)11
-rw-r--r--libcxx/modules/std/iosfwd.inc (renamed from libcxx/modules/std/iosfwd.cppm)4
-rw-r--r--libcxx/modules/std/iostream.inc (renamed from libcxx/modules/std/iostream.cppm)11
-rw-r--r--libcxx/modules/std/istream.inc (renamed from libcxx/modules/std/istream.cppm)11
-rw-r--r--libcxx/modules/std/iterator.inc (renamed from libcxx/modules/std/iterator.cppm)4
-rw-r--r--libcxx/modules/std/latch.inc (renamed from libcxx/modules/std/latch.cppm)4
-rw-r--r--libcxx/modules/std/limits.inc (renamed from libcxx/modules/std/limits.cppm)4
-rw-r--r--libcxx/modules/std/list.inc (renamed from libcxx/modules/std/list.cppm)4
-rw-r--r--libcxx/modules/std/locale.inc (renamed from libcxx/modules/std/locale.cppm)9
-rw-r--r--libcxx/modules/std/map.inc (renamed from libcxx/modules/std/map.cppm)4
-rw-r--r--libcxx/modules/std/mdspan.inc (renamed from libcxx/modules/std/mdspan.cppm)4
-rw-r--r--libcxx/modules/std/memory.inc (renamed from libcxx/modules/std/memory.cppm)4
-rw-r--r--libcxx/modules/std/memory_resource.inc (renamed from libcxx/modules/std/memory_resource.cppm)4
-rw-r--r--libcxx/modules/std/mutex.inc (renamed from libcxx/modules/std/mutex.cppm)4
-rw-r--r--libcxx/modules/std/new.inc (renamed from libcxx/modules/std/new.cppm)4
-rw-r--r--libcxx/modules/std/numbers.inc (renamed from libcxx/modules/std/numbers.cppm)4
-rw-r--r--libcxx/modules/std/numeric.inc (renamed from libcxx/modules/std/numeric.cppm)4
-rw-r--r--libcxx/modules/std/optional.inc (renamed from libcxx/modules/std/optional.cppm)4
-rw-r--r--libcxx/modules/std/ostream.inc (renamed from libcxx/modules/std/ostream.cppm)11
-rw-r--r--libcxx/modules/std/print.inc (renamed from libcxx/modules/std/print.cppm)4
-rw-r--r--libcxx/modules/std/queue.inc (renamed from libcxx/modules/std/queue.cppm)4
-rw-r--r--libcxx/modules/std/random.inc (renamed from libcxx/modules/std/random.cppm)4
-rw-r--r--libcxx/modules/std/ranges.inc (renamed from libcxx/modules/std/ranges.cppm)4
-rw-r--r--libcxx/modules/std/ratio.inc (renamed from libcxx/modules/std/ratio.cppm)4
-rw-r--r--libcxx/modules/std/rcu.inc (renamed from libcxx/modules/std/rcu.cppm)7
-rw-r--r--libcxx/modules/std/regex.inc (renamed from libcxx/modules/std/regex.cppm)13
-rw-r--r--libcxx/modules/std/scoped_allocator.inc (renamed from libcxx/modules/std/scoped_allocator.cppm)4
-rw-r--r--libcxx/modules/std/semaphore.inc (renamed from libcxx/modules/std/semaphore.cppm)4
-rw-r--r--libcxx/modules/std/set.inc (renamed from libcxx/modules/std/set.cppm)4
-rw-r--r--libcxx/modules/std/shared_mutex.inc (renamed from libcxx/modules/std/shared_mutex.cppm)4
-rw-r--r--libcxx/modules/std/source_location.inc (renamed from libcxx/modules/std/source_location.cppm)4
-rw-r--r--libcxx/modules/std/span.inc (renamed from libcxx/modules/std/span.cppm)4
-rw-r--r--libcxx/modules/std/spanstream.inc (renamed from libcxx/modules/std/spanstream.cppm)7
-rw-r--r--libcxx/modules/std/sstream.inc (renamed from libcxx/modules/std/sstream.cppm)11
-rw-r--r--libcxx/modules/std/stack.inc (renamed from libcxx/modules/std/stack.cppm)4
-rw-r--r--libcxx/modules/std/stacktrace.inc (renamed from libcxx/modules/std/stacktrace.cppm)7
-rw-r--r--libcxx/modules/std/stdexcept.inc (renamed from libcxx/modules/std/stdexcept.cppm)4
-rw-r--r--libcxx/modules/std/stdfloat.inc (renamed from libcxx/modules/std/stdfloat.cppm)7
-rw-r--r--libcxx/modules/std/stop_token.inc (renamed from libcxx/modules/std/stop_token.cppm)4
-rw-r--r--libcxx/modules/std/streambuf.inc (renamed from libcxx/modules/std/streambuf.cppm)11
-rw-r--r--libcxx/modules/std/string.inc (renamed from libcxx/modules/std/string.cppm)4
-rw-r--r--libcxx/modules/std/string_view.inc (renamed from libcxx/modules/std/string_view.cppm)4
-rw-r--r--libcxx/modules/std/strstream.inc (renamed from libcxx/modules/std/strstream.cppm)11
-rw-r--r--libcxx/modules/std/syncstream.inc (renamed from libcxx/modules/std/syncstream.cppm)7
-rw-r--r--libcxx/modules/std/system_error.inc (renamed from libcxx/modules/std/system_error.cppm)4
-rw-r--r--libcxx/modules/std/text_encoding.cppm26
-rw-r--r--libcxx/modules/std/text_encoding.inc19
-rw-r--r--libcxx/modules/std/thread.inc (renamed from libcxx/modules/std/thread.cppm)4
-rw-r--r--libcxx/modules/std/tuple.inc (renamed from libcxx/modules/std/tuple.cppm)4
-rw-r--r--libcxx/modules/std/type_traits.inc (renamed from libcxx/modules/std/type_traits.cppm)3
-rw-r--r--libcxx/modules/std/typeindex.inc (renamed from libcxx/modules/std/typeindex.cppm)4
-rw-r--r--libcxx/modules/std/typeinfo.inc (renamed from libcxx/modules/std/typeinfo.cppm)4
-rw-r--r--libcxx/modules/std/unordered_map.inc (renamed from libcxx/modules/std/unordered_map.cppm)4
-rw-r--r--libcxx/modules/std/unordered_set.inc (renamed from libcxx/modules/std/unordered_set.cppm)4
-rw-r--r--libcxx/modules/std/utility.inc (renamed from libcxx/modules/std/utility.cppm)3
-rw-r--r--libcxx/modules/std/valarray.inc (renamed from libcxx/modules/std/valarray.cppm)4
-rw-r--r--libcxx/modules/std/variant.inc (renamed from libcxx/modules/std/variant.cppm)4
-rw-r--r--libcxx/modules/std/vector.inc (renamed from libcxx/modules/std/vector.cppm)5
-rw-r--r--libcxx/modules/std/version.cppm16
-rw-r--r--libcxx/modules/std/version.inc12
-rw-r--r--libcxx/test/libcxx/module_std.gen.py23
-rw-r--r--libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp10
120 files changed, 419 insertions, 844 deletions
diff --git a/libcxx/modules/CMakeLists.txt b/libcxx/modules/CMakeLists.txt
index d24ddb0..572ee2d 100644
--- a/libcxx/modules/CMakeLists.txt
+++ b/libcxx/modules/CMakeLists.txt
@@ -5,120 +5,117 @@ endif()
# The headers of Table 24: C++ library headers [tab:headers.cpp]
# and the headers of Table 25: C++ headers for C library facilities [tab:headers.cpp.c]
-set(LIBCXX_SOURCES_MODULE_STD
- std.cppm
- std/algorithm.cppm
- std/any.cppm
- std/array.cppm
- std/atomic.cppm
- std/barrier.cppm
- std/bit.cppm
- std/bitset.cppm
- std/cassert.cppm
- std/cctype.cppm
- std/cerrno.cppm
- std/cfenv.cppm
- std/cfloat.cppm
- std/charconv.cppm
- std/chrono.cppm
- std/cinttypes.cppm
- std/climits.cppm
- std/clocale.cppm
- std/cmath.cppm
- std/codecvt.cppm
- std/compare.cppm
- std/complex.cppm
- std/concepts.cppm
- std/condition_variable.cppm
- std/coroutine.cppm
- std/csetjmp.cppm
- std/csignal.cppm
- std/cstdarg.cppm
- std/cstddef.cppm
- std/cstdint.cppm
- std/cstdio.cppm
- std/cstdlib.cppm
- std/cstring.cppm
- std/ctime.cppm
- std/cuchar.cppm
- std/cwchar.cppm
- std/cwctype.cppm
- std/deque.cppm
- std/exception.cppm
- std/execution.cppm
- std/expected.cppm
- std/filesystem.cppm
- std/flat_map.cppm
- std/flat_set.cppm
- std/format.cppm
- std/forward_list.cppm
- std/fstream.cppm
- std/functional.cppm
- std/future.cppm
- std/generator.cppm
- std/hazard_pointer.cppm
- std/initializer_list.cppm
- std/iomanip.cppm
- std/ios.cppm
- std/iosfwd.cppm
- std/iostream.cppm
- std/iostream.cppm
- std/istream.cppm
- std/iterator.cppm
- std/latch.cppm
- std/limits.cppm
- std/list.cppm
- std/locale.cppm
- std/map.cppm
- std/mdspan.cppm
- std/memory.cppm
- std/memory_resource.cppm
- std/mutex.cppm
- std/new.cppm
- std/numbers.cppm
- std/numeric.cppm
- std/optional.cppm
- std/ostream.cppm
- std/print.cppm
- std/queue.cppm
- std/random.cppm
- std/ranges.cppm
- std/ratio.cppm
- std/rcu.cppm
- std/regex.cppm
- std/scoped_allocator.cppm
- std/semaphore.cppm
- std/set.cppm
- std/shared_mutex.cppm
- std/source_location.cppm
- std/span.cppm
- std/spanstream.cppm
- std/sstream.cppm
- std/stack.cppm
- std/stacktrace.cppm
- std/stdexcept.cppm
- std/stdexcept.cppm
- std/stdfloat.cppm
- std/stop_token.cppm
- std/streambuf.cppm
- std/string.cppm
- std/string_view.cppm
- std/strstream.cppm
- std/syncstream.cppm
- std/system_error.cppm
- std/text_encoding.cppm
- std/thread.cppm
- std/tuple.cppm
- std/type_traits.cppm
- std/typeindex.cppm
- std/typeinfo.cppm
- std/unordered_map.cppm
- std/unordered_set.cppm
- std/utility.cppm
- std/valarray.cppm
- std/variant.cppm
- std/vector.cppm
- std/version.cppm
+set(LIBCXX_MODULE_STD_SOURCES
+ std/algorithm.inc
+ std/any.inc
+ std/array.inc
+ std/atomic.inc
+ std/barrier.inc
+ std/bit.inc
+ std/bitset.inc
+ std/cassert.inc
+ std/cctype.inc
+ std/cerrno.inc
+ std/cfenv.inc
+ std/cfloat.inc
+ std/charconv.inc
+ std/chrono.inc
+ std/cinttypes.inc
+ std/climits.inc
+ std/clocale.inc
+ std/cmath.inc
+ std/codecvt.inc
+ std/compare.inc
+ std/complex.inc
+ std/concepts.inc
+ std/condition_variable.inc
+ std/coroutine.inc
+ std/csetjmp.inc
+ std/csignal.inc
+ std/cstdarg.inc
+ std/cstddef.inc
+ std/cstdint.inc
+ std/cstdio.inc
+ std/cstdlib.inc
+ std/cstring.inc
+ std/ctime.inc
+ std/cuchar.inc
+ std/cwchar.inc
+ std/cwctype.inc
+ std/deque.inc
+ std/exception.inc
+ std/execution.inc
+ std/expected.inc
+ std/filesystem.inc
+ std/flat_map.inc
+ std/flat_set.inc
+ std/format.inc
+ std/forward_list.inc
+ std/fstream.inc
+ std/functional.inc
+ std/future.inc
+ std/generator.inc
+ std/hazard_pointer.inc
+ std/initializer_list.inc
+ std/iomanip.inc
+ std/ios.inc
+ std/iosfwd.inc
+ std/iostream.inc
+ std/istream.inc
+ std/iterator.inc
+ std/latch.inc
+ std/limits.inc
+ std/list.inc
+ std/locale.inc
+ std/map.inc
+ std/mdspan.inc
+ std/memory.inc
+ std/memory_resource.inc
+ std/mutex.inc
+ std/new.inc
+ std/numbers.inc
+ std/numeric.inc
+ std/optional.inc
+ std/ostream.inc
+ std/print.inc
+ std/queue.inc
+ std/random.inc
+ std/ranges.inc
+ std/ratio.inc
+ std/rcu.inc
+ std/regex.inc
+ std/scoped_allocator.inc
+ std/semaphore.inc
+ std/set.inc
+ std/shared_mutex.inc
+ std/source_location.inc
+ std/span.inc
+ std/spanstream.inc
+ std/sstream.inc
+ std/stack.inc
+ std/stacktrace.inc
+ std/stdexcept.inc
+ std/stdfloat.inc
+ std/stop_token.inc
+ std/streambuf.inc
+ std/string.inc
+ std/string_view.inc
+ std/strstream.inc
+ std/syncstream.inc
+ std/system_error.inc
+ std/text_encoding.inc
+ std/thread.inc
+ std/tuple.inc
+ std/type_traits.inc
+ std/typeindex.inc
+ std/typeinfo.inc
+ std/unordered_map.inc
+ std/unordered_set.inc
+ std/utility.inc
+ std/valarray.inc
+ std/variant.inc
+ std/vector.inc
+ std/version.inc
)
# TODO MODULES the CMakeLists.txt in the install directory is only temporary
@@ -132,8 +129,24 @@ configure_file(
@ONLY
)
-set(_all_modules "${LIBCXX_GENERATED_MODULE_DIR}/CMakeLists.txt")
-foreach(file ${LIBCXX_SOURCES_MODULE_STD})
+set(LIBCXX_MODULE_STD_INCLUDE_SOURCES)
+foreach(file ${LIBCXX_MODULE_STD_SOURCES})
+ set(
+ LIBCXX_MODULE_STD_INCLUDE_SOURCES
+ "${LIBCXX_MODULE_STD_INCLUDE_SOURCES}#include \"${file}\"\n"
+ )
+endforeach()
+
+configure_file(
+ "std.cppm.in"
+ "${LIBCXX_GENERATED_MODULE_DIR}/std.cppm"
+ @ONLY
+)
+
+set(_all_modules)
+list(APPEND _all_modules "${LIBCXX_GENERATED_MODULE_DIR}/CMakeLists.txt")
+list(APPEND _all_modules "${LIBCXX_GENERATED_MODULE_DIR}/std.cppm")
+foreach(file ${LIBCXX_MODULE_STD_SOURCES})
set(src "${CMAKE_CURRENT_SOURCE_DIR}/${file}")
set(dst "${LIBCXX_GENERATED_MODULE_DIR}/${file}")
add_custom_command(OUTPUT ${dst}
diff --git a/libcxx/modules/CMakeLists.txt.in b/libcxx/modules/CMakeLists.txt.in
index 3cf20ae..88272e1 100644
--- a/libcxx/modules/CMakeLists.txt.in
+++ b/libcxx/modules/CMakeLists.txt.in
@@ -48,7 +48,7 @@ endif()
add_library(std)
target_sources(std
PUBLIC FILE_SET cxx_modules TYPE CXX_MODULES FILES
- @LIBCXX_SOURCES_MODULE_STD@
+ std.cppm
)
target_compile_definitions(std PRIVATE _LIBCPP_ENABLE_EXPERIMENTAL)
diff --git a/libcxx/modules/README.md b/libcxx/modules/README.md
new file mode 100644
index 0000000..23dd606
--- /dev/null
+++ b/libcxx/modules/README.md
@@ -0,0 +1,21 @@
+# The "module partitions" for the std module
+
+The files in this directory contain the exported named declarations per header.
+These files are used for the following purposes:
+
+ - During testing exported named declarations are tested against the named
+ declarations in the associated header. This excludes reserved names; they
+ are not exported.
+ - Generate the module std.
+
+These use cases require including the required headers for these "partitions"
+at different locations. This means the user of these "partitions" are
+responsible for including the proper header and validating whether the header can
+be loaded in the current libc++ configuration. For example "include <locale>"
+fails when locales are not available. The "partitions" use the libc++ feature
+macros to export the declarations available in the current configuration. This
+configuration is available if the user includes the `__config' header.
+
+We use `.inc` files that we include from the top-level module instead of
+using real C++ module partitions. This is a lot faster than module partitions,
+see [this](https://discourse.llvm.org/t/alternatives-to-the-implementation-of-std-modules/71958) for details.
diff --git a/libcxx/modules/std.cppm b/libcxx/modules/std.cppm
deleted file mode 100644
index fcd7d55..0000000
--- a/libcxx/modules/std.cppm
+++ /dev/null
@@ -1,123 +0,0 @@
-// -*- 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
-//
-//===----------------------------------------------------------------------===//
-
-export module std;
-
-// The headers of Table 24: C++ library headers [tab:headers.cpp]
-// and the headers of Table 25: C++ headers for C library facilities [tab:headers.cpp.c]
-export import :__new; // Note new is a keyword and not a valid identifier
-export import :algorithm;
-export import :any;
-export import :array;
-export import :atomic;
-export import :barrier;
-export import :bit;
-export import :bitset;
-export import :cassert;
-export import :cctype;
-export import :cerrno;
-export import :cfenv;
-export import :cfloat;
-export import :charconv;
-export import :chrono;
-export import :cinttypes;
-export import :climits;
-export import :clocale;
-export import :cmath;
-export import :codecvt;
-export import :compare;
-export import :complex;
-export import :concepts;
-export import :condition_variable;
-export import :coroutine;
-export import :csetjmp;
-export import :csignal;
-export import :cstdarg;
-export import :cstddef;
-export import :cstdio;
-export import :cstdlib;
-export import :cstdint;
-export import :cstring;
-export import :ctime;
-export import :cuchar;
-export import :cwchar;
-export import :cwctype;
-export import :deque;
-export import :exception;
-export import :execution;
-export import :expected;
-export import :filesystem;
-export import :flat_map;
-export import :flat_set;
-export import :format;
-export import :forward_list;
-export import :fstream;
-export import :functional;
-export import :future;
-export import :generator;
-export import :hazard_pointer;
-export import :initializer_list;
-export import :iomanip;
-export import :ios;
-export import :iosfwd;
-export import :iostream;
-export import :istream;
-export import :iterator;
-export import :latch;
-export import :limits;
-export import :list;
-export import :locale;
-export import :map;
-export import :mdspan;
-export import :memory;
-export import :memory_resource;
-export import :mutex;
-export import :numbers;
-export import :numeric;
-export import :optional;
-export import :ostream;
-export import :print;
-export import :queue;
-export import :random;
-export import :ranges;
-export import :ratio;
-export import :rcu;
-export import :regex;
-export import :scoped_allocator;
-export import :semaphore;
-export import :set;
-export import :shared_mutex;
-export import :source_location;
-export import :span;
-export import :spanstream;
-export import :sstream;
-export import :stack;
-export import :stacktrace;
-export import :stdexcept;
-export import :stdfloat;
-export import :stop_token;
-export import :streambuf;
-export import :string;
-export import :string_view;
-export import :strstream;
-export import :syncstream;
-export import :system_error;
-export import :text_encoding;
-export import :thread;
-export import :tuple;
-export import :type_traits;
-export import :typeindex;
-export import :typeinfo;
-export import :unordered_map;
-export import :unordered_set;
-export import :utility;
-export import :valarray;
-export import :variant;
-export import :vector;
-export import :version;
diff --git a/libcxx/modules/std.cppm.in b/libcxx/modules/std.cppm.in
new file mode 100644
index 0000000..dd611d5
--- /dev/null
+++ b/libcxx/modules/std.cppm.in
@@ -0,0 +1,170 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+module;
+
+#include <__config>
+
+// TODO MODULES This could be generated
+
+// The headers of Table 24: C++ library headers [tab:headers.cpp]
+// and the headers of Table 25: C++ headers for C library facilities [tab:headers.cpp.c]
+#include <algorithm>
+#include <any>
+#include <array>
+#include <atomic>
+#include <barrier>
+#include <bit>
+#include <bitset>
+#include <cassert>
+#include <cctype>
+#include <cerrno>
+#include <cfenv>
+#include <cfloat>
+#include <charconv>
+#include <chrono>
+#include <cinttypes>
+#include <climits>
+#include <cmath>
+#include <compare>
+#include <complex>
+#include <concepts>
+#include <condition_variable>
+#include <coroutine>
+#include <csetjmp>
+#include <csignal>
+#include <cstdarg>
+#include <cstddef>
+#include <cstdint>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+#include <ctime>
+#include <cuchar>
+#include <deque>
+#include <exception>
+#include <execution>
+#include <expected>
+#include <filesystem>
+#include <format>
+#include <forward_list>
+#include <functional>
+#include <future>
+#include <initializer_list>
+#include <iosfwd>
+#include <iterator>
+#include <latch>
+#include <limits>
+#include <list>
+#include <map>
+#include <mdspan>
+#include <memory>
+#include <memory_resource>
+#include <mutex>
+#include <new>
+#include <numbers>
+#include <numeric>
+#include <optional>
+#include <print>
+#include <queue>
+#include <random>
+#include <ranges>
+#include <ratio>
+#include <scoped_allocator>
+#include <semaphore>
+#include <set>
+#include <shared_mutex>
+#include <source_location>
+#include <span>
+#include <stack>
+#include <stdexcept>
+#include <stop_token>
+#include <string>
+#include <string_view>
+#include <system_error>
+#include <thread>
+#include <tuple>
+#include <type_traits>
+#include <typeindex>
+#include <typeinfo>
+#include <unordered_map>
+#include <unordered_set>
+#include <utility>
+#include <valarray>
+#include <variant>
+#include <vector>
+#include <version>
+
+// *** Headers disabled by a feature ***
+
+#ifndef _LIBCPP_HAS_NO_LOCALIZATION
+# include <clocale>
+# include <codecvt>
+# include <fstream>
+# include <iomanip>
+# include <ios>
+# include <iostream>
+# include <istream>
+# include <locale>
+# include <ostream>
+# include <regex>
+# include <sstream>
+# include <streambuf>
+# include <strstream>
+#endif // _LIBCPP_HAS_NO_LOCALIZATION
+#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
+# include <cwchar>
+# include <cwctype>
+#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+
+// *** Headers not yet available ***
+#if __has_include(<generator>)
+# error "include <generator> unconditionally"
+# include <generator>
+#endif // __has_include(<generator>)
+#if __has_include(<hazard_pointer>)
+# error "include <hazard_pointer> unconditionally"
+# include <hazard_pointer>
+#endif // __has_include(<hazard_pointer>)
+#if __has_include(<flat_map>)
+# error "include <flat_map> unconditionally"
+# include <flat_map>
+#endif // __has_include(<flat_map>)
+#if __has_include(<flat_set>)
+# error "include <flat_set> unconditionally"
+# include <flat_set>
+#endif // __has_include(<flat_set>)
+#if __has_include(<rcu>)
+# error "include <rcu> unconditionally"
+# include <rcu>
+#endif // __has_include(<rcu>)
+#if __has_include(<spanstream>)
+# error "include <spanstream> unconditionally"
+# include <spanstream>
+#endif // __has_include(<spanstream>)
+#if __has_include(<stacktrace>)
+# error "include <stacktrace> unconditionally"
+# include <stacktrace>
+#endif // __has_include(<stacktrace>)
+#if __has_include(<stdfloat>)
+# error "include <stdfloat> unconditionally"
+# include <stdfloat>
+#endif // __has_include(<stdfloat>)
+#if __has_include(<syncstream>)
+# error "include <syncstream> unconditionally"
+# include <syncstream>
+#endif // __has_include(<syncstream>)
+#if __has_include(<text_encoding>)
+# error "include <text_encoding> unconditionally"
+# include <text_encoding>
+#endif // __has_include(<text_encoding>)
+
+export module std;
+
+@LIBCXX_MODULE_STD_INCLUDE_SOURCES@
diff --git a/libcxx/modules/std/algorithm.cppm b/libcxx/modules/std/algorithm.inc
index 6598c19..bb38f39 100644
--- a/libcxx/modules/std/algorithm.cppm
+++ b/libcxx/modules/std/algorithm.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <algorithm>
-
-export module std:algorithm;
export namespace std {
namespace ranges {
// [algorithms.results], algorithm result types
diff --git a/libcxx/modules/std/any.cppm b/libcxx/modules/std/any.inc
index f44f4da..c57257e 100644
--- a/libcxx/modules/std/any.cppm
+++ b/libcxx/modules/std/any.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <any>
-
-export module std:any;
export namespace std {
// [any.bad.any.cast], class bad_any_cast
diff --git a/libcxx/modules/std/array.cppm b/libcxx/modules/std/array.inc
index d7d0672..d55779c 100644
--- a/libcxx/modules/std/array.cppm
+++ b/libcxx/modules/std/array.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <array>
-
-export module std:array;
export namespace std {
// [array], class template array
diff --git a/libcxx/modules/std/atomic.cppm b/libcxx/modules/std/atomic.inc
index faf902b..5139b75 100644
--- a/libcxx/modules/std/atomic.cppm
+++ b/libcxx/modules/std/atomic.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <atomic>
-
-export module std:atomic;
export namespace std {
// [atomics.order], order and consistency
diff --git a/libcxx/modules/std/barrier.cppm b/libcxx/modules/std/barrier.inc
index bdecfae..bafd87e 100644
--- a/libcxx/modules/std/barrier.cppm
+++ b/libcxx/modules/std/barrier.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <barrier>
-
-export module std:barrier;
export namespace std {
using std::barrier;
} // namespace std
diff --git a/libcxx/modules/std/bit.cppm b/libcxx/modules/std/bit.inc
index 7e22602..2a05a8e 100644
--- a/libcxx/modules/std/bit.cppm
+++ b/libcxx/modules/std/bit.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <bit>
-
-export module std:bit;
export namespace std {
// [bit.cast], bit_cast
using std::bit_cast;
diff --git a/libcxx/modules/std/bitset.cppm b/libcxx/modules/std/bitset.inc
index 95404c8..bb52886 100644
--- a/libcxx/modules/std/bitset.cppm
+++ b/libcxx/modules/std/bitset.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <bitset>
-
-export module std:bitset;
export namespace std {
using std::bitset;
diff --git a/libcxx/modules/std/cerrno.cppm b/libcxx/modules/std/cassert.inc
index d319956..2ab8eb9 100644
--- a/libcxx/modules/std/cerrno.cppm
+++ b/libcxx/modules/std/cassert.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <cerrno>
-
-export module std:cerrno;
export namespace std {
// This module exports nothing.
} // namespace std
diff --git a/libcxx/modules/std/cctype.cppm b/libcxx/modules/std/cctype.inc
index d91c5c5..075dbbe 100644
--- a/libcxx/modules/std/cctype.cppm
+++ b/libcxx/modules/std/cctype.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <cctype>
-
-export module std:cctype;
export namespace std {
using std::isalnum;
using std::isalpha;
diff --git a/libcxx/modules/std/cfloat.cppm b/libcxx/modules/std/cerrno.inc
index daf4f55..2ab8eb9 100644
--- a/libcxx/modules/std/cfloat.cppm
+++ b/libcxx/modules/std/cerrno.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <cfloat>
-
-export module std:cfloat;
export namespace std {
// This module exports nothing.
} // namespace std
diff --git a/libcxx/modules/std/cfenv.cppm b/libcxx/modules/std/cfenv.inc
index bb1d314..34a8a7a 100644
--- a/libcxx/modules/std/cfenv.cppm
+++ b/libcxx/modules/std/cfenv.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <cfenv>
-
-export module std:cfenv;
export namespace std {
// types
using std::fenv_t;
diff --git a/libcxx/modules/std/climits.cppm b/libcxx/modules/std/cfloat.inc
index 04603b7..2ab8eb9 100644
--- a/libcxx/modules/std/climits.cppm
+++ b/libcxx/modules/std/cfloat.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <climits>
-
-export module std:climits;
export namespace std {
// This module exports nothing.
} // namespace std
diff --git a/libcxx/modules/std/charconv.cppm b/libcxx/modules/std/charconv.inc
index 0faa546..6fee460 100644
--- a/libcxx/modules/std/charconv.cppm
+++ b/libcxx/modules/std/charconv.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <charconv>
-
-export module std:charconv;
export namespace std {
// floating-point format for primitive numerical conversion
diff --git a/libcxx/modules/std/chrono.cppm b/libcxx/modules/std/chrono.inc
index dbb2265..8ed0b00 100644
--- a/libcxx/modules/std/chrono.cppm
+++ b/libcxx/modules/std/chrono.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <chrono>
-
-export module std:chrono;
export namespace std {
namespace chrono {
diff --git a/libcxx/modules/std/cinttypes.cppm b/libcxx/modules/std/cinttypes.inc
index 8758acc..2e13592 100644
--- a/libcxx/modules/std/cinttypes.cppm
+++ b/libcxx/modules/std/cinttypes.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <cinttypes>
-
-export module std:cinttypes;
export namespace std {
using std::imaxdiv_t;
diff --git a/libcxx/modules/std/cassert.cppm b/libcxx/modules/std/climits.inc
index 21dcd18..2ab8eb9 100644
--- a/libcxx/modules/std/cassert.cppm
+++ b/libcxx/modules/std/climits.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <cassert>
-
-export module std:cassert;
export namespace std {
// This module exports nothing.
} // namespace std
diff --git a/libcxx/modules/std/clocale.cppm b/libcxx/modules/std/clocale.inc
index 57d983c..3efe159 100644
--- a/libcxx/modules/std/clocale.cppm
+++ b/libcxx/modules/std/clocale.inc
@@ -7,19 +7,11 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <__config>
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-# include <clocale>
-#endif
-
-export module std:clocale;
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
export namespace std {
+#ifndef _LIBCPP_HAS_NO_LOCALIZATION
using std::lconv;
using std::localeconv;
using std::setlocale;
-
-} // namespace std
#endif // _LIBCPP_HAS_NO_LOCALIZATION
+} // namespace std
diff --git a/libcxx/modules/std/cmath.cppm b/libcxx/modules/std/cmath.inc
index 26f6ed9..0fe8874 100644
--- a/libcxx/modules/std/cmath.cppm
+++ b/libcxx/modules/std/cmath.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <cmath>
-
-export module std:cmath;
export namespace std {
using std::double_t;
diff --git a/libcxx/modules/std/codecvt.cppm b/libcxx/modules/std/codecvt.inc
index caa24c4..9960368 100644
--- a/libcxx/modules/std/codecvt.cppm
+++ b/libcxx/modules/std/codecvt.inc
@@ -7,21 +7,12 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <__config>
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-# include <codecvt>
-#endif
-
-export module std:codecvt;
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
export namespace std {
-
+#ifndef _LIBCPP_HAS_NO_LOCALIZATION
using std::codecvt_mode;
using std::codecvt_utf16;
using std::codecvt_utf8;
using std::codecvt_utf8_utf16;
-
-} // namespace std
#endif // _LIBCPP_HAS_NO_LOCALIZATION
+} // namespace std
diff --git a/libcxx/modules/std/compare.cppm b/libcxx/modules/std/compare.inc
index ebeff41..9d002d3 100644
--- a/libcxx/modules/std/compare.cppm
+++ b/libcxx/modules/std/compare.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <compare>
-
-export module std:compare;
export namespace std {
// [cmp.categories], comparison category types
diff --git a/libcxx/modules/std/complex.cppm b/libcxx/modules/std/complex.inc
index b3207db..7a55324 100644
--- a/libcxx/modules/std/complex.cppm
+++ b/libcxx/modules/std/complex.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <complex>
-
-export module std:complex;
export namespace std {
// [complex], class template complex
diff --git a/libcxx/modules/std/concepts.cppm b/libcxx/modules/std/concepts.inc
index 6c3333e..29f4e27 100644
--- a/libcxx/modules/std/concepts.cppm
+++ b/libcxx/modules/std/concepts.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <concepts>
-
-export module std:concepts;
export namespace std {
// [concepts.lang], language-related concepts
diff --git a/libcxx/modules/std/condition_variable.cppm b/libcxx/modules/std/condition_variable.inc
index 4528c41..95d00f3c 100644
--- a/libcxx/modules/std/condition_variable.cppm
+++ b/libcxx/modules/std/condition_variable.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <condition_variable>
-
-export module std:condition_variable;
export namespace std {
// [thread.condition.condvar], class condition_variable
diff --git a/libcxx/modules/std/coroutine.cppm b/libcxx/modules/std/coroutine.inc
index 26f141f..5d992f2 100644
--- a/libcxx/modules/std/coroutine.cppm
+++ b/libcxx/modules/std/coroutine.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <coroutine>
-#include <functional>
-export module std:coroutine;
export namespace std {
// [coroutine.traits], coroutine traits
diff --git a/libcxx/modules/std/csetjmp.cppm b/libcxx/modules/std/csetjmp.inc
index ba97c0c..68e226c 100644
--- a/libcxx/modules/std/csetjmp.cppm
+++ b/libcxx/modules/std/csetjmp.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <csetjmp>
-
-export module std:csetjmp;
export namespace std {
using std::jmp_buf;
using std::longjmp;
diff --git a/libcxx/modules/std/csignal.cppm b/libcxx/modules/std/csignal.inc
index 90a6c56..b57e8ed 100644
--- a/libcxx/modules/std/csignal.cppm
+++ b/libcxx/modules/std/csignal.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <csignal>
-
-export module std:csignal;
export namespace std {
using std::sig_atomic_t;
diff --git a/libcxx/modules/std/cstdarg.cppm b/libcxx/modules/std/cstdarg.inc
index 4b971b7..2b7309c 100644
--- a/libcxx/modules/std/cstdarg.cppm
+++ b/libcxx/modules/std/cstdarg.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <cstdarg>
-
-export module std:cstdarg;
export namespace std {
using std::va_list;
} // namespace std
diff --git a/libcxx/modules/std/cstddef.cppm b/libcxx/modules/std/cstddef.inc
index aecee6e..2b9ab0c 100644
--- a/libcxx/modules/std/cstddef.cppm
+++ b/libcxx/modules/std/cstddef.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <cstddef>
-
-export module std:cstddef;
export namespace std {
using std::max_align_t;
using std::nullptr_t;
diff --git a/libcxx/modules/std/cstdint.cppm b/libcxx/modules/std/cstdint.inc
index fdf8713..f6de447 100644
--- a/libcxx/modules/std/cstdint.cppm
+++ b/libcxx/modules/std/cstdint.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <cstdint>
-
-export module std:cstdint;
export namespace std {
// signed
using std::int8_t _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/modules/std/cstdio.cppm b/libcxx/modules/std/cstdio.inc
index b5b94ce..eec8170 100644
--- a/libcxx/modules/std/cstdio.cppm
+++ b/libcxx/modules/std/cstdio.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <cstdio>
-
-export module std:cstdio;
export namespace std {
using std::FILE;
using std::fpos_t;
diff --git a/libcxx/modules/std/cstdlib.cppm b/libcxx/modules/std/cstdlib.inc
index 4d1f331..11c7e86 100644
--- a/libcxx/modules/std/cstdlib.cppm
+++ b/libcxx/modules/std/cstdlib.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <cstdlib>
-
-export module std:cstdlib;
export namespace std {
using std::div_t;
using std::ldiv_t;
diff --git a/libcxx/modules/std/cstring.cppm b/libcxx/modules/std/cstring.inc
index 44b3dcf..d21714b7 100644
--- a/libcxx/modules/std/cstring.cppm
+++ b/libcxx/modules/std/cstring.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <cstring>
-
-export module std:cstring;
export namespace std {
using std::size_t;
diff --git a/libcxx/modules/std/ctime.cppm b/libcxx/modules/std/ctime.inc
index e63bd23..c407ffc 100644
--- a/libcxx/modules/std/ctime.cppm
+++ b/libcxx/modules/std/ctime.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <ctime>
-
-export module std:ctime;
export namespace std {
using std::clock_t;
using std::size_t;
diff --git a/libcxx/modules/std/cuchar.cppm b/libcxx/modules/std/cuchar.inc
index c3f8c41..fd80110 100644
--- a/libcxx/modules/std/cuchar.cppm
+++ b/libcxx/modules/std/cuchar.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <cuchar>
-
-export module std:cuchar;
export namespace std {
// Note the Standard does not mark these symbols optional, but libc++'s header
// does. So this seems strictly not to be conforming.
@@ -21,7 +17,7 @@ export namespace std {
// size_t is conditionally here, but always present in cstddef.cppm. To avoid
// conflicing declarations omit the using here.
-# if !defined(_LIBCPP_HAS_NO_C8RTOMB_MBRTOC8)
+#if !defined(_LIBCPP_HAS_NO_C8RTOMB_MBRTOC8)
using std::mbrtoc8 _LIBCPP_USING_IF_EXISTS;
using std::c8rtomb _LIBCPP_USING_IF_EXISTS;
#endif
diff --git a/libcxx/modules/std/cwchar.cppm b/libcxx/modules/std/cwchar.inc
index 9be68a8..6818c46 100644
--- a/libcxx/modules/std/cwchar.cppm
+++ b/libcxx/modules/std/cwchar.inc
@@ -7,15 +7,8 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <__config>
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-# include <cwchar>
-#endif
-
-export module std:cwchar;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
export namespace std {
+#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using std::mbstate_t;
using std::size_t;
using std::wint_t;
@@ -83,6 +76,5 @@ export namespace std {
using std::mbsrtowcs;
using std::wcrtomb;
using std::wcsrtombs;
-
-} // namespace std
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+} // namespace std
diff --git a/libcxx/modules/std/cwctype.cppm b/libcxx/modules/std/cwctype.inc
index aae5e8d..70e6cf3 100644
--- a/libcxx/modules/std/cwctype.cppm
+++ b/libcxx/modules/std/cwctype.inc
@@ -7,15 +7,8 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <__config>
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
-# include <cwctype>
-#endif
-
-export module std:cwctype;
-#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
export namespace std {
+#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using std::wctrans_t;
using std::wctype_t;
using std::wint_t;
@@ -38,5 +31,5 @@ export namespace std {
using std::towupper;
using std::wctrans;
using std::wctype;
-} // namespace std
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+} // namespace std
diff --git a/libcxx/modules/std/deque.cppm b/libcxx/modules/std/deque.inc
index ec98048..5abf888 100644
--- a/libcxx/modules/std/deque.cppm
+++ b/libcxx/modules/std/deque.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <deque>
-
-export module std:deque;
export namespace std {
// [deque], class template deque
using std::deque;
diff --git a/libcxx/modules/std/exception.cppm b/libcxx/modules/std/exception.inc
index 9e5a067..8e802c7 100644
--- a/libcxx/modules/std/exception.cppm
+++ b/libcxx/modules/std/exception.inc
@@ -7,9 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <exception>
-export module std:exception;
export namespace std {
using std::bad_exception;
using std::current_exception;
diff --git a/libcxx/modules/std/execution.cppm b/libcxx/modules/std/execution.inc
index e0996f3..b0a3b17 100644
--- a/libcxx/modules/std/execution.cppm
+++ b/libcxx/modules/std/execution.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <execution>
-
-export module std:execution;
export namespace std {
// [execpol.type], execution policy type trait
using std::is_execution_policy;
diff --git a/libcxx/modules/std/expected.cppm b/libcxx/modules/std/expected.inc
index abf7fca..1595230 100644
--- a/libcxx/modules/std/expected.cppm
+++ b/libcxx/modules/std/expected.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <expected>
-
-export module std:expected;
export namespace std {
// [expected.unexpected], class template unexpected
using std::unexpected;
diff --git a/libcxx/modules/std/filesystem.cppm b/libcxx/modules/std/filesystem.inc
index c6dac36..565705c 100644
--- a/libcxx/modules/std/filesystem.cppm
+++ b/libcxx/modules/std/filesystem.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <filesystem>
-
-export module std:filesystem;
export namespace std::filesystem {
// [fs.class.path], paths
using std::filesystem::path;
diff --git a/libcxx/modules/std/flat_map.cppm b/libcxx/modules/std/flat_map.inc
index ff26fe4..83cd20a 100644
--- a/libcxx/modules/std/flat_map.cppm
+++ b/libcxx/modules/std/flat_map.inc
@@ -7,13 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#if __has_include(<flat_map>)
-# error "include this header unconditionally and uncomment the exported symbols"
-# include <flat_map>
-#endif
-
-export module std:flat_map;
export namespace std {
#if 0
// [flat.map], class template flat_­map
diff --git a/libcxx/modules/std/flat_set.cppm b/libcxx/modules/std/flat_set.inc
index b40d158..a86cc1e 100644
--- a/libcxx/modules/std/flat_set.cppm
+++ b/libcxx/modules/std/flat_set.inc
@@ -7,13 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#if __has_include(<flat_set>)
-# error "include this header unconditionally and uncomment the exported symbols"
-# include <flat_set>
-#endif
-
-export module std:flat_set;
export namespace std {
#if 0
// [flat.set], class template flat_­set
diff --git a/libcxx/modules/std/format.cppm b/libcxx/modules/std/format.inc
index cb8b461..ae7de95 100644
--- a/libcxx/modules/std/format.cppm
+++ b/libcxx/modules/std/format.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <format>
-
-export module std:format;
export namespace std {
// [format.context], class template basic_format_context
using std::basic_format_context;
diff --git a/libcxx/modules/std/forward_list.cppm b/libcxx/modules/std/forward_list.inc
index 1ef8be9..c9585b5 100644
--- a/libcxx/modules/std/forward_list.cppm
+++ b/libcxx/modules/std/forward_list.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <forward_list>
-
-export module std:forward_list;
export namespace std {
// [forward.list], class template forward_list
using std::forward_list;
diff --git a/libcxx/modules/std/fstream.cppm b/libcxx/modules/std/fstream.inc
index 11bdcfb..4b6abf6 100644
--- a/libcxx/modules/std/fstream.cppm
+++ b/libcxx/modules/std/fstream.inc
@@ -7,15 +7,8 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <__config>
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-# include <fstream>
-#endif
-
-export module std:fstream;
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
export namespace std {
+#ifndef _LIBCPP_HAS_NO_LOCALIZATION
using std::basic_filebuf;
using std::swap;
@@ -45,5 +38,5 @@ export namespace std {
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using std::wfstream;
# endif
-} // namespace std
#endif // _LIBCPP_HAS_NO_LOCALIZATION
+} // namespace std
diff --git a/libcxx/modules/std/functional.cppm b/libcxx/modules/std/functional.inc
index 9760933..f8a29e2 100644
--- a/libcxx/modules/std/functional.cppm
+++ b/libcxx/modules/std/functional.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <functional>
-
-export module std:functional;
export namespace std {
// [func.invoke], invoke
using std::invoke;
diff --git a/libcxx/modules/std/future.cppm b/libcxx/modules/std/future.inc
index 69f9eb5..8ff034d 100644
--- a/libcxx/modules/std/future.cppm
+++ b/libcxx/modules/std/future.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <future>
-
-export module std:future;
export namespace std {
using std::future_errc;
using std::future_status;
diff --git a/libcxx/modules/std/generator.cppm b/libcxx/modules/std/generator.cppm
deleted file mode 100644
index c67f5d0..0000000
--- a/libcxx/modules/std/generator.cppm
+++ /dev/null
@@ -1,21 +0,0 @@
-// -*- 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
-//
-//===----------------------------------------------------------------------===//
-
-module;
-#if __has_include(<generator>)
-# error "include this header unconditionally and uncomment the exported symbols"
-# include <generator>
-#endif
-
-export module std:generator;
-export namespace std {
-#if 0
- using std::generator;
-#endif
-} // namespace std
diff --git a/libcxx/modules/std/generator.inc b/libcxx/modules/std/generator.inc
new file mode 100644
index 0000000..43fb0da
--- /dev/null
+++ b/libcxx/modules/std/generator.inc
@@ -0,0 +1,14 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+export namespace std {
+#if 0
+ using std::generator;
+#endif
+} // namespace std
diff --git a/libcxx/modules/std/hazard_pointer.cppm b/libcxx/modules/std/hazard_pointer.inc
index 84b83f5..e56f4d0 100644
--- a/libcxx/modules/std/hazard_pointer.cppm
+++ b/libcxx/modules/std/hazard_pointer.inc
@@ -7,13 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#if __has_include(<hazard_pointer>)
-# error "include this header unconditionally and uncomment the exported symbols"
-# include <hazard_pointer>
-#endif
-
-export module std:hazard_pointer;
export namespace std {
#if 0
# if _LIBCPP_STD_VER >= 23
diff --git a/libcxx/modules/std/initializer_list.cppm b/libcxx/modules/std/initializer_list.inc
index 8e041f7..1dbeb22 100644
--- a/libcxx/modules/std/initializer_list.cppm
+++ b/libcxx/modules/std/initializer_list.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <initializer_list>
-
-export module std:initializer_list;
export namespace std {
using std::initializer_list;
diff --git a/libcxx/modules/std/iomanip.cppm b/libcxx/modules/std/iomanip.inc
index 5f795c0..35a52ef 100644
--- a/libcxx/modules/std/iomanip.cppm
+++ b/libcxx/modules/std/iomanip.inc
@@ -7,15 +7,8 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <__config>
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-# include <iomanip>
-#endif
-
-export module std:iomanip;
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
export namespace std {
+#ifndef _LIBCPP_HAS_NO_LOCALIZATION
using std::get_money;
using std::get_time;
using std::put_money;
@@ -28,5 +21,5 @@ export namespace std {
using std::setw;
using std::quoted;
-} // namespace std
#endif // _LIBCPP_HAS_NO_LOCALIZATION
+} // namespace std
diff --git a/libcxx/modules/std/ios.cppm b/libcxx/modules/std/ios.inc
index 5dc7eb41..eeed539 100644
--- a/libcxx/modules/std/ios.cppm
+++ b/libcxx/modules/std/ios.inc
@@ -7,15 +7,8 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <__config>
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-# include <ios>
-#endif
-
-export module std:ios;
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
export namespace std {
+#ifndef _LIBCPP_HAS_NO_LOCALIZATION
using std::fpos;
// based on [tab:fpos.operations]
using std::operator!=; // Note not affected by P1614, seems like a bug.
@@ -79,5 +72,5 @@ export namespace std {
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using std::wios;
# endif
-} // namespace std
#endif // _LIBCPP_HAS_NO_LOCALIZATION
+} // namespace std
diff --git a/libcxx/modules/std/iosfwd.cppm b/libcxx/modules/std/iosfwd.inc
index 3ba00d5..aba7f1e 100644
--- a/libcxx/modules/std/iosfwd.cppm
+++ b/libcxx/modules/std/iosfwd.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <iosfwd>
-
-export module std:iosfwd;
export namespace std {
using std::streampos;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
diff --git a/libcxx/modules/std/iostream.cppm b/libcxx/modules/std/iostream.inc
index 3b80f83..d6e2036 100644
--- a/libcxx/modules/std/iostream.cppm
+++ b/libcxx/modules/std/iostream.inc
@@ -7,15 +7,8 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <__config>
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-# include <iostream>
-#endif
-
-export module std:iostream;
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
export namespace std {
+#ifndef _LIBCPP_HAS_NO_LOCALIZATION
using std::cerr;
using std::cin;
using std::clog;
@@ -27,5 +20,5 @@ export namespace std {
using std::wclog;
using std::wcout;
# endif
-} // namespace std
#endif // _LIBCPP_HAS_NO_LOCALIZATION
+} // namespace std
diff --git a/libcxx/modules/std/istream.cppm b/libcxx/modules/std/istream.inc
index ad18977..fdb1854 100644
--- a/libcxx/modules/std/istream.cppm
+++ b/libcxx/modules/std/istream.inc
@@ -7,15 +7,8 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <__config>
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-# include <istream>
-#endif
-
-export module std:istream;
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
export namespace std {
+#ifndef _LIBCPP_HAS_NO_LOCALIZATION
using std::basic_istream;
using std::istream;
@@ -33,5 +26,5 @@ export namespace std {
using std::ws;
using std::operator>>;
-} // namespace std
#endif // _LIBCPP_HAS_NO_LOCALIZATION
+} // namespace std
diff --git a/libcxx/modules/std/iterator.cppm b/libcxx/modules/std/iterator.inc
index 65fa3631..10c63d7 100644
--- a/libcxx/modules/std/iterator.cppm
+++ b/libcxx/modules/std/iterator.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <iterator>
-
-export module std:iterator;
export namespace std {
// [iterator.assoc.types], associated types
// [incrementable.traits], incrementable traits
diff --git a/libcxx/modules/std/latch.cppm b/libcxx/modules/std/latch.inc
index dfafd79..5afb8ff 100644
--- a/libcxx/modules/std/latch.cppm
+++ b/libcxx/modules/std/latch.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <latch>
-
-export module std:latch;
export namespace std {
using std::latch;
} // namespace std
diff --git a/libcxx/modules/std/limits.cppm b/libcxx/modules/std/limits.inc
index 54ddccd..9aae993 100644
--- a/libcxx/modules/std/limits.cppm
+++ b/libcxx/modules/std/limits.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <limits>
-
-export module std:limits;
export namespace std {
// [fp.style], floating-point type properties
using std::float_denorm_style;
diff --git a/libcxx/modules/std/list.cppm b/libcxx/modules/std/list.inc
index eff83c9..f38094c 100644
--- a/libcxx/modules/std/list.cppm
+++ b/libcxx/modules/std/list.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <list>
-
-export module std:list;
export namespace std {
// [list], class template list
using std::list;
diff --git a/libcxx/modules/std/locale.cppm b/libcxx/modules/std/locale.inc
index d983fd1..8e0018f 100644
--- a/libcxx/modules/std/locale.cppm
+++ b/libcxx/modules/std/locale.inc
@@ -7,14 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <__config>
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-# include <locale>
-#endif
-
-export module std:locale;
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
export namespace std {
// [locale], locale
using std::has_facet;
@@ -80,4 +72,3 @@ export namespace std {
// [depr.conversions.string]
using std::wstring_convert;
} // namespace std
-#endif // _LIBCPP_HAS_NO_LOCALIZATION
diff --git a/libcxx/modules/std/map.cppm b/libcxx/modules/std/map.inc
index 31353d1..ed154e3 100644
--- a/libcxx/modules/std/map.cppm
+++ b/libcxx/modules/std/map.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <map>
-
-export module std:map;
export namespace std {
// [map], class template map
using std::map;
diff --git a/libcxx/modules/std/mdspan.cppm b/libcxx/modules/std/mdspan.inc
index d92024d..37580ea 100644
--- a/libcxx/modules/std/mdspan.cppm
+++ b/libcxx/modules/std/mdspan.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <mdspan>
-
-export module std:mdspan;
export namespace std {
// [mdspan.extents], class template extents
using std::extents;
diff --git a/libcxx/modules/std/memory.cppm b/libcxx/modules/std/memory.inc
index 46a88cb..06af546 100644
--- a/libcxx/modules/std/memory.cppm
+++ b/libcxx/modules/std/memory.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <memory>
-
-export module std:memory;
export namespace std {
// [pointer.traits], pointer traits
using std::pointer_traits;
diff --git a/libcxx/modules/std/memory_resource.cppm b/libcxx/modules/std/memory_resource.inc
index 3c0be56..740179b 100644
--- a/libcxx/modules/std/memory_resource.cppm
+++ b/libcxx/modules/std/memory_resource.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <memory_resource>
-
-export module std:memory_resource;
export namespace std::pmr {
// [mem.res.class], class memory_resource
using std::pmr::memory_resource;
diff --git a/libcxx/modules/std/mutex.cppm b/libcxx/modules/std/mutex.inc
index fcd087c..fa55324 100644
--- a/libcxx/modules/std/mutex.cppm
+++ b/libcxx/modules/std/mutex.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <mutex>
-
-export module std:mutex;
export namespace std {
// [thread.mutex.class], class mutex
using std::mutex;
diff --git a/libcxx/modules/std/new.cppm b/libcxx/modules/std/new.inc
index bc8eb70..31c4905 100644
--- a/libcxx/modules/std/new.cppm
+++ b/libcxx/modules/std/new.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <new>
-
-export module std:__new; // Note new is a keyword and not a valid identifier
export namespace std {
// [alloc.errors], storage allocation errors
using std::bad_alloc;
diff --git a/libcxx/modules/std/numbers.cppm b/libcxx/modules/std/numbers.inc
index 6b9a62a..2f55f44 100644
--- a/libcxx/modules/std/numbers.cppm
+++ b/libcxx/modules/std/numbers.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <numbers>
-
-export module std:numbers;
export namespace std::numbers {
using std::numbers::e_v;
using std::numbers::egamma_v;
diff --git a/libcxx/modules/std/numeric.cppm b/libcxx/modules/std/numeric.inc
index a8c513e..d2b7688 100644
--- a/libcxx/modules/std/numeric.cppm
+++ b/libcxx/modules/std/numeric.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <numeric>
-
-export module std:numeric;
export namespace std {
// [accumulate], accumulate
using std::accumulate;
diff --git a/libcxx/modules/std/optional.cppm b/libcxx/modules/std/optional.inc
index 4ebc503..0f812bc 100644
--- a/libcxx/modules/std/optional.cppm
+++ b/libcxx/modules/std/optional.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <optional>
-
-export module std:optional;
export namespace std {
// [optional.optional], class template optional
using std::optional;
diff --git a/libcxx/modules/std/ostream.cppm b/libcxx/modules/std/ostream.inc
index 0b15048..e898978 100644
--- a/libcxx/modules/std/ostream.cppm
+++ b/libcxx/modules/std/ostream.inc
@@ -7,15 +7,8 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <__config>
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-# include <ostream>
-#endif
-
-export module std:ostream;
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
export namespace std {
+#ifndef _LIBCPP_HAS_NO_LOCALIZATION
using std::basic_ostream;
using std::ostream;
@@ -42,5 +35,5 @@ export namespace std {
using std::vprint_nonunicode;
using std::vprint_unicode;
# endif
-} // namespace std
#endif // _LIBCPP_HAS_NO_LOCALIZATION
+} // namespace std
diff --git a/libcxx/modules/std/print.cppm b/libcxx/modules/std/print.inc
index 9d089a6..32304d2 100644
--- a/libcxx/modules/std/print.cppm
+++ b/libcxx/modules/std/print.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <print>
-
-export module std:print;
export namespace std {
// [print.fun], print functions
using std::print;
diff --git a/libcxx/modules/std/queue.cppm b/libcxx/modules/std/queue.inc
index 8632ee2..d2fb187 100644
--- a/libcxx/modules/std/queue.cppm
+++ b/libcxx/modules/std/queue.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <queue>
-
-export module std:queue;
export namespace std {
// [queue], class template queue
using std::queue;
diff --git a/libcxx/modules/std/random.cppm b/libcxx/modules/std/random.inc
index 43137b7..87758fa 100644
--- a/libcxx/modules/std/random.cppm
+++ b/libcxx/modules/std/random.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <random>
-
-export module std:random;
export namespace std {
// [rand.req.urng], uniform random bit generator requirements
using std::uniform_random_bit_generator;
diff --git a/libcxx/modules/std/ranges.cppm b/libcxx/modules/std/ranges.inc
index cf4c252..a6b1bf5 100644
--- a/libcxx/modules/std/ranges.cppm
+++ b/libcxx/modules/std/ranges.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <ranges>
-
-export module std:ranges;
export namespace std {
namespace ranges {
inline namespace __cpo {
diff --git a/libcxx/modules/std/ratio.cppm b/libcxx/modules/std/ratio.inc
index 410b9cf..4e1d4c6 100644
--- a/libcxx/modules/std/ratio.cppm
+++ b/libcxx/modules/std/ratio.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <ratio>
-
-export module std:ratio;
export namespace std {
// [ratio.ratio], class template ratio
using std::ratio;
diff --git a/libcxx/modules/std/rcu.cppm b/libcxx/modules/std/rcu.inc
index fb5e5e1..abf5afa 100644
--- a/libcxx/modules/std/rcu.cppm
+++ b/libcxx/modules/std/rcu.inc
@@ -7,13 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#if __has_include(<rcu>)
-# error "include this header unconditionally and uncomment the exported symbols"
-# include <rcu>
-#endif
-
-export module std:rcu;
export namespace std {
#if 0
# if _LIBCPP_STD_VER >= 23
diff --git a/libcxx/modules/std/regex.cppm b/libcxx/modules/std/regex.inc
index 7c23e63..8217e34 100644
--- a/libcxx/modules/std/regex.cppm
+++ b/libcxx/modules/std/regex.inc
@@ -7,15 +7,8 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <__config>
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-# include <regex>
-#endif
-
-export module std:regex;
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
export namespace std {
+#ifndef _LIBCPP_HAS_NO_LOCALIZATION
// [re.const], regex constants
namespace regex_constants {
using std::regex_constants::error_type;
@@ -119,6 +112,6 @@ export namespace std {
using std::pmr::wcmatch;
using std::pmr::wsmatch;
# endif
- } // namespace pmr
-} // namespace std
+ } // namespace pmr
#endif // _LIBCPP_HAS_NO_LOCALIZATION
+} // namespace std
diff --git a/libcxx/modules/std/scoped_allocator.cppm b/libcxx/modules/std/scoped_allocator.inc
index f198db9..91c9694 100644
--- a/libcxx/modules/std/scoped_allocator.cppm
+++ b/libcxx/modules/std/scoped_allocator.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <scoped_allocator>
-
-export module std:scoped_allocator;
export namespace std {
// class template scoped_allocator_adaptor
using std::scoped_allocator_adaptor;
diff --git a/libcxx/modules/std/semaphore.cppm b/libcxx/modules/std/semaphore.inc
index 7b81460..bc8d905 100644
--- a/libcxx/modules/std/semaphore.cppm
+++ b/libcxx/modules/std/semaphore.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <semaphore>
-
-export module std:semaphore;
export namespace std {
// [thread.sema.cnt], class template counting_semaphore
using std::counting_semaphore;
diff --git a/libcxx/modules/std/set.cppm b/libcxx/modules/std/set.inc
index 19a2734..a8db792 100644
--- a/libcxx/modules/std/set.cppm
+++ b/libcxx/modules/std/set.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <set>
-
-export module std:set;
export namespace std {
// [set], class template set
using std::set;
diff --git a/libcxx/modules/std/shared_mutex.cppm b/libcxx/modules/std/shared_mutex.inc
index 36c0f18..2b0782e 100644
--- a/libcxx/modules/std/shared_mutex.cppm
+++ b/libcxx/modules/std/shared_mutex.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <shared_mutex>
-
-export module std:shared_mutex;
export namespace std {
// [thread.sharedmutex.class], class shared_­mutex
using std::shared_mutex;
diff --git a/libcxx/modules/std/source_location.cppm b/libcxx/modules/std/source_location.inc
index 0f6aee5..750ab16 100644
--- a/libcxx/modules/std/source_location.cppm
+++ b/libcxx/modules/std/source_location.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <source_location>
-
-export module std:source_location;
export namespace std {
using std::source_location;
} // namespace std
diff --git a/libcxx/modules/std/span.cppm b/libcxx/modules/std/span.inc
index 98bd270..184591c 100644
--- a/libcxx/modules/std/span.cppm
+++ b/libcxx/modules/std/span.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <span>
-
-export module std:span;
export namespace std {
// constants
using std::dynamic_extent;
diff --git a/libcxx/modules/std/spanstream.cppm b/libcxx/modules/std/spanstream.inc
index 6106add..e6383a1 100644
--- a/libcxx/modules/std/spanstream.cppm
+++ b/libcxx/modules/std/spanstream.inc
@@ -7,13 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#if __has_include(<spanstream>)
-# error "include this header unconditionally and uncomment the exported symbols"
-# include <spanstream>
-#endif
-
-export module std:spanstream;
export namespace std {
#if 0
using std::basic_spanbuf;
diff --git a/libcxx/modules/std/sstream.cppm b/libcxx/modules/std/sstream.inc
index 1dacb63..2218001 100644
--- a/libcxx/modules/std/sstream.cppm
+++ b/libcxx/modules/std/sstream.inc
@@ -7,15 +7,8 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <__config>
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-# include <sstream>
-#endif
-
-export module std:sstream;
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
export namespace std {
+#ifndef _LIBCPP_HAS_NO_LOCALIZATION
using std::basic_stringbuf;
using std::swap;
@@ -45,5 +38,5 @@ export namespace std {
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using std::wstringstream;
# endif
-} // namespace std
#endif // _LIBCPP_HAS_NO_LOCALIZATION
+} // namespace std
diff --git a/libcxx/modules/std/stack.cppm b/libcxx/modules/std/stack.inc
index 91cec2d..3f736ff 100644
--- a/libcxx/modules/std/stack.cppm
+++ b/libcxx/modules/std/stack.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <stack>
-
-export module std:stack;
export namespace std {
// [stack], class template stack
using std::stack;
diff --git a/libcxx/modules/std/stacktrace.cppm b/libcxx/modules/std/stacktrace.inc
index c7db9c2..c118408 100644
--- a/libcxx/modules/std/stacktrace.cppm
+++ b/libcxx/modules/std/stacktrace.inc
@@ -7,13 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#if __has_include(<stacktrace>)
-# error "include this header unconditionally and uncomment the exported symbols"
-# include <stacktrace>
-#endif
-
-export module std:stacktrace;
export namespace std {
#if 0
// [stacktrace.entry], class stacktrace_­entry
diff --git a/libcxx/modules/std/stdexcept.cppm b/libcxx/modules/std/stdexcept.inc
index 686b8a7..15d37ba 100644
--- a/libcxx/modules/std/stdexcept.cppm
+++ b/libcxx/modules/std/stdexcept.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <stdexcept>
-
-export module std:stdexcept;
export namespace std {
using std::domain_error;
using std::invalid_argument;
diff --git a/libcxx/modules/std/stdfloat.cppm b/libcxx/modules/std/stdfloat.inc
index 740fd475..7e7201a 100644
--- a/libcxx/modules/std/stdfloat.cppm
+++ b/libcxx/modules/std/stdfloat.inc
@@ -7,13 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#if __has_include(<stdfloat>)
-# error "include this header unconditionally"
-# include <stdfloat>
-#endif
-
-export module std:stdfloat;
export namespace std {
#if defined(__STDCPP_FLOAT16_T__)
using std::float16_t;
diff --git a/libcxx/modules/std/stop_token.cppm b/libcxx/modules/std/stop_token.inc
index 80a5755..80b53e9 100644
--- a/libcxx/modules/std/stop_token.cppm
+++ b/libcxx/modules/std/stop_token.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <stop_token>
-
-export module std:stop_token;
export namespace std {
// [stoptoken], class stop_­token
using std::stop_token;
diff --git a/libcxx/modules/std/streambuf.cppm b/libcxx/modules/std/streambuf.inc
index 7b3d989..32914cf 100644
--- a/libcxx/modules/std/streambuf.cppm
+++ b/libcxx/modules/std/streambuf.inc
@@ -7,19 +7,12 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <__config>
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-# include <streambuf>
-#endif
-
-export module std:streambuf;
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
export namespace std {
+#ifndef _LIBCPP_HAS_NO_LOCALIZATION
using std::basic_streambuf;
using std::streambuf;
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using std::wstreambuf;
# endif
-} // namespace std
#endif // _LIBCPP_HAS_NO_LOCALIZATION
+} // namespace std
diff --git a/libcxx/modules/std/string.cppm b/libcxx/modules/std/string.inc
index 9696d58c..76b384c 100644
--- a/libcxx/modules/std/string.cppm
+++ b/libcxx/modules/std/string.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <string>
-
-export module std:string;
export namespace std {
// [char.traits], character traits
using std::char_traits;
diff --git a/libcxx/modules/std/string_view.cppm b/libcxx/modules/std/string_view.inc
index ac90006..1fa63a7 100644
--- a/libcxx/modules/std/string_view.cppm
+++ b/libcxx/modules/std/string_view.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <string_view>
-
-export module std:string_view;
export namespace std {
// [string.view.template], class template basic_string_view
using std::basic_string_view;
diff --git a/libcxx/modules/std/strstream.cppm b/libcxx/modules/std/strstream.inc
index 0f4fe7f..a33c514 100644
--- a/libcxx/modules/std/strstream.cppm
+++ b/libcxx/modules/std/strstream.inc
@@ -7,18 +7,11 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <__config>
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
-# include <strstream>
-#endif
-
-export module std:strstream;
-#ifndef _LIBCPP_HAS_NO_LOCALIZATION
export namespace std {
+#ifndef _LIBCPP_HAS_NO_LOCALIZATION
using std::istrstream;
using std::ostrstream;
using std::strstream;
using std::strstreambuf;
-} // namespace std
#endif // _LIBCPP_HAS_NO_LOCALIZATION
+} // namespace std
diff --git a/libcxx/modules/std/syncstream.cppm b/libcxx/modules/std/syncstream.inc
index 310f279..df9b679 100644
--- a/libcxx/modules/std/syncstream.cppm
+++ b/libcxx/modules/std/syncstream.inc
@@ -7,13 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#if __has_include(<syncstream>)
-# error "include this header unconditionally and uncomment the exported symbols"
-# include <syncstream>
-#endif
-
-export module std:syncstream;
export namespace std {
#if 0
using std::basic_syncbuf;
diff --git a/libcxx/modules/std/system_error.cppm b/libcxx/modules/std/system_error.inc
index 71c1dca..cf553a5 100644
--- a/libcxx/modules/std/system_error.cppm
+++ b/libcxx/modules/std/system_error.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <system_error>
-
-export module std:system_error;
export namespace std {
using std::error_category;
using std::generic_category;
diff --git a/libcxx/modules/std/text_encoding.cppm b/libcxx/modules/std/text_encoding.cppm
deleted file mode 100644
index dcbaa73..0000000
--- a/libcxx/modules/std/text_encoding.cppm
+++ /dev/null
@@ -1,26 +0,0 @@
-// -*- 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
-//
-//===----------------------------------------------------------------------===//
-
-module;
-#if __has_include(<text_encoding>)
-# error "include this header unconditionally and uncomment the exported symbols"
-# include <text_encoding>
-#endif
-
-export module std:text_encoding;
-export namespace std {
-#if 0
-# if _LIBCPP_STD_VER >= 23
- using std::text_encoding;
-
- // hash support
- using std::hash;
-# endif // _LIBCPP_STD_VER >= 23
-#endif
-} // namespace std
diff --git a/libcxx/modules/std/text_encoding.inc b/libcxx/modules/std/text_encoding.inc
new file mode 100644
index 0000000..6d5e3f1
--- /dev/null
+++ b/libcxx/modules/std/text_encoding.inc
@@ -0,0 +1,19 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+export namespace std {
+#if 0
+# if _LIBCPP_STD_VER >= 23
+ using std::text_encoding;
+
+ // hash support
+ using std::hash;
+# endif // _LIBCPP_STD_VER >= 23
+#endif
+} // namespace std
diff --git a/libcxx/modules/std/thread.cppm b/libcxx/modules/std/thread.inc
index 1bfffa2..aa4a7db 100644
--- a/libcxx/modules/std/thread.cppm
+++ b/libcxx/modules/std/thread.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <thread>
-
-export module std:thread;
export namespace std {
// [thread.thread.class], class thread
using std::thread;
diff --git a/libcxx/modules/std/tuple.cppm b/libcxx/modules/std/tuple.inc
index 6c7dc5c..9a8fb72c 100644
--- a/libcxx/modules/std/tuple.cppm
+++ b/libcxx/modules/std/tuple.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <tuple>
-
-export module std:tuple;
export namespace std {
// [tuple.tuple], class template tuple
using std::tuple;
diff --git a/libcxx/modules/std/type_traits.cppm b/libcxx/modules/std/type_traits.inc
index aca0aa9..f0ec4cb 100644
--- a/libcxx/modules/std/type_traits.cppm
+++ b/libcxx/modules/std/type_traits.inc
@@ -7,9 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <type_traits>
-export module std:type_traits;
export namespace std {
// [meta.help], helper class
using std::integral_constant;
diff --git a/libcxx/modules/std/typeindex.cppm b/libcxx/modules/std/typeindex.inc
index 386ed6b..0fdcd8f 100644
--- a/libcxx/modules/std/typeindex.cppm
+++ b/libcxx/modules/std/typeindex.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <typeindex>
-
-export module std:typeindex;
export namespace std {
using std::hash;
using std::type_index;
diff --git a/libcxx/modules/std/typeinfo.cppm b/libcxx/modules/std/typeinfo.inc
index 39e6257..ee1273b 100644
--- a/libcxx/modules/std/typeinfo.cppm
+++ b/libcxx/modules/std/typeinfo.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <typeinfo>
-
-export module std:typeinfo;
export namespace std {
using std::bad_cast;
using std::bad_typeid;
diff --git a/libcxx/modules/std/unordered_map.cppm b/libcxx/modules/std/unordered_map.inc
index 4469e0d..eff62f3 100644
--- a/libcxx/modules/std/unordered_map.cppm
+++ b/libcxx/modules/std/unordered_map.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <unordered_map>
-
-export module std:unordered_map;
export namespace std {
// [unord.map], class template unordered_­map
using std::unordered_map;
diff --git a/libcxx/modules/std/unordered_set.cppm b/libcxx/modules/std/unordered_set.inc
index f3329fc..c214e34 100644
--- a/libcxx/modules/std/unordered_set.cppm
+++ b/libcxx/modules/std/unordered_set.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <unordered_set>
-
-export module std:unordered_set;
export namespace std {
// [unord.set], class template unordered_­set
using std::unordered_set;
diff --git a/libcxx/modules/std/utility.cppm b/libcxx/modules/std/utility.inc
index b6aa2ae..c8e4dc3 100644
--- a/libcxx/modules/std/utility.cppm
+++ b/libcxx/modules/std/utility.inc
@@ -7,9 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <utility>
-export module std:utility;
export namespace std {
// [utility.swap], swap
using std::swap;
diff --git a/libcxx/modules/std/valarray.cppm b/libcxx/modules/std/valarray.inc
index 39c5e95..1cdf7f1 100644
--- a/libcxx/modules/std/valarray.cppm
+++ b/libcxx/modules/std/valarray.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <valarray>
-
-export module std:valarray;
export namespace std {
using std::gslice;
using std::gslice_array;
diff --git a/libcxx/modules/std/variant.cppm b/libcxx/modules/std/variant.inc
index 7e96ba3..6fcecdd 100644
--- a/libcxx/modules/std/variant.cppm
+++ b/libcxx/modules/std/variant.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <variant>
-
-export module std:variant;
export namespace std {
// [variant.variant], class template variant
using std::variant;
diff --git a/libcxx/modules/std/vector.cppm b/libcxx/modules/std/vector.inc
index 9ebe2d4..a9ce764 100644
--- a/libcxx/modules/std/vector.cppm
+++ b/libcxx/modules/std/vector.inc
@@ -7,11 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <functional>
-#include <vector>
-
-export module std:vector;
export namespace std {
// [vector], class template vector
using std::vector;
diff --git a/libcxx/modules/std/version.cppm b/libcxx/modules/std/version.cppm
deleted file mode 100644
index c2e8f09..0000000
--- a/libcxx/modules/std/version.cppm
+++ /dev/null
@@ -1,16 +0,0 @@
-// -*- 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
-//
-//===----------------------------------------------------------------------===//
-
-module;
-#include <version>
-
-export module std:version;
-export namespace std {
- // This module exports nothing.
-} // namespace std
diff --git a/libcxx/modules/std/version.inc b/libcxx/modules/std/version.inc
new file mode 100644
index 0000000..2ab8eb9
--- /dev/null
+++ b/libcxx/modules/std/version.inc
@@ -0,0 +1,12 @@
+// -*- 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
+//
+//===----------------------------------------------------------------------===//
+
+export namespace std {
+ // This module exports nothing.
+} // namespace std
diff --git a/libcxx/test/libcxx/module_std.gen.py b/libcxx/test/libcxx/module_std.gen.py
index 534da53..17f671e 100644
--- a/libcxx/test/libcxx/module_std.gen.py
+++ b/libcxx/test/libcxx/module_std.gen.py
@@ -119,6 +119,9 @@ ExtraHeader["ranges"] = "v1/__fwd/subrange.h$"
# same definition.
ExtraHeader["functional"] = "v1/__compare/compare_three_way.h$"
+# newline needs to be escaped for the module partition output.
+nl = '\\\\n'
+
# Create empty file with all parts.
print(
f"""\
@@ -140,14 +143,30 @@ for header in toplevel_headers:
if header.endswith(".h"): # Skip C compatibility headers
continue
+ # Generate a module partition for the header module includes. This
+ # makes it possible to verify that all headers export all their
+ # named declarations.
+ #
+ # TODO MODULES This needs to take the header restrictions into account.
+ print(
+ f"// RUN{BLOCKLIT}: echo -e \""
+ f"module;{nl}"
+ f"#include <{header}>{nl}"
+ f"{nl}"
+ f"// Use __libcpp_module_<HEADER> to ensure that modules {nl}"
+ f"// are not named as keywords or reserved names.{nl}"
+ f"export module std:__libcpp_module_{header};{nl}"
+ f'#include \\"%{{module}}/std/{header}.inc\\"{nl}'
+ f"\" > %t.{header}.cppm")
+
# Dump the information as found in the module's cppm file.
print(
- f"// RUN{BLOCKLIT}: %{{clang-tidy}} %{{module}}/std/{header}.cppm "
+ f"// RUN{BLOCKLIT}: %{{clang-tidy}} %t.{header}.cppm "
" --checks='-*,libcpp-header-exportable-declarations' "
" -config='{CheckOptions: [ "
" {"
" key: libcpp-header-exportable-declarations.Filename, "
- f" value: {header}.cppm"
+ f" value: {header}.inc"
" }, {"
" key: libcpp-header-exportable-declarations.FileType, "
" value: ModulePartition"
diff --git a/libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp b/libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp
index f691f4e..281d1ec 100644
--- a/libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp
+++ b/libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp
@@ -222,14 +222,8 @@ void header_exportable_declarations::check(const clang::ast_matchers::MatchFinde
if (is_reserved_name(name))
return;
- // For modules (std, std.compat) only take the declarations exported from the partitions.
- // Making sure no declatations of headers are compared.
- if (file_type_ == FileType::Module)
- if (clang::Module* M = decl->getOwningModule(); M && M->Kind != clang::Module::ModulePartitionInterface)
- return;
-
- // For module partitions only take exported declarations.
- if (file_type_ == FileType::ModulePartition)
+ // For modules only take the declarations exported.
+ if (file_type_ == FileType::ModulePartition || file_type_ == FileType::Module)
if (decl->getModuleOwnershipKind() != clang::Decl::ModuleOwnershipKind::VisibleWhenImported)
return;