[libc++][modules] Removes the module partitions.
This patch is based on the suggestion by @ChuanqiXu on discourse
(https://discourse.llvm.org/t/alternatives-to-the-implementation-of-std-modules/71958)
Instead of making a module partition per header every header gets an inc
file which contains the exports per header. The std module then includes
all public headers and these inc files. The one file per header is
useful for testing purposes. The CI tests whether the exports of a
header's module partition matches the "public" named declarations in the
header. With one file per header this can still be done.
The patch improves compilation time of files using "import std;" and the
size of the std module.
A comparision of the compilation speed using a libc++ test
build/bin/llvm-lit -a -Dstd=c++23 -Denable_modules=std libcxx/test/std/modules/std.pass.cpp
Which boils down to
import std;
int main(int, char**) {
std::println("Hello modular world");
return 0;
}
and has -ftime-report enabled
Before
===-------------------------------------------------------------------------===
Clang front-end time report
===-------------------------------------------------------------------------===
Total Execution Time: 8.6585 seconds (8.6619 wall clock)
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
4.5041 ( 57.2%) 0.4264 ( 54.4%) 4.9305 ( 56.9%) 4.9331 ( 57.0%) Clang front-end timer
3.2037 ( 40.7%) 0.2408 ( 30.7%) 3.4445 ( 39.8%) 3.4452 ( 39.8%) Reading modules
0.1665 ( 2.1%) 0.1170 ( 14.9%) 0.2835 ( 3.3%) 0.2837 ( 3.3%) Loading .../build/test/__config_module__/CMakeFiles/std.dir/std.pcm
7.8744 (100.0%) 0.7842 (100.0%) 8.6585 (100.0%) 8.6619 (100.0%) Total
After
===-------------------------------------------------------------------------===
Clang front-end time report
===-------------------------------------------------------------------------===
Total Execution Time: 1.2420 seconds (1.2423 wall clock)
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
0.8892 ( 84.6%) 0.1698 ( 88.8%) 1.0590 ( 85.3%) 1.0590 ( 85.2%) Clang front-end timer
0.1533 ( 14.6%) 0.0168 ( 8.8%) 0.1701 ( 13.7%) 0.1704 ( 13.7%) Reading modules
0.0082 ( 0.8%) 0.0047 ( 2.5%) 0.0129 ( 1.0%) 0.0129 ( 1.0%) Loading .../build/test/__config_module__/CMakeFiles/std.dir/std.pcm
1.0507 (100.0%) 0.1913 (100.0%) 1.2420 (100.0%) 1.2423 (100.0%) Total
Using "include <print>" instead of "import module;"
===-------------------------------------------------------------------------===
Clang front-end time report
===-------------------------------------------------------------------------===
Total Execution Time: 2.1507 seconds (2.1517 wall clock)
---User Time--- --System Time-- --User+System-- ---Wall Time--- --- Name ---
1.9714 (100.0%) 0.1793 (100.0%) 2.1507 (100.0%) 2.1517 (100.0%) Clang front-end timer
1.9714 (100.0%) 0.1793 (100.0%) 2.1507 (100.0%) 2.1517 (100.0%) Total
It's possible to use the std module in external projects
(https://libcxx.llvm.org/Modules.html#using-in-external-projects)
Tested this with a private project to validate the size of the generated files:
Before
$ du -sch std-*
448M std-build
508K std-src
120K std-subbuild
449M total
After
$ du -sch std-*
29M std-build
1004K std-src
132K std-subbuild
30M total
Reviewed By: ldionne, #libc
Differential Revision: https://reviews.llvm.org/D156907
GitOrigin-RevId: 4d4c70c91c5511f8c051623bcc1a76064d5bf687
diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt
index d24ddb0..572ee2d 100644
--- a/modules/CMakeLists.txt
+++ b/modules/CMakeLists.txt
@@ -5,120 +5,117 @@
# 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 @@
@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/modules/CMakeLists.txt.in b/modules/CMakeLists.txt.in
index 3cf20ae..88272e1 100644
--- a/modules/CMakeLists.txt.in
+++ b/modules/CMakeLists.txt.in
@@ -48,7 +48,7 @@
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/modules/README.md b/modules/README.md
new file mode 100644
index 0000000..23dd606
--- /dev/null
+++ b/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/modules/std.cppm b/modules/std.cppm
deleted file mode 100644
index fcd7d55..0000000
--- a/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/modules/std.cppm.in b/modules/std.cppm.in
new file mode 100644
index 0000000..dd611d5
--- /dev/null
+++ b/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/modules/std/algorithm.cppm b/modules/std/algorithm.inc
similarity index 99%
rename from modules/std/algorithm.cppm
rename to modules/std/algorithm.inc
index 6598c19..bb38f39 100644
--- a/modules/std/algorithm.cppm
+++ b/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/modules/std/any.cppm b/modules/std/any.inc
similarity index 92%
rename from modules/std/any.cppm
rename to modules/std/any.inc
index f44f4da..c57257e 100644
--- a/modules/std/any.cppm
+++ b/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/modules/std/array.cppm b/modules/std/array.inc
similarity index 93%
rename from modules/std/array.cppm
rename to modules/std/array.inc
index d7d0672..d55779c 100644
--- a/modules/std/array.cppm
+++ b/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/modules/std/atomic.cppm b/modules/std/atomic.inc
similarity index 98%
rename from modules/std/atomic.cppm
rename to modules/std/atomic.inc
index faf902b..5139b75 100644
--- a/modules/std/atomic.cppm
+++ b/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/modules/std/barrier.cppm b/modules/std/barrier.inc
similarity index 88%
rename from modules/std/barrier.cppm
rename to modules/std/barrier.inc
index bdecfae..bafd87e 100644
--- a/modules/std/barrier.cppm
+++ b/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/modules/std/bit.cppm b/modules/std/bit.inc
similarity index 94%
rename from modules/std/bit.cppm
rename to modules/std/bit.inc
index 7e22602..2a05a8e 100644
--- a/modules/std/bit.cppm
+++ b/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/modules/std/bitset.cppm b/modules/std/bitset.inc
similarity index 92%
rename from modules/std/bitset.cppm
rename to modules/std/bitset.inc
index 95404c8..bb52886 100644
--- a/modules/std/bitset.cppm
+++ b/modules/std/bitset.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <bitset>
-
-export module std:bitset;
export namespace std {
using std::bitset;
diff --git a/modules/std/cassert.cppm b/modules/std/cassert.cppm
deleted file mode 100644
index 21dcd18..0000000
--- a/modules/std/cassert.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 <cassert>
-
-export module std:cassert;
-export namespace std {
- // This module exports nothing.
-} // namespace std
diff --git a/modules/std/cerrno.cppm b/modules/std/cassert.inc
similarity index 89%
rename from modules/std/cerrno.cppm
rename to modules/std/cassert.inc
index d319956..2ab8eb9 100644
--- a/modules/std/cerrno.cppm
+++ b/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/modules/std/cctype.cppm b/modules/std/cctype.inc
similarity index 92%
rename from modules/std/cctype.cppm
rename to modules/std/cctype.inc
index d91c5c5..075dbbe 100644
--- a/modules/std/cctype.cppm
+++ b/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/modules/std/cerrno.cppm b/modules/std/cerrno.inc
similarity index 89%
copy from modules/std/cerrno.cppm
copy to modules/std/cerrno.inc
index d319956..2ab8eb9 100644
--- a/modules/std/cerrno.cppm
+++ b/modules/std/cerrno.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <cerrno>
-
-export module std:cerrno;
export namespace std {
// This module exports nothing.
} // namespace std
diff --git a/modules/std/cfenv.cppm b/modules/std/cfenv.inc
similarity index 93%
rename from modules/std/cfenv.cppm
rename to modules/std/cfenv.inc
index bb1d314..34a8a7a 100644
--- a/modules/std/cfenv.cppm
+++ b/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/modules/std/cfloat.cppm b/modules/std/cfloat.cppm
deleted file mode 100644
index daf4f55..0000000
--- a/modules/std/cfloat.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 <cfloat>
-
-export module std:cfloat;
-export namespace std {
- // This module exports nothing.
-} // namespace std
diff --git a/modules/std/cerrno.cppm b/modules/std/cfloat.inc
similarity index 89%
copy from modules/std/cerrno.cppm
copy to modules/std/cfloat.inc
index d319956..2ab8eb9 100644
--- a/modules/std/cerrno.cppm
+++ b/modules/std/cfloat.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <cerrno>
-
-export module std:cerrno;
export namespace std {
// This module exports nothing.
} // namespace std
diff --git a/modules/std/charconv.cppm b/modules/std/charconv.inc
similarity index 94%
rename from modules/std/charconv.cppm
rename to modules/std/charconv.inc
index 0faa546..6fee460 100644
--- a/modules/std/charconv.cppm
+++ b/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/modules/std/chrono.cppm b/modules/std/chrono.inc
similarity index 98%
rename from modules/std/chrono.cppm
rename to modules/std/chrono.inc
index dbb2265..8ed0b00 100644
--- a/modules/std/chrono.cppm
+++ b/modules/std/chrono.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <chrono>
-
-export module std:chrono;
export namespace std {
namespace chrono {
diff --git a/modules/std/cinttypes.cppm b/modules/std/cinttypes.inc
similarity index 93%
rename from modules/std/cinttypes.cppm
rename to modules/std/cinttypes.inc
index 8758acc..2e13592 100644
--- a/modules/std/cinttypes.cppm
+++ b/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/modules/std/climits.cppm b/modules/std/climits.cppm
deleted file mode 100644
index 04603b7..0000000
--- a/modules/std/climits.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 <climits>
-
-export module std:climits;
-export namespace std {
- // This module exports nothing.
-} // namespace std
diff --git a/modules/std/cerrno.cppm b/modules/std/climits.inc
similarity index 89%
copy from modules/std/cerrno.cppm
copy to modules/std/climits.inc
index d319956..2ab8eb9 100644
--- a/modules/std/cerrno.cppm
+++ b/modules/std/climits.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <cerrno>
-
-export module std:cerrno;
export namespace std {
// This module exports nothing.
} // namespace std
diff --git a/modules/std/clocale.cppm b/modules/std/clocale.inc
similarity index 82%
rename from modules/std/clocale.cppm
rename to modules/std/clocale.inc
index 57d983c..3efe159 100644
--- a/modules/std/clocale.cppm
+++ b/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/modules/std/cmath.cppm b/modules/std/cmath.inc
similarity index 98%
rename from modules/std/cmath.cppm
rename to modules/std/cmath.inc
index 26f6ed9..0fe8874 100644
--- a/modules/std/cmath.cppm
+++ b/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/modules/std/codecvt.cppm b/modules/std/codecvt.inc
similarity index 83%
rename from modules/std/codecvt.cppm
rename to modules/std/codecvt.inc
index caa24c4..9960368 100644
--- a/modules/std/codecvt.cppm
+++ b/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/modules/std/compare.cppm b/modules/std/compare.inc
similarity index 96%
rename from modules/std/compare.cppm
rename to modules/std/compare.inc
index ebeff41..9d002d3 100644
--- a/modules/std/compare.cppm
+++ b/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/modules/std/complex.cppm b/modules/std/complex.inc
similarity index 96%
rename from modules/std/complex.cppm
rename to modules/std/complex.inc
index b3207db..7a55324 100644
--- a/modules/std/complex.cppm
+++ b/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/modules/std/concepts.cppm b/modules/std/concepts.inc
similarity index 97%
rename from modules/std/concepts.cppm
rename to modules/std/concepts.inc
index 6c3333e..29f4e27 100644
--- a/modules/std/concepts.cppm
+++ b/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/modules/std/condition_variable.cppm b/modules/std/condition_variable.inc
similarity index 90%
rename from modules/std/condition_variable.cppm
rename to modules/std/condition_variable.inc
index 4528c41..95d00f3 100644
--- a/modules/std/condition_variable.cppm
+++ b/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/modules/std/coroutine.cppm b/modules/std/coroutine.inc
similarity index 92%
rename from modules/std/coroutine.cppm
rename to modules/std/coroutine.inc
index 26f141f..5d992f2 100644
--- a/modules/std/coroutine.cppm
+++ b/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/modules/std/csetjmp.cppm b/modules/std/csetjmp.inc
similarity index 89%
rename from modules/std/csetjmp.cppm
rename to modules/std/csetjmp.inc
index ba97c0c..68e226c 100644
--- a/modules/std/csetjmp.cppm
+++ b/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/modules/std/csignal.cppm b/modules/std/csignal.inc
similarity index 90%
rename from modules/std/csignal.cppm
rename to modules/std/csignal.inc
index 90a6c56..b57e8ed 100644
--- a/modules/std/csignal.cppm
+++ b/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/modules/std/cstdarg.cppm b/modules/std/cstdarg.inc
similarity index 88%
rename from modules/std/cstdarg.cppm
rename to modules/std/cstdarg.inc
index 4b971b7..2b7309c 100644
--- a/modules/std/cstdarg.cppm
+++ b/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/modules/std/cstddef.cppm b/modules/std/cstddef.inc
similarity index 93%
rename from modules/std/cstddef.cppm
rename to modules/std/cstddef.inc
index aecee6e..2b9ab0c 100644
--- a/modules/std/cstddef.cppm
+++ b/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/modules/std/cstdint.cppm b/modules/std/cstdint.inc
similarity index 95%
rename from modules/std/cstdint.cppm
rename to modules/std/cstdint.inc
index fdf8713..f6de447 100644
--- a/modules/std/cstdint.cppm
+++ b/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/modules/std/cstdio.cppm b/modules/std/cstdio.inc
similarity index 95%
rename from modules/std/cstdio.cppm
rename to modules/std/cstdio.inc
index b5b94ce..eec8170 100644
--- a/modules/std/cstdio.cppm
+++ b/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/modules/std/cstdlib.cppm b/modules/std/cstdlib.inc
similarity index 96%
rename from modules/std/cstdlib.cppm
rename to modules/std/cstdlib.inc
index 4d1f331..11c7e86 100644
--- a/modules/std/cstdlib.cppm
+++ b/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/modules/std/cstring.cppm b/modules/std/cstring.inc
similarity index 93%
rename from modules/std/cstring.cppm
rename to modules/std/cstring.inc
index 44b3dcf..d21714b 100644
--- a/modules/std/cstring.cppm
+++ b/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/modules/std/ctime.cppm b/modules/std/ctime.inc
similarity index 93%
rename from modules/std/ctime.cppm
rename to modules/std/ctime.inc
index e63bd23..c407ffc 100644
--- a/modules/std/ctime.cppm
+++ b/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/modules/std/cuchar.cppm b/modules/std/cuchar.inc
similarity index 91%
rename from modules/std/cuchar.cppm
rename to modules/std/cuchar.inc
index c3f8c41..fd80110 100644
--- a/modules/std/cuchar.cppm
+++ b/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 @@
// 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/modules/std/cwchar.cppm b/modules/std/cwchar.inc
similarity index 93%
rename from modules/std/cwchar.cppm
rename to modules/std/cwchar.inc
index 9be68a8..6818c46 100644
--- a/modules/std/cwchar.cppm
+++ b/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 @@
using std::mbsrtowcs;
using std::wcrtomb;
using std::wcsrtombs;
-
-} // namespace std
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+} // namespace std
diff --git a/modules/std/cwctype.cppm b/modules/std/cwctype.inc
similarity index 88%
rename from modules/std/cwctype.cppm
rename to modules/std/cwctype.inc
index aae5e8d..70e6cf3 100644
--- a/modules/std/cwctype.cppm
+++ b/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 @@
using std::towupper;
using std::wctrans;
using std::wctype;
-} // namespace std
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
+} // namespace std
diff --git a/modules/std/deque.cppm b/modules/std/deque.inc
similarity index 92%
rename from modules/std/deque.cppm
rename to modules/std/deque.inc
index ec98048..5abf888 100644
--- a/modules/std/deque.cppm
+++ b/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/modules/std/exception.cppm b/modules/std/exception.inc
similarity index 93%
rename from modules/std/exception.cppm
rename to modules/std/exception.inc
index 9e5a067..8e802c7 100644
--- a/modules/std/exception.cppm
+++ b/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/modules/std/execution.cppm b/modules/std/execution.inc
similarity index 94%
rename from modules/std/execution.cppm
rename to modules/std/execution.inc
index e0996f3..b0a3b17 100644
--- a/modules/std/execution.cppm
+++ b/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/modules/std/expected.cppm b/modules/std/expected.inc
similarity index 92%
rename from modules/std/expected.cppm
rename to modules/std/expected.inc
index abf7fca..1595230 100644
--- a/modules/std/expected.cppm
+++ b/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/modules/std/filesystem.cppm b/modules/std/filesystem.inc
similarity index 97%
rename from modules/std/filesystem.cppm
rename to modules/std/filesystem.inc
index c6dac36..565705c 100644
--- a/modules/std/filesystem.cppm
+++ b/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/modules/std/flat_map.cppm b/modules/std/flat_map.inc
similarity index 82%
rename from modules/std/flat_map.cppm
rename to modules/std/flat_map.inc
index ff26fe4..83cd20a 100644
--- a/modules/std/flat_map.cppm
+++ b/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/modules/std/flat_set.cppm b/modules/std/flat_set.inc
similarity index 81%
rename from modules/std/flat_set.cppm
rename to modules/std/flat_set.inc
index b40d158..a86cc1e 100644
--- a/modules/std/flat_set.cppm
+++ b/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/modules/std/format.cppm b/modules/std/format.inc
similarity index 97%
rename from modules/std/format.cppm
rename to modules/std/format.inc
index cb8b461..ae7de95 100644
--- a/modules/std/format.cppm
+++ b/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/modules/std/forward_list.cppm b/modules/std/forward_list.inc
similarity index 91%
rename from modules/std/forward_list.cppm
rename to modules/std/forward_list.inc
index 1ef8be9..c9585b5 100644
--- a/modules/std/forward_list.cppm
+++ b/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/modules/std/fstream.cppm b/modules/std/fstream.inc
similarity index 89%
rename from modules/std/fstream.cppm
rename to modules/std/fstream.inc
index 11bdcfb..4b6abf6 100644
--- a/modules/std/fstream.cppm
+++ b/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 @@
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using std::wfstream;
# endif
-} // namespace std
#endif // _LIBCPP_HAS_NO_LOCALIZATION
+} // namespace std
diff --git a/modules/std/functional.cppm b/modules/std/functional.inc
similarity index 97%
rename from modules/std/functional.cppm
rename to modules/std/functional.inc
index 9760933..f8a29e2 100644
--- a/modules/std/functional.cppm
+++ b/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/modules/std/future.cppm b/modules/std/future.inc
similarity index 95%
rename from modules/std/future.cppm
rename to modules/std/future.inc
index 69f9eb5..8ff034d 100644
--- a/modules/std/future.cppm
+++ b/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/modules/std/generator.cppm b/modules/std/generator.cppm
deleted file mode 100644
index c67f5d0..0000000
--- a/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/modules/std/latch.cppm b/modules/std/generator.inc
similarity index 85%
copy from modules/std/latch.cppm
copy to modules/std/generator.inc
index dfafd79..43fb0da 100644
--- a/modules/std/latch.cppm
+++ b/modules/std/generator.inc
@@ -7,10 +7,8 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <latch>
-
-export module std:latch;
export namespace std {
- using std::latch;
+#if 0
+ using std::generator;
+#endif
} // namespace std
diff --git a/modules/std/hazard_pointer.cppm b/modules/std/hazard_pointer.inc
similarity index 79%
rename from modules/std/hazard_pointer.cppm
rename to modules/std/hazard_pointer.inc
index 84b83f5..e56f4d0 100644
--- a/modules/std/hazard_pointer.cppm
+++ b/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/modules/std/initializer_list.cppm b/modules/std/initializer_list.inc
similarity index 88%
rename from modules/std/initializer_list.cppm
rename to modules/std/initializer_list.inc
index 8e041f7..1dbeb22 100644
--- a/modules/std/initializer_list.cppm
+++ b/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/modules/std/iomanip.cppm b/modules/std/iomanip.inc
similarity index 86%
rename from modules/std/iomanip.cppm
rename to modules/std/iomanip.inc
index 5f795c0..35a52ef 100644
--- a/modules/std/iomanip.cppm
+++ b/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 @@
using std::setw;
using std::quoted;
-} // namespace std
#endif // _LIBCPP_HAS_NO_LOCALIZATION
+} // namespace std
diff --git a/modules/std/ios.cppm b/modules/std/ios.inc
similarity index 93%
rename from modules/std/ios.cppm
rename to modules/std/ios.inc
index 5dc7eb4..eeed539 100644
--- a/modules/std/ios.cppm
+++ b/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 @@
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using std::wios;
# endif
-} // namespace std
#endif // _LIBCPP_HAS_NO_LOCALIZATION
+} // namespace std
diff --git a/modules/std/iosfwd.cppm b/modules/std/iosfwd.inc
similarity index 92%
rename from modules/std/iosfwd.cppm
rename to modules/std/iosfwd.inc
index 3ba00d5..aba7f1e 100644
--- a/modules/std/iosfwd.cppm
+++ b/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/modules/std/iostream.cppm b/modules/std/iostream.inc
similarity index 84%
rename from modules/std/iostream.cppm
rename to modules/std/iostream.inc
index 3b80f83..d6e2036 100644
--- a/modules/std/iostream.cppm
+++ b/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 @@
using std::wclog;
using std::wcout;
# endif
-} // namespace std
#endif // _LIBCPP_HAS_NO_LOCALIZATION
+} // namespace std
diff --git a/modules/std/istream.cppm b/modules/std/istream.inc
similarity index 86%
rename from modules/std/istream.cppm
rename to modules/std/istream.inc
index ad18977..fdb1854 100644
--- a/modules/std/istream.cppm
+++ b/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 @@
using std::ws;
using std::operator>>;
-} // namespace std
#endif // _LIBCPP_HAS_NO_LOCALIZATION
+} // namespace std
diff --git a/modules/std/iterator.cppm b/modules/std/iterator.inc
similarity index 98%
rename from modules/std/iterator.cppm
rename to modules/std/iterator.inc
index 65fa363..10c63d7 100644
--- a/modules/std/iterator.cppm
+++ b/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/modules/std/latch.cppm b/modules/std/latch.inc
similarity index 89%
rename from modules/std/latch.cppm
rename to modules/std/latch.inc
index dfafd79..5afb8ff 100644
--- a/modules/std/latch.cppm
+++ b/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/modules/std/limits.cppm b/modules/std/limits.inc
similarity index 91%
rename from modules/std/limits.cppm
rename to modules/std/limits.inc
index 54ddccd..9aae993 100644
--- a/modules/std/limits.cppm
+++ b/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/modules/std/list.cppm b/modules/std/list.inc
similarity index 92%
rename from modules/std/list.cppm
rename to modules/std/list.inc
index eff83c9..f38094c 100644
--- a/modules/std/list.cppm
+++ b/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/modules/std/locale.cppm b/modules/std/locale.inc
similarity index 90%
rename from modules/std/locale.cppm
rename to modules/std/locale.inc
index d983fd1..8e0018f 100644
--- a/modules/std/locale.cppm
+++ b/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 @@
// [depr.conversions.string]
using std::wstring_convert;
} // namespace std
-#endif // _LIBCPP_HAS_NO_LOCALIZATION
diff --git a/modules/std/map.cppm b/modules/std/map.inc
similarity index 93%
rename from modules/std/map.cppm
rename to modules/std/map.inc
index 31353d1..ed154e3 100644
--- a/modules/std/map.cppm
+++ b/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/modules/std/mdspan.cppm b/modules/std/mdspan.inc
similarity index 93%
rename from modules/std/mdspan.cppm
rename to modules/std/mdspan.inc
index d92024d..37580ea 100644
--- a/modules/std/mdspan.cppm
+++ b/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/modules/std/memory.cppm b/modules/std/memory.inc
similarity index 98%
rename from modules/std/memory.cppm
rename to modules/std/memory.inc
index 46a88cb..06af546 100644
--- a/modules/std/memory.cppm
+++ b/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/modules/std/memory_resource.cppm b/modules/std/memory_resource.inc
similarity index 93%
rename from modules/std/memory_resource.cppm
rename to modules/std/memory_resource.inc
index 3c0be56..740179b 100644
--- a/modules/std/memory_resource.cppm
+++ b/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/modules/std/mutex.cppm b/modules/std/mutex.inc
similarity index 95%
rename from modules/std/mutex.cppm
rename to modules/std/mutex.inc
index fcd087c..fa55324 100644
--- a/modules/std/mutex.cppm
+++ b/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/modules/std/new.cppm b/modules/std/new.inc
similarity index 91%
rename from modules/std/new.cppm
rename to modules/std/new.inc
index bc8eb70..31c4905 100644
--- a/modules/std/new.cppm
+++ b/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/modules/std/numbers.cppm b/modules/std/numbers.inc
similarity index 95%
rename from modules/std/numbers.cppm
rename to modules/std/numbers.inc
index 6b9a62a..2f55f44 100644
--- a/modules/std/numbers.cppm
+++ b/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/modules/std/numeric.cppm b/modules/std/numeric.inc
similarity index 95%
rename from modules/std/numeric.cppm
rename to modules/std/numeric.inc
index a8c513e..d2b7688 100644
--- a/modules/std/numeric.cppm
+++ b/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/modules/std/optional.cppm b/modules/std/optional.inc
similarity index 94%
rename from modules/std/optional.cppm
rename to modules/std/optional.inc
index 4ebc503..0f812bc 100644
--- a/modules/std/optional.cppm
+++ b/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/modules/std/ostream.cppm b/modules/std/ostream.inc
similarity index 88%
rename from modules/std/ostream.cppm
rename to modules/std/ostream.inc
index 0b15048..e898978 100644
--- a/modules/std/ostream.cppm
+++ b/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 @@
using std::vprint_nonunicode;
using std::vprint_unicode;
# endif
-} // namespace std
#endif // _LIBCPP_HAS_NO_LOCALIZATION
+} // namespace std
diff --git a/modules/std/print.cppm b/modules/std/print.inc
similarity index 91%
rename from modules/std/print.cppm
rename to modules/std/print.inc
index 9d089a6..32304d2 100644
--- a/modules/std/print.cppm
+++ b/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/modules/std/queue.cppm b/modules/std/queue.inc
similarity index 93%
rename from modules/std/queue.cppm
rename to modules/std/queue.inc
index 8632ee2..d2fb187 100644
--- a/modules/std/queue.cppm
+++ b/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/modules/std/random.cppm b/modules/std/random.inc
similarity index 98%
rename from modules/std/random.cppm
rename to modules/std/random.inc
index 43137b7..87758fa 100644
--- a/modules/std/random.cppm
+++ b/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/modules/std/ranges.cppm b/modules/std/ranges.inc
similarity index 98%
rename from modules/std/ranges.cppm
rename to modules/std/ranges.inc
index cf4c252..a6b1bf5 100644
--- a/modules/std/ranges.cppm
+++ b/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/modules/std/ratio.cppm b/modules/std/ratio.inc
similarity index 96%
rename from modules/std/ratio.cppm
rename to modules/std/ratio.inc
index 410b9cf..4e1d4c6 100644
--- a/modules/std/ratio.cppm
+++ b/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/modules/std/rcu.cppm b/modules/std/rcu.inc
similarity index 81%
rename from modules/std/rcu.cppm
rename to modules/std/rcu.inc
index fb5e5e1..abf5afa 100644
--- a/modules/std/rcu.cppm
+++ b/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/modules/std/regex.cppm b/modules/std/regex.inc
similarity index 95%
rename from modules/std/regex.cppm
rename to modules/std/regex.inc
index 7c23e63..8217e34 100644
--- a/modules/std/regex.cppm
+++ b/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 @@
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/modules/std/scoped_allocator.cppm b/modules/std/scoped_allocator.inc
similarity index 88%
rename from modules/std/scoped_allocator.cppm
rename to modules/std/scoped_allocator.inc
index f198db9..91c9694 100644
--- a/modules/std/scoped_allocator.cppm
+++ b/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/modules/std/semaphore.cppm b/modules/std/semaphore.inc
similarity index 89%
rename from modules/std/semaphore.cppm
rename to modules/std/semaphore.inc
index 7b81460..bc8d905 100644
--- a/modules/std/semaphore.cppm
+++ b/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/modules/std/set.cppm b/modules/std/set.inc
similarity index 93%
rename from modules/std/set.cppm
rename to modules/std/set.inc
index 19a2734..a8db792 100644
--- a/modules/std/set.cppm
+++ b/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/modules/std/shared_mutex.cppm b/modules/std/shared_mutex.inc
similarity index 91%
rename from modules/std/shared_mutex.cppm
rename to modules/std/shared_mutex.inc
index 36c0f18..2b0782e 100644
--- a/modules/std/shared_mutex.cppm
+++ b/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/modules/std/source_location.cppm b/modules/std/source_location.inc
similarity index 86%
rename from modules/std/source_location.cppm
rename to modules/std/source_location.inc
index 0f6aee5..750ab16 100644
--- a/modules/std/source_location.cppm
+++ b/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/modules/std/span.cppm b/modules/std/span.inc
similarity index 93%
rename from modules/std/span.cppm
rename to modules/std/span.inc
index 98bd270..184591c 100644
--- a/modules/std/span.cppm
+++ b/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/modules/std/spanstream.cppm b/modules/std/spanstream.inc
similarity index 84%
rename from modules/std/spanstream.cppm
rename to modules/std/spanstream.inc
index 6106add..e6383a1 100644
--- a/modules/std/spanstream.cppm
+++ b/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/modules/std/sstream.cppm b/modules/std/sstream.inc
similarity index 89%
rename from modules/std/sstream.cppm
rename to modules/std/sstream.inc
index 1dacb63..2218001 100644
--- a/modules/std/sstream.cppm
+++ b/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 @@
# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using std::wstringstream;
# endif
-} // namespace std
#endif // _LIBCPP_HAS_NO_LOCALIZATION
+} // namespace std
diff --git a/modules/std/stack.cppm b/modules/std/stack.inc
similarity index 92%
rename from modules/std/stack.cppm
rename to modules/std/stack.inc
index 91cec2d..3f736ff 100644
--- a/modules/std/stack.cppm
+++ b/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/modules/std/stacktrace.cppm b/modules/std/stacktrace.inc
similarity index 82%
rename from modules/std/stacktrace.cppm
rename to modules/std/stacktrace.inc
index c7db9c2..c118408 100644
--- a/modules/std/stacktrace.cppm
+++ b/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/modules/std/stdexcept.cppm b/modules/std/stdexcept.inc
similarity index 91%
rename from modules/std/stdexcept.cppm
rename to modules/std/stdexcept.inc
index 686b8a7..15d37ba 100644
--- a/modules/std/stdexcept.cppm
+++ b/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/modules/std/stdfloat.cppm b/modules/std/stdfloat.inc
similarity index 83%
rename from modules/std/stdfloat.cppm
rename to modules/std/stdfloat.inc
index 740fd47..7e7201a 100644
--- a/modules/std/stdfloat.cppm
+++ b/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/modules/std/stop_token.cppm b/modules/std/stop_token.inc
similarity index 91%
rename from modules/std/stop_token.cppm
rename to modules/std/stop_token.inc
index 80a5755..80b53e9 100644
--- a/modules/std/stop_token.cppm
+++ b/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/modules/std/streambuf.cppm b/modules/std/streambuf.inc
similarity index 83%
rename from modules/std/streambuf.cppm
rename to modules/std/streambuf.inc
index 7b3d989..32914cf 100644
--- a/modules/std/streambuf.cppm
+++ b/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/modules/std/string.cppm b/modules/std/string.inc
similarity index 96%
rename from modules/std/string.cppm
rename to modules/std/string.inc
index 9696d58..76b384c 100644
--- a/modules/std/string.cppm
+++ b/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/modules/std/string_view.cppm b/modules/std/string_view.inc
similarity index 95%
rename from modules/std/string_view.cppm
rename to modules/std/string_view.inc
index ac90006..1fa63a7 100644
--- a/modules/std/string_view.cppm
+++ b/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/modules/std/strstream.cppm b/modules/std/strstream.inc
similarity index 82%
rename from modules/std/strstream.cppm
rename to modules/std/strstream.inc
index 0f4fe7f..a33c514 100644
--- a/modules/std/strstream.cppm
+++ b/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/modules/std/syncstream.cppm b/modules/std/syncstream.inc
similarity index 80%
rename from modules/std/syncstream.cppm
rename to modules/std/syncstream.inc
index 310f279..df9b679 100644
--- a/modules/std/syncstream.cppm
+++ b/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/modules/std/system_error.cppm b/modules/std/system_error.inc
similarity index 94%
rename from modules/std/system_error.cppm
rename to modules/std/system_error.inc
index 71c1dca..cf553a5 100644
--- a/modules/std/system_error.cppm
+++ b/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/modules/std/text_encoding.cppm b/modules/std/text_encoding.cppm
deleted file mode 100644
index dcbaa73..0000000
--- a/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/modules/std/typeindex.cppm b/modules/std/text_encoding.inc
similarity index 78%
copy from modules/std/typeindex.cppm
copy to modules/std/text_encoding.inc
index 386ed6b..6d5e3f1 100644
--- a/modules/std/typeindex.cppm
+++ b/modules/std/text_encoding.inc
@@ -7,11 +7,13 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <typeindex>
-
-export module std:typeindex;
export namespace std {
+#if 0
+# if _LIBCPP_STD_VER >= 23
+ using std::text_encoding;
+
+ // hash support
using std::hash;
- using std::type_index;
+# endif // _LIBCPP_STD_VER >= 23
+#endif
} // namespace std
diff --git a/modules/std/thread.cppm b/modules/std/thread.inc
similarity index 94%
rename from modules/std/thread.cppm
rename to modules/std/thread.inc
index 1bfffa2..aa4a7db 100644
--- a/modules/std/thread.cppm
+++ b/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/modules/std/tuple.cppm b/modules/std/tuple.inc
similarity index 96%
rename from modules/std/tuple.cppm
rename to modules/std/tuple.inc
index 6c7dc5c..9a8fb72 100644
--- a/modules/std/tuple.cppm
+++ b/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/modules/std/type_traits.cppm b/modules/std/type_traits.inc
similarity index 98%
rename from modules/std/type_traits.cppm
rename to modules/std/type_traits.inc
index aca0aa9..f0ec4cb 100644
--- a/modules/std/type_traits.cppm
+++ b/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/modules/std/typeindex.cppm b/modules/std/typeindex.inc
similarity index 88%
rename from modules/std/typeindex.cppm
rename to modules/std/typeindex.inc
index 386ed6b..0fdcd8f 100644
--- a/modules/std/typeindex.cppm
+++ b/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/modules/std/typeinfo.cppm b/modules/std/typeinfo.inc
similarity index 89%
rename from modules/std/typeinfo.cppm
rename to modules/std/typeinfo.inc
index 39e6257..ee1273b 100644
--- a/modules/std/typeinfo.cppm
+++ b/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/modules/std/unordered_map.cppm b/modules/std/unordered_map.inc
similarity index 92%
rename from modules/std/unordered_map.cppm
rename to modules/std/unordered_map.inc
index 4469e0d..eff62f3 100644
--- a/modules/std/unordered_map.cppm
+++ b/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/modules/std/unordered_set.cppm b/modules/std/unordered_set.inc
similarity index 92%
rename from modules/std/unordered_set.cppm
rename to modules/std/unordered_set.inc
index f3329fc..c214e34 100644
--- a/modules/std/unordered_set.cppm
+++ b/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/modules/std/utility.cppm b/modules/std/utility.inc
similarity index 97%
rename from modules/std/utility.cppm
rename to modules/std/utility.inc
index b6aa2ae..c8e4dc3 100644
--- a/modules/std/utility.cppm
+++ b/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/modules/std/valarray.cppm b/modules/std/valarray.inc
similarity index 95%
rename from modules/std/valarray.cppm
rename to modules/std/valarray.inc
index 39c5e95..1cdf7f1 100644
--- a/modules/std/valarray.cppm
+++ b/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/modules/std/variant.cppm b/modules/std/variant.inc
similarity index 95%
rename from modules/std/variant.cppm
rename to modules/std/variant.inc
index 7e96ba3..6fcecdd 100644
--- a/modules/std/variant.cppm
+++ b/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/modules/std/vector.cppm b/modules/std/vector.inc
similarity index 91%
rename from modules/std/vector.cppm
rename to modules/std/vector.inc
index 9ebe2d4..a9ce764 100644
--- a/modules/std/vector.cppm
+++ b/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/modules/std/version.cppm b/modules/std/version.cppm
deleted file mode 100644
index c2e8f09..0000000
--- a/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/modules/std/cerrno.cppm b/modules/std/version.inc
similarity index 89%
copy from modules/std/cerrno.cppm
copy to modules/std/version.inc
index d319956..2ab8eb9 100644
--- a/modules/std/cerrno.cppm
+++ b/modules/std/version.inc
@@ -7,10 +7,6 @@
//
//===----------------------------------------------------------------------===//
-module;
-#include <cerrno>
-
-export module std:cerrno;
export namespace std {
// This module exports nothing.
} // namespace std
diff --git a/test/libcxx/module_std.gen.py b/test/libcxx/module_std.gen.py
index 534da53..17f671e 100644
--- a/test/libcxx/module_std.gen.py
+++ b/test/libcxx/module_std.gen.py
@@ -119,6 +119,9 @@
# 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 @@
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/test/tools/clang_tidy_checks/header_exportable_declarations.cpp b/test/tools/clang_tidy_checks/header_exportable_declarations.cpp
index f691f4e..281d1ec 100644
--- a/test/tools/clang_tidy_checks/header_exportable_declarations.cpp
+++ b/test/tools/clang_tidy_checks/header_exportable_declarations.cpp
@@ -222,14 +222,8 @@
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;