[libcxx-commits] [libcxx] [libc++][modules] Attach declarations to the global module. (PR #92747)
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Mon May 20 08:21:40 PDT 2024
https://github.com/mordante updated https://github.com/llvm/llvm-project/pull/92747
>From 73e86db88731f24f6442dc5527e37d8f8057eff5 Mon Sep 17 00:00:00 2001
From: Mark de Wever <koraq at xs4all.nl>
Date: Tue, 7 May 2024 20:24:11 +0200
Subject: [PATCH] [libc++][modules] Attach declarations to the global module.
Declarations in the global module fragment (the included headers) are attached
to the global module. The using declarations in the module std and std.compat
were attached to their module.
This violates
[basic.link]/10
If two declarations of an entity are attached to different modules, the
program is ill-formed; no diagnostic is required if neither is reachable from
the other.
Instead attach the delarations in the module to the global module by using a
linkage-specification. ([module.unit]/7)
Thanks to @DanielaE for pointing out this issue.
---
libcxx/include/__config | 11 +++++++++++
libcxx/modules/std.compat/cassert.inc | 4 ++--
libcxx/modules/std.compat/cctype.inc | 4 ++--
libcxx/modules/std.compat/cerrno.inc | 4 ++--
libcxx/modules/std.compat/cfenv.inc | 4 ++--
libcxx/modules/std.compat/cfloat.inc | 4 ++--
libcxx/modules/std.compat/cinttypes.inc | 4 ++--
libcxx/modules/std.compat/climits.inc | 4 ++--
libcxx/modules/std.compat/clocale.inc | 4 ++--
libcxx/modules/std.compat/cmath.inc | 4 ++--
libcxx/modules/std.compat/csetjmp.inc | 4 ++--
libcxx/modules/std.compat/csignal.inc | 4 ++--
libcxx/modules/std.compat/cstdarg.inc | 2 +-
libcxx/modules/std.compat/cstddef.inc | 4 ++--
libcxx/modules/std.compat/cstdint.inc | 4 ++--
libcxx/modules/std.compat/cstdio.inc | 4 ++--
libcxx/modules/std.compat/cstdlib.inc | 4 ++--
libcxx/modules/std.compat/cstring.inc | 4 ++--
libcxx/modules/std.compat/ctime.inc | 4 ++--
libcxx/modules/std.compat/cuchar.inc | 4 ++--
libcxx/modules/std.compat/cwchar.inc | 4 ++--
libcxx/modules/std.compat/cwctype.inc | 4 ++--
libcxx/modules/std/algorithm.inc | 2 +-
libcxx/modules/std/any.inc | 3 +--
libcxx/modules/std/array.inc | 3 +--
libcxx/modules/std/atomic.inc | 3 +--
libcxx/modules/std/barrier.inc | 2 +-
libcxx/modules/std/bit.inc | 2 +-
libcxx/modules/std/bitset.inc | 2 +-
libcxx/modules/std/cassert.inc | 2 +-
libcxx/modules/std/cctype.inc | 2 +-
libcxx/modules/std/cerrno.inc | 2 +-
libcxx/modules/std/cfenv.inc | 2 +-
libcxx/modules/std/cfloat.inc | 2 +-
libcxx/modules/std/charconv.inc | 3 +--
libcxx/modules/std/chrono.inc | 5 ++---
libcxx/modules/std/cinttypes.inc | 2 +-
libcxx/modules/std/climits.inc | 2 +-
libcxx/modules/std/clocale.inc | 2 +-
libcxx/modules/std/cmath.inc | 3 +--
libcxx/modules/std/codecvt.inc | 2 +-
libcxx/modules/std/compare.inc | 3 +--
libcxx/modules/std/complex.inc | 3 +--
libcxx/modules/std/concepts.inc | 3 +--
libcxx/modules/std/condition_variable.inc | 2 +-
libcxx/modules/std/coroutine.inc | 3 +--
libcxx/modules/std/csetjmp.inc | 2 +-
libcxx/modules/std/csignal.inc | 2 +-
libcxx/modules/std/cstdarg.inc | 4 +---
libcxx/modules/std/cstddef.inc | 2 +-
libcxx/modules/std/cstdint.inc | 2 +-
libcxx/modules/std/cstdio.inc | 2 +-
libcxx/modules/std/cstdlib.inc | 2 +-
libcxx/modules/std/cstring.inc | 2 +-
libcxx/modules/std/ctime.inc | 2 +-
libcxx/modules/std/cuchar.inc | 2 +-
libcxx/modules/std/cwchar.inc | 2 +-
libcxx/modules/std/cwctype.inc | 2 +-
libcxx/modules/std/deque.inc | 2 +-
libcxx/modules/std/exception.inc | 2 +-
libcxx/modules/std/execution.inc | 4 ++--
libcxx/modules/std/expected.inc | 2 +-
libcxx/modules/std/filesystem.inc | 8 +++-----
libcxx/modules/std/flat_map.inc | 2 +-
libcxx/modules/std/flat_set.inc | 2 +-
libcxx/modules/std/format.inc | 2 +-
libcxx/modules/std/forward_list.inc | 2 +-
libcxx/modules/std/fstream.inc | 2 +-
libcxx/modules/std/functional.inc | 2 +-
libcxx/modules/std/future.inc | 2 +-
libcxx/modules/std/generator.inc | 2 +-
libcxx/modules/std/hazard_pointer.inc | 2 +-
libcxx/modules/std/initializer_list.inc | 2 +-
libcxx/modules/std/iomanip.inc | 2 +-
libcxx/modules/std/ios.inc | 2 +-
libcxx/modules/std/iosfwd.inc | 2 +-
libcxx/modules/std/iostream.inc | 2 +-
libcxx/modules/std/istream.inc | 2 +-
libcxx/modules/std/iterator.inc | 2 +-
libcxx/modules/std/latch.inc | 2 +-
libcxx/modules/std/limits.inc | 2 +-
libcxx/modules/std/list.inc | 2 +-
libcxx/modules/std/locale.inc | 2 +-
libcxx/modules/std/map.inc | 2 +-
libcxx/modules/std/mdspan.inc | 2 +-
libcxx/modules/std/memory.inc | 2 +-
libcxx/modules/std/memory_resource.inc | 2 +-
libcxx/modules/std/mutex.inc | 2 +-
libcxx/modules/std/new.inc | 6 +++---
libcxx/modules/std/numbers.inc | 2 +-
libcxx/modules/std/numeric.inc | 2 +-
libcxx/modules/std/optional.inc | 2 +-
libcxx/modules/std/ostream.inc | 2 +-
libcxx/modules/std/print.inc | 2 +-
libcxx/modules/std/queue.inc | 2 +-
libcxx/modules/std/random.inc | 2 +-
libcxx/modules/std/ranges.inc | 2 +-
libcxx/modules/std/ratio.inc | 2 +-
libcxx/modules/std/rcu.inc | 2 +-
libcxx/modules/std/regex.inc | 2 +-
libcxx/modules/std/scoped_allocator.inc | 2 +-
libcxx/modules/std/semaphore.inc | 2 +-
libcxx/modules/std/set.inc | 2 +-
libcxx/modules/std/shared_mutex.inc | 2 +-
libcxx/modules/std/source_location.inc | 4 +---
libcxx/modules/std/span.inc | 2 +-
libcxx/modules/std/spanstream.inc | 2 +-
libcxx/modules/std/sstream.inc | 2 +-
libcxx/modules/std/stack.inc | 2 +-
libcxx/modules/std/stacktrace.inc | 2 +-
libcxx/modules/std/stdexcept.inc | 2 +-
libcxx/modules/std/stdfloat.inc | 2 +-
libcxx/modules/std/stop_token.inc | 2 +-
libcxx/modules/std/streambuf.inc | 2 +-
libcxx/modules/std/string.inc | 2 +-
libcxx/modules/std/string_view.inc | 2 +-
libcxx/modules/std/strstream.inc | 2 +-
libcxx/modules/std/syncstream.inc | 2 +-
libcxx/modules/std/system_error.inc | 2 +-
libcxx/modules/std/text_encoding.inc | 2 +-
libcxx/modules/std/thread.inc | 2 +-
libcxx/modules/std/tuple.inc | 2 +-
libcxx/modules/std/type_traits.inc | 2 +-
libcxx/modules/std/typeindex.inc | 2 +-
libcxx/modules/std/typeinfo.inc | 2 +-
libcxx/modules/std/unordered_map.inc | 2 +-
libcxx/modules/std/unordered_set.inc | 2 +-
libcxx/modules/std/utility.inc | 2 +-
libcxx/modules/std/valarray.inc | 2 +-
libcxx/modules/std/variant.inc | 2 +-
libcxx/modules/std/vector.inc | 2 +-
libcxx/modules/std/version.inc | 2 +-
.../header_exportable_declarations.cpp | 9 ++++++++-
libcxx/utils/libcxx/test/modules.py | 3 +++
134 files changed, 179 insertions(+), 174 deletions(-)
diff --git a/libcxx/include/__config b/libcxx/include/__config
index 104a244cc82cc..865ebb0f6fbf6 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -837,6 +837,17 @@ typedef __char32_t char32_t;
# define _LIBCPP_END_NAMESPACE_FILESYSTEM }} _LIBCPP_END_NAMESPACE_STD
// clang-format on
+// Named declarations included in the headers are part of the global module
+// fragment. These declarations are attached to the global module. The using
+// declarations in the module should also attach their declarations to the
+// global module. This is done by using a linkage specification.
+# if defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 1700
+// Clang-17 does not support extern "C++" export
+# define _LIBCPP_MODULE_EXPORT export
+# else
+# define _LIBCPP_MODULE_EXPORT extern "C++" export
+# endif
+
# if __has_attribute(__enable_if__)
# define _LIBCPP_PREFERRED_OVERLOAD __attribute__((__enable_if__(true, "")))
# endif
diff --git a/libcxx/modules/std.compat/cassert.inc b/libcxx/modules/std.compat/cassert.inc
index ac0533d14e9a9..befbfc49ba4d4 100644
--- a/libcxx/modules/std.compat/cassert.inc
+++ b/libcxx/modules/std.compat/cassert.inc
@@ -7,6 +7,6 @@
//
//===----------------------------------------------------------------------===//
-export {
+_LIBCPP_MODULE_EXPORT {
// This module exports nothing.
-} // export
+} // _LIBCPP_MODULE_EXPORT
diff --git a/libcxx/modules/std.compat/cctype.inc b/libcxx/modules/std.compat/cctype.inc
index 5cde12ddb38d7..34b0e55c243ff 100644
--- a/libcxx/modules/std.compat/cctype.inc
+++ b/libcxx/modules/std.compat/cctype.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export {
+_LIBCPP_MODULE_EXPORT {
using ::isalnum _LIBCPP_USING_IF_EXISTS;
using ::isalpha _LIBCPP_USING_IF_EXISTS;
using ::isblank _LIBCPP_USING_IF_EXISTS;
@@ -22,4 +22,4 @@ export {
using ::isxdigit _LIBCPP_USING_IF_EXISTS;
using ::tolower _LIBCPP_USING_IF_EXISTS;
using ::toupper _LIBCPP_USING_IF_EXISTS;
-} // export
+} // _LIBCPP_MODULE_EXPORT
diff --git a/libcxx/modules/std.compat/cerrno.inc b/libcxx/modules/std.compat/cerrno.inc
index ac0533d14e9a9..befbfc49ba4d4 100644
--- a/libcxx/modules/std.compat/cerrno.inc
+++ b/libcxx/modules/std.compat/cerrno.inc
@@ -7,6 +7,6 @@
//
//===----------------------------------------------------------------------===//
-export {
+_LIBCPP_MODULE_EXPORT {
// This module exports nothing.
-} // export
+} // _LIBCPP_MODULE_EXPORT
diff --git a/libcxx/modules/std.compat/cfenv.inc b/libcxx/modules/std.compat/cfenv.inc
index 5a373f6469712..d2a484323d6ca 100644
--- a/libcxx/modules/std.compat/cfenv.inc
+++ b/libcxx/modules/std.compat/cfenv.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export {
+_LIBCPP_MODULE_EXPORT {
// types
using ::fenv_t _LIBCPP_USING_IF_EXISTS;
using ::fexcept_t _LIBCPP_USING_IF_EXISTS;
@@ -26,4 +26,4 @@ export {
using ::feholdexcept _LIBCPP_USING_IF_EXISTS;
using ::fesetenv _LIBCPP_USING_IF_EXISTS;
using ::feupdateenv _LIBCPP_USING_IF_EXISTS;
-} // export
+} // _LIBCPP_MODULE_EXPORT
diff --git a/libcxx/modules/std.compat/cfloat.inc b/libcxx/modules/std.compat/cfloat.inc
index ac0533d14e9a9..befbfc49ba4d4 100644
--- a/libcxx/modules/std.compat/cfloat.inc
+++ b/libcxx/modules/std.compat/cfloat.inc
@@ -7,6 +7,6 @@
//
//===----------------------------------------------------------------------===//
-export {
+_LIBCPP_MODULE_EXPORT {
// This module exports nothing.
-} // export
+} // _LIBCPP_MODULE_EXPORT
diff --git a/libcxx/modules/std.compat/cinttypes.inc b/libcxx/modules/std.compat/cinttypes.inc
index 4789ec3310200..c6011f0ae22e1 100644
--- a/libcxx/modules/std.compat/cinttypes.inc
+++ b/libcxx/modules/std.compat/cinttypes.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export {
+_LIBCPP_MODULE_EXPORT {
using ::imaxdiv_t _LIBCPP_USING_IF_EXISTS;
using ::imaxabs _LIBCPP_USING_IF_EXISTS;
@@ -22,4 +22,4 @@ export {
// div is conditionally here, but always present in cstdlib.cppm. To avoid
// conflicing declarations omit the using here.
-} // export
+} // _LIBCPP_MODULE_EXPORT
diff --git a/libcxx/modules/std.compat/climits.inc b/libcxx/modules/std.compat/climits.inc
index ac0533d14e9a9..befbfc49ba4d4 100644
--- a/libcxx/modules/std.compat/climits.inc
+++ b/libcxx/modules/std.compat/climits.inc
@@ -7,6 +7,6 @@
//
//===----------------------------------------------------------------------===//
-export {
+_LIBCPP_MODULE_EXPORT {
// This module exports nothing.
-} // export
+} // _LIBCPP_MODULE_EXPORT
diff --git a/libcxx/modules/std.compat/clocale.inc b/libcxx/modules/std.compat/clocale.inc
index 1a975c560a496..2b0982ac61a2f 100644
--- a/libcxx/modules/std.compat/clocale.inc
+++ b/libcxx/modules/std.compat/clocale.inc
@@ -7,11 +7,11 @@
//
//===----------------------------------------------------------------------===//
-export {
+_LIBCPP_MODULE_EXPORT {
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
using ::lconv _LIBCPP_USING_IF_EXISTS;
using ::localeconv _LIBCPP_USING_IF_EXISTS;
using ::setlocale _LIBCPP_USING_IF_EXISTS;
#endif // _LIBCPP_HAS_NO_LOCALIZATION
-} // export
+} // _LIBCPP_MODULE_EXPORT
diff --git a/libcxx/modules/std.compat/cmath.inc b/libcxx/modules/std.compat/cmath.inc
index 6c86d0df57406..cd858968122b3 100644
--- a/libcxx/modules/std.compat/cmath.inc
+++ b/libcxx/modules/std.compat/cmath.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export {
+_LIBCPP_MODULE_EXPORT {
using ::double_t _LIBCPP_USING_IF_EXISTS;
using ::float_t _LIBCPP_USING_IF_EXISTS;
@@ -265,4 +265,4 @@ export {
using ::signbit _LIBCPP_USING_IF_EXISTS;
// [sf.cmath], mathematical special functions
-} // export
+} // _LIBCPP_MODULE_EXPORT
diff --git a/libcxx/modules/std.compat/csetjmp.inc b/libcxx/modules/std.compat/csetjmp.inc
index 53e1421a2fbdd..94c698387ff9f 100644
--- a/libcxx/modules/std.compat/csetjmp.inc
+++ b/libcxx/modules/std.compat/csetjmp.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export {
+_LIBCPP_MODULE_EXPORT {
using ::jmp_buf _LIBCPP_USING_IF_EXISTS;
using ::longjmp _LIBCPP_USING_IF_EXISTS;
-} // export
+} // _LIBCPP_MODULE_EXPORT
diff --git a/libcxx/modules/std.compat/csignal.inc b/libcxx/modules/std.compat/csignal.inc
index bf72459df1653..8d83d2dcaf67d 100644
--- a/libcxx/modules/std.compat/csignal.inc
+++ b/libcxx/modules/std.compat/csignal.inc
@@ -7,11 +7,11 @@
//
//===----------------------------------------------------------------------===//
-export {
+_LIBCPP_MODULE_EXPORT {
using ::sig_atomic_t _LIBCPP_USING_IF_EXISTS;
// [support.signal], signal handlers
using ::signal _LIBCPP_USING_IF_EXISTS;
using ::raise _LIBCPP_USING_IF_EXISTS;
-} // export
+} // _LIBCPP_MODULE_EXPORT
diff --git a/libcxx/modules/std.compat/cstdarg.inc b/libcxx/modules/std.compat/cstdarg.inc
index 79b5df4ec99ce..e7aaddce6d688 100644
--- a/libcxx/modules/std.compat/cstdarg.inc
+++ b/libcxx/modules/std.compat/cstdarg.inc
@@ -7,4 +7,4 @@
//
//===----------------------------------------------------------------------===//
-export { using ::va_list _LIBCPP_USING_IF_EXISTS; } // export
+_LIBCPP_MODULE_EXPORT { using ::va_list _LIBCPP_USING_IF_EXISTS; } // _LIBCPP_MODULE_EXPORT
diff --git a/libcxx/modules/std.compat/cstddef.inc b/libcxx/modules/std.compat/cstddef.inc
index 8704a31e01f32..f7f4c5e993dca 100644
--- a/libcxx/modules/std.compat/cstddef.inc
+++ b/libcxx/modules/std.compat/cstddef.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export {
+_LIBCPP_MODULE_EXPORT {
using ::max_align_t _LIBCPP_USING_IF_EXISTS;
using ::nullptr_t;
using ::ptrdiff_t _LIBCPP_USING_IF_EXISTS;
@@ -19,4 +19,4 @@ export {
// function templates described in [support.types.byteops]. ...
// [support.types.byteops], byte type operations
-} // export
+} // _LIBCPP_MODULE_EXPORT
diff --git a/libcxx/modules/std.compat/cstdint.inc b/libcxx/modules/std.compat/cstdint.inc
index a8dd6898cb266..5edddde004d2d 100644
--- a/libcxx/modules/std.compat/cstdint.inc
+++ b/libcxx/modules/std.compat/cstdint.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export {
+_LIBCPP_MODULE_EXPORT {
// signed
using ::int8_t _LIBCPP_USING_IF_EXISTS;
using ::int16_t _LIBCPP_USING_IF_EXISTS;
@@ -47,4 +47,4 @@ export {
using ::uintmax_t _LIBCPP_USING_IF_EXISTS;
using ::uintptr_t _LIBCPP_USING_IF_EXISTS;
-} // export
+} // _LIBCPP_MODULE_EXPORT
diff --git a/libcxx/modules/std.compat/cstdio.inc b/libcxx/modules/std.compat/cstdio.inc
index 33dd2cbfb0d7c..4dc19dc193667 100644
--- a/libcxx/modules/std.compat/cstdio.inc
+++ b/libcxx/modules/std.compat/cstdio.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export {
+_LIBCPP_MODULE_EXPORT {
using ::FILE _LIBCPP_USING_IF_EXISTS;
using ::fpos_t _LIBCPP_USING_IF_EXISTS;
using ::size_t _LIBCPP_USING_IF_EXISTS;
@@ -58,4 +58,4 @@ export {
using ::vsprintf _LIBCPP_USING_IF_EXISTS;
using ::vsscanf _LIBCPP_USING_IF_EXISTS;
-} // export
+} // _LIBCPP_MODULE_EXPORT
diff --git a/libcxx/modules/std.compat/cstdlib.inc b/libcxx/modules/std.compat/cstdlib.inc
index 94f5e7e8d7f45..52414334c33d3 100644
--- a/libcxx/modules/std.compat/cstdlib.inc
+++ b/libcxx/modules/std.compat/cstdlib.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export {
+_LIBCPP_MODULE_EXPORT {
using ::div_t _LIBCPP_USING_IF_EXISTS;
using ::ldiv_t _LIBCPP_USING_IF_EXISTS;
using ::lldiv_t _LIBCPP_USING_IF_EXISTS;
@@ -69,4 +69,4 @@ export {
using ::ldiv _LIBCPP_USING_IF_EXISTS;
using ::lldiv _LIBCPP_USING_IF_EXISTS;
-} // export
+} // _LIBCPP_MODULE_EXPORT
diff --git a/libcxx/modules/std.compat/cstring.inc b/libcxx/modules/std.compat/cstring.inc
index 5029a7674bb21..fbc59d5b120c0 100644
--- a/libcxx/modules/std.compat/cstring.inc
+++ b/libcxx/modules/std.compat/cstring.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export {
+_LIBCPP_MODULE_EXPORT {
using ::size_t _LIBCPP_USING_IF_EXISTS;
using ::memchr _LIBCPP_USING_IF_EXISTS;
@@ -33,4 +33,4 @@ export {
using ::strtok _LIBCPP_USING_IF_EXISTS;
using ::strxfrm _LIBCPP_USING_IF_EXISTS;
-} // export
+} // _LIBCPP_MODULE_EXPORT
diff --git a/libcxx/modules/std.compat/ctime.inc b/libcxx/modules/std.compat/ctime.inc
index eba8234a08969..af2d8043c3197 100644
--- a/libcxx/modules/std.compat/ctime.inc
+++ b/libcxx/modules/std.compat/ctime.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export {
+_LIBCPP_MODULE_EXPORT {
using ::clock_t _LIBCPP_USING_IF_EXISTS;
using ::size_t _LIBCPP_USING_IF_EXISTS;
using ::time_t _LIBCPP_USING_IF_EXISTS;
@@ -25,4 +25,4 @@ export {
using ::strftime _LIBCPP_USING_IF_EXISTS;
using ::time _LIBCPP_USING_IF_EXISTS;
using ::timespec_get _LIBCPP_USING_IF_EXISTS;
-} // export
+} // _LIBCPP_MODULE_EXPORT
diff --git a/libcxx/modules/std.compat/cuchar.inc b/libcxx/modules/std.compat/cuchar.inc
index d1a511cadef18..d14307d47c48d 100644
--- a/libcxx/modules/std.compat/cuchar.inc
+++ b/libcxx/modules/std.compat/cuchar.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export {
+_LIBCPP_MODULE_EXPORT {
// Note the Standard does not mark these symbols optional, but libc++'s header
// does. So this seems strictly not to be conforming.
@@ -25,4 +25,4 @@ export {
using ::c16rtomb _LIBCPP_USING_IF_EXISTS;
using ::mbrtoc32 _LIBCPP_USING_IF_EXISTS;
using ::c32rtomb _LIBCPP_USING_IF_EXISTS;
-} // export
+} // _LIBCPP_MODULE_EXPORT
diff --git a/libcxx/modules/std.compat/cwchar.inc b/libcxx/modules/std.compat/cwchar.inc
index 4cad9281fb49a..21bd1c29ff571 100644
--- a/libcxx/modules/std.compat/cwchar.inc
+++ b/libcxx/modules/std.compat/cwchar.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export {
+_LIBCPP_MODULE_EXPORT {
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using ::mbstate_t _LIBCPP_USING_IF_EXISTS;
using ::size_t _LIBCPP_USING_IF_EXISTS;
@@ -77,4 +77,4 @@ export {
using ::wcrtomb _LIBCPP_USING_IF_EXISTS;
using ::wcsrtombs _LIBCPP_USING_IF_EXISTS;
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-} // export
+} // _LIBCPP_MODULE_EXPORT
diff --git a/libcxx/modules/std.compat/cwctype.inc b/libcxx/modules/std.compat/cwctype.inc
index 8d06eaa379eaa..28f58733f1261 100644
--- a/libcxx/modules/std.compat/cwctype.inc
+++ b/libcxx/modules/std.compat/cwctype.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export {
+_LIBCPP_MODULE_EXPORT {
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using ::wctrans_t _LIBCPP_USING_IF_EXISTS;
using ::wctype_t _LIBCPP_USING_IF_EXISTS;
@@ -32,4 +32,4 @@ export {
using ::wctrans _LIBCPP_USING_IF_EXISTS;
using ::wctype _LIBCPP_USING_IF_EXISTS;
#endif // _LIBCPP_HAS_NO_WIDE_CHARACTERS
-} // export
+} // _LIBCPP_MODULE_EXPORT
diff --git a/libcxx/modules/std/algorithm.inc b/libcxx/modules/std/algorithm.inc
index e7796bfa26af8..71a7788d209bb 100644
--- a/libcxx/modules/std/algorithm.inc
+++ b/libcxx/modules/std/algorithm.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
namespace ranges {
// [algorithms.results], algorithm result types
using std::ranges::in_found_result;
diff --git a/libcxx/modules/std/any.inc b/libcxx/modules/std/any.inc
index c57257ede8490..1430e76623eb6 100644
--- a/libcxx/modules/std/any.inc
+++ b/libcxx/modules/std/any.inc
@@ -7,8 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
-
+_LIBCPP_MODULE_EXPORT namespace std {
// [any.bad.any.cast], class bad_any_cast
using std::bad_any_cast;
diff --git a/libcxx/modules/std/array.inc b/libcxx/modules/std/array.inc
index d55779c8bd128..180fcfed6120e 100644
--- a/libcxx/modules/std/array.inc
+++ b/libcxx/modules/std/array.inc
@@ -7,8 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
-
+_LIBCPP_MODULE_EXPORT namespace std {
// [array], class template array
using std::array;
diff --git a/libcxx/modules/std/atomic.inc b/libcxx/modules/std/atomic.inc
index d77d7a5bb0fbc..2513aa527d28b 100644
--- a/libcxx/modules/std/atomic.inc
+++ b/libcxx/modules/std/atomic.inc
@@ -7,8 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
-
+_LIBCPP_MODULE_EXPORT namespace std {
// [atomics.order], order and consistency
using std::memory_order _LIBCPP_USING_IF_EXISTS;
using std::memory_order_acq_rel _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/modules/std/barrier.inc b/libcxx/modules/std/barrier.inc
index dadb67f7ef330..3ad2e87c7f443 100644
--- a/libcxx/modules/std/barrier.inc
+++ b/libcxx/modules/std/barrier.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_THREADS
using std::barrier;
#endif // _LIBCPP_HAS_NO_THREADS
diff --git a/libcxx/modules/std/bit.inc b/libcxx/modules/std/bit.inc
index 027a6c17ad6a6..469948b6875c4 100644
--- a/libcxx/modules/std/bit.inc
+++ b/libcxx/modules/std/bit.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [bit.cast], bit_cast
using std::bit_cast;
diff --git a/libcxx/modules/std/bitset.inc b/libcxx/modules/std/bitset.inc
index bb528860eb561..7416acf8fbcf2 100644
--- a/libcxx/modules/std/bitset.inc
+++ b/libcxx/modules/std/bitset.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
using std::bitset;
// [bitset.operators], bitset operators
diff --git a/libcxx/modules/std/cassert.inc b/libcxx/modules/std/cassert.inc
index 2ab8eb970e7a5..929fc550423cd 100644
--- a/libcxx/modules/std/cassert.inc
+++ b/libcxx/modules/std/cassert.inc
@@ -7,6 +7,6 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// This module exports nothing.
} // namespace std
diff --git a/libcxx/modules/std/cctype.inc b/libcxx/modules/std/cctype.inc
index 43417aa159624..6e8f362f3ef3d 100644
--- a/libcxx/modules/std/cctype.inc
+++ b/libcxx/modules/std/cctype.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
using std::isalnum _LIBCPP_USING_IF_EXISTS;
using std::isalpha _LIBCPP_USING_IF_EXISTS;
using std::isblank _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/modules/std/cerrno.inc b/libcxx/modules/std/cerrno.inc
index 2ab8eb970e7a5..929fc550423cd 100644
--- a/libcxx/modules/std/cerrno.inc
+++ b/libcxx/modules/std/cerrno.inc
@@ -7,6 +7,6 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// This module exports nothing.
} // namespace std
diff --git a/libcxx/modules/std/cfenv.inc b/libcxx/modules/std/cfenv.inc
index 831c1fed8ebef..f125817fa834a 100644
--- a/libcxx/modules/std/cfenv.inc
+++ b/libcxx/modules/std/cfenv.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// types
using std::fenv_t _LIBCPP_USING_IF_EXISTS;
using std::fexcept_t _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/modules/std/cfloat.inc b/libcxx/modules/std/cfloat.inc
index 2ab8eb970e7a5..929fc550423cd 100644
--- a/libcxx/modules/std/cfloat.inc
+++ b/libcxx/modules/std/cfloat.inc
@@ -7,6 +7,6 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// This module exports nothing.
} // namespace std
diff --git a/libcxx/modules/std/charconv.inc b/libcxx/modules/std/charconv.inc
index 6fee460108d65..f1a3f22d889d7 100644
--- a/libcxx/modules/std/charconv.inc
+++ b/libcxx/modules/std/charconv.inc
@@ -7,8 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
-
+_LIBCPP_MODULE_EXPORT namespace std {
// floating-point format for primitive numerical conversion
using std::chars_format;
diff --git a/libcxx/modules/std/chrono.inc b/libcxx/modules/std/chrono.inc
index 813322a1797f6..ba9d0eaf70ba5 100644
--- a/libcxx/modules/std/chrono.inc
+++ b/libcxx/modules/std/chrono.inc
@@ -7,8 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
-
+_LIBCPP_MODULE_EXPORT namespace std {
namespace chrono {
using std::chrono::duration;
using std::chrono::time_point;
@@ -292,7 +291,7 @@ export namespace std {
} // namespace chrono
} // namespace std
-export namespace std::inline literals::inline chrono_literals {
+_LIBCPP_MODULE_EXPORT namespace std::inline literals::inline chrono_literals {
// [time.duration.literals], suffixes for duration literals
using std::literals::chrono_literals::operator""h;
using std::literals::chrono_literals::operator""min;
diff --git a/libcxx/modules/std/cinttypes.inc b/libcxx/modules/std/cinttypes.inc
index b2b98c973e982..5c18fd5860e29 100644
--- a/libcxx/modules/std/cinttypes.inc
+++ b/libcxx/modules/std/cinttypes.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
using std::imaxdiv_t _LIBCPP_USING_IF_EXISTS;
using std::imaxabs _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/modules/std/climits.inc b/libcxx/modules/std/climits.inc
index 2ab8eb970e7a5..929fc550423cd 100644
--- a/libcxx/modules/std/climits.inc
+++ b/libcxx/modules/std/climits.inc
@@ -7,6 +7,6 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// This module exports nothing.
} // namespace std
diff --git a/libcxx/modules/std/clocale.inc b/libcxx/modules/std/clocale.inc
index 359868a61eb9d..25e27e0130416 100644
--- a/libcxx/modules/std/clocale.inc
+++ b/libcxx/modules/std/clocale.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
using std::lconv _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/modules/std/cmath.inc b/libcxx/modules/std/cmath.inc
index a463c1e3ccf86..e80b4683f2afc 100644
--- a/libcxx/modules/std/cmath.inc
+++ b/libcxx/modules/std/cmath.inc
@@ -7,8 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
-
+_LIBCPP_MODULE_EXPORT namespace std {
using std::double_t _LIBCPP_USING_IF_EXISTS;
using std::float_t _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/modules/std/codecvt.inc b/libcxx/modules/std/codecvt.inc
index 277ef046349a9..8f15668559a9f 100644
--- a/libcxx/modules/std/codecvt.inc
+++ b/libcxx/modules/std/codecvt.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
# if _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_CODECVT)
using std::codecvt_mode;
diff --git a/libcxx/modules/std/compare.inc b/libcxx/modules/std/compare.inc
index 9d002d301efc3..95aefd8352edb 100644
--- a/libcxx/modules/std/compare.inc
+++ b/libcxx/modules/std/compare.inc
@@ -7,8 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
-
+_LIBCPP_MODULE_EXPORT namespace std {
// [cmp.categories], comparison category types
using std::partial_ordering;
using std::strong_ordering;
diff --git a/libcxx/modules/std/complex.inc b/libcxx/modules/std/complex.inc
index 47a44420b127a..4a97e784d706b 100644
--- a/libcxx/modules/std/complex.inc
+++ b/libcxx/modules/std/complex.inc
@@ -7,8 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
-
+_LIBCPP_MODULE_EXPORT namespace std {
// [complex], class template complex
using std::complex;
diff --git a/libcxx/modules/std/concepts.inc b/libcxx/modules/std/concepts.inc
index 29f4e2788e9ab..e2b414a932078 100644
--- a/libcxx/modules/std/concepts.inc
+++ b/libcxx/modules/std/concepts.inc
@@ -7,8 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
-
+_LIBCPP_MODULE_EXPORT namespace std {
// [concepts.lang], language-related concepts
// [concept.same], concept same_as
using std::same_as;
diff --git a/libcxx/modules/std/condition_variable.inc b/libcxx/modules/std/condition_variable.inc
index b428918f90603..a0d90a9ab8fe4 100644
--- a/libcxx/modules/std/condition_variable.inc
+++ b/libcxx/modules/std/condition_variable.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_THREADS
// [thread.condition.condvar], class condition_variable
using std::condition_variable;
diff --git a/libcxx/modules/std/coroutine.inc b/libcxx/modules/std/coroutine.inc
index 5d992f29a1e2e..e6ccdc749a6a7 100644
--- a/libcxx/modules/std/coroutine.inc
+++ b/libcxx/modules/std/coroutine.inc
@@ -7,8 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
-
+_LIBCPP_MODULE_EXPORT namespace std {
// [coroutine.traits], coroutine traits
using std::coroutine_traits;
diff --git a/libcxx/modules/std/csetjmp.inc b/libcxx/modules/std/csetjmp.inc
index 8aa2e23292915..08c1e18852824 100644
--- a/libcxx/modules/std/csetjmp.inc
+++ b/libcxx/modules/std/csetjmp.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
using std::jmp_buf _LIBCPP_USING_IF_EXISTS;
using std::longjmp _LIBCPP_USING_IF_EXISTS;
} // namespace std
diff --git a/libcxx/modules/std/csignal.inc b/libcxx/modules/std/csignal.inc
index 05f3986866c7b..a574277a7b282 100644
--- a/libcxx/modules/std/csignal.inc
+++ b/libcxx/modules/std/csignal.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
using std::sig_atomic_t _LIBCPP_USING_IF_EXISTS;
// [support.signal], signal handlers
diff --git a/libcxx/modules/std/cstdarg.inc b/libcxx/modules/std/cstdarg.inc
index 5947bc2452b71..2821cb8b4ca18 100644
--- a/libcxx/modules/std/cstdarg.inc
+++ b/libcxx/modules/std/cstdarg.inc
@@ -7,6 +7,4 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
- using std::va_list _LIBCPP_USING_IF_EXISTS;
-} // namespace std
+_LIBCPP_MODULE_EXPORT namespace std { using std::va_list _LIBCPP_USING_IF_EXISTS; } // namespace std
diff --git a/libcxx/modules/std/cstddef.inc b/libcxx/modules/std/cstddef.inc
index 6443de8923823..d2713d102550b 100644
--- a/libcxx/modules/std/cstddef.inc
+++ b/libcxx/modules/std/cstddef.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
using std::max_align_t _LIBCPP_USING_IF_EXISTS;
using std::nullptr_t;
using std::ptrdiff_t _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/modules/std/cstdint.inc b/libcxx/modules/std/cstdint.inc
index f23b52a94526e..a8d5371f59969 100644
--- a/libcxx/modules/std/cstdint.inc
+++ b/libcxx/modules/std/cstdint.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// signed
using std::int8_t _LIBCPP_USING_IF_EXISTS;
using std::int16_t _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/modules/std/cstdio.inc b/libcxx/modules/std/cstdio.inc
index 62fa2f566a5f6..e07f717c040da 100644
--- a/libcxx/modules/std/cstdio.inc
+++ b/libcxx/modules/std/cstdio.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
using std::FILE _LIBCPP_USING_IF_EXISTS;
using std::fpos_t _LIBCPP_USING_IF_EXISTS;
using std::size_t _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/modules/std/cstdlib.inc b/libcxx/modules/std/cstdlib.inc
index 617cf3ff3ef6b..8527fe03dc82d 100644
--- a/libcxx/modules/std/cstdlib.inc
+++ b/libcxx/modules/std/cstdlib.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
using std::div_t _LIBCPP_USING_IF_EXISTS;
using std::ldiv_t _LIBCPP_USING_IF_EXISTS;
using std::lldiv_t _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/modules/std/cstring.inc b/libcxx/modules/std/cstring.inc
index 9ad33b982b32a..d10284dcdd2d4 100644
--- a/libcxx/modules/std/cstring.inc
+++ b/libcxx/modules/std/cstring.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
using std::size_t _LIBCPP_USING_IF_EXISTS;
using std::memchr _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/modules/std/ctime.inc b/libcxx/modules/std/ctime.inc
index 5bfa61917e5f2..993828a4591a8 100644
--- a/libcxx/modules/std/ctime.inc
+++ b/libcxx/modules/std/ctime.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
using std::clock_t _LIBCPP_USING_IF_EXISTS;
using std::size_t _LIBCPP_USING_IF_EXISTS;
using std::time_t _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/modules/std/cuchar.inc b/libcxx/modules/std/cuchar.inc
index fd80110d11ee8..979a4e68d28a4 100644
--- a/libcxx/modules/std/cuchar.inc
+++ b/libcxx/modules/std/cuchar.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_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.
diff --git a/libcxx/modules/std/cwchar.inc b/libcxx/modules/std/cwchar.inc
index 02b1713359b6a..7adc25fa4b907 100644
--- a/libcxx/modules/std/cwchar.inc
+++ b/libcxx/modules/std/cwchar.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using std::mbstate_t _LIBCPP_USING_IF_EXISTS;
using std::size_t _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/modules/std/cwctype.inc b/libcxx/modules/std/cwctype.inc
index 30e526aae0af6..9e2aa250c7bc8 100644
--- a/libcxx/modules/std/cwctype.inc
+++ b/libcxx/modules/std/cwctype.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using std::wctrans_t _LIBCPP_USING_IF_EXISTS;
using std::wctype_t _LIBCPP_USING_IF_EXISTS;
diff --git a/libcxx/modules/std/deque.inc b/libcxx/modules/std/deque.inc
index 5abf88816a98a..842fa4aea2f19 100644
--- a/libcxx/modules/std/deque.inc
+++ b/libcxx/modules/std/deque.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [deque], class template deque
using std::deque;
diff --git a/libcxx/modules/std/exception.inc b/libcxx/modules/std/exception.inc
index 8e802c7065e0f..77158097c777d 100644
--- a/libcxx/modules/std/exception.inc
+++ b/libcxx/modules/std/exception.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
using std::bad_exception;
using std::current_exception;
using std::exception;
diff --git a/libcxx/modules/std/execution.inc b/libcxx/modules/std/execution.inc
index 86c1cd7622b9b..4d318174f68bf 100644
--- a/libcxx/modules/std/execution.inc
+++ b/libcxx/modules/std/execution.inc
@@ -8,13 +8,13 @@
//===----------------------------------------------------------------------===//
#ifdef _LIBCPP_ENABLE_EXPERIMENTAL
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [execpol.type], execution policy type trait
using std::is_execution_policy;
using std::is_execution_policy_v;
} // namespace std
-export namespace std::execution {
+_LIBCPP_MODULE_EXPORT namespace std::execution {
// [execpol.seq], sequenced execution policy
using std::execution::sequenced_policy;
diff --git a/libcxx/modules/std/expected.inc b/libcxx/modules/std/expected.inc
index c21683cb90d63..e519d67d6902a 100644
--- a/libcxx/modules/std/expected.inc
+++ b/libcxx/modules/std/expected.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#if _LIBCPP_STD_VER >= 23
// [expected.unexpected], class template unexpected
using std::unexpected;
diff --git a/libcxx/modules/std/filesystem.inc b/libcxx/modules/std/filesystem.inc
index 3214b49fe8d82..d2c3414412735 100644
--- a/libcxx/modules/std/filesystem.inc
+++ b/libcxx/modules/std/filesystem.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std::filesystem {
+_LIBCPP_MODULE_EXPORT namespace std::filesystem {
// [fs.class.path], paths
using std::filesystem::path;
@@ -109,11 +109,9 @@ export namespace std::filesystem {
} // namespace std::filesystem
// [fs.path.hash], hash support
-export namespace std {
- using std::hash;
-}
+_LIBCPP_MODULE_EXPORT namespace std { using std::hash; }
-export namespace std::ranges {
+_LIBCPP_MODULE_EXPORT namespace std::ranges {
#ifndef _LIBCPP_HAS_NO_FILESYSTEM
using std::ranges::enable_borrowed_range;
using std::ranges::enable_view;
diff --git a/libcxx/modules/std/flat_map.inc b/libcxx/modules/std/flat_map.inc
index 83cd20ad61894..5758ecf9ea669 100644
--- a/libcxx/modules/std/flat_map.inc
+++ b/libcxx/modules/std/flat_map.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#if 0
// [flat.map], class template flat_map
using std::flat_map;
diff --git a/libcxx/modules/std/flat_set.inc b/libcxx/modules/std/flat_set.inc
index a86cc1eae02a6..1b4f004bdc00f 100644
--- a/libcxx/modules/std/flat_set.inc
+++ b/libcxx/modules/std/flat_set.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#if 0
// [flat.set], class template flat_set
using std::flat_set;
diff --git a/libcxx/modules/std/format.inc b/libcxx/modules/std/format.inc
index 743a43811005a..9c3a1a5dd9b8d 100644
--- a/libcxx/modules/std/format.inc
+++ b/libcxx/modules/std/format.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [format.context], class template basic_format_context
using std::basic_format_context;
using std::format_context;
diff --git a/libcxx/modules/std/forward_list.inc b/libcxx/modules/std/forward_list.inc
index c9585b5523b36..5fd970240f4dc 100644
--- a/libcxx/modules/std/forward_list.inc
+++ b/libcxx/modules/std/forward_list.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [forward.list], class template forward_list
using std::forward_list;
diff --git a/libcxx/modules/std/fstream.inc b/libcxx/modules/std/fstream.inc
index b0017949af540..27c27e82646ce 100644
--- a/libcxx/modules/std/fstream.inc
+++ b/libcxx/modules/std/fstream.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
using std::basic_filebuf;
diff --git a/libcxx/modules/std/functional.inc b/libcxx/modules/std/functional.inc
index ddc7d023ee6dc..0e2a27f31e688 100644
--- a/libcxx/modules/std/functional.inc
+++ b/libcxx/modules/std/functional.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [func.invoke], invoke
using std::invoke;
#if _LIBCPP_STD_VER >= 23
diff --git a/libcxx/modules/std/future.inc b/libcxx/modules/std/future.inc
index 2500ad1dee274..a186ca470be86 100644
--- a/libcxx/modules/std/future.inc
+++ b/libcxx/modules/std/future.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_THREADS
using std::future_errc;
using std::future_status;
diff --git a/libcxx/modules/std/generator.inc b/libcxx/modules/std/generator.inc
index 43fb0daf5c659..5ca3eb304d33c 100644
--- a/libcxx/modules/std/generator.inc
+++ b/libcxx/modules/std/generator.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#if 0
using std::generator;
#endif
diff --git a/libcxx/modules/std/hazard_pointer.inc b/libcxx/modules/std/hazard_pointer.inc
index e56f4d0bf4363..53381fbb55af5 100644
--- a/libcxx/modules/std/hazard_pointer.inc
+++ b/libcxx/modules/std/hazard_pointer.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#if 0
# if _LIBCPP_STD_VER >= 23
// 4.1.3, class template hazard_pointer_obj_base
diff --git a/libcxx/modules/std/initializer_list.inc b/libcxx/modules/std/initializer_list.inc
index 1dbeb220ca3c5..e22c2c728c307 100644
--- a/libcxx/modules/std/initializer_list.inc
+++ b/libcxx/modules/std/initializer_list.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
using std::initializer_list;
// [support.initlist.range], initializer list range access
diff --git a/libcxx/modules/std/iomanip.inc b/libcxx/modules/std/iomanip.inc
index 35a52efcd20b0..1ac3a59b5c2b1 100644
--- a/libcxx/modules/std/iomanip.inc
+++ b/libcxx/modules/std/iomanip.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
using std::get_money;
using std::get_time;
diff --git a/libcxx/modules/std/ios.inc b/libcxx/modules/std/ios.inc
index eeed5398c5a68..e6fed28da27a9 100644
--- a/libcxx/modules/std/ios.inc
+++ b/libcxx/modules/std/ios.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
using std::fpos;
// based on [tab:fpos.operations]
diff --git a/libcxx/modules/std/iosfwd.inc b/libcxx/modules/std/iosfwd.inc
index 090d990d061e5..b39937a67e5f2 100644
--- a/libcxx/modules/std/iosfwd.inc
+++ b/libcxx/modules/std/iosfwd.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
using std::streampos;
#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
using std::wstreampos;
diff --git a/libcxx/modules/std/iostream.inc b/libcxx/modules/std/iostream.inc
index d6e2036496057..62b71baabf105 100644
--- a/libcxx/modules/std/iostream.inc
+++ b/libcxx/modules/std/iostream.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
using std::cerr;
using std::cin;
diff --git a/libcxx/modules/std/istream.inc b/libcxx/modules/std/istream.inc
index fdb1854014036..9d868c3e4b43c 100644
--- a/libcxx/modules/std/istream.inc
+++ b/libcxx/modules/std/istream.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
using std::basic_istream;
diff --git a/libcxx/modules/std/iterator.inc b/libcxx/modules/std/iterator.inc
index 10c63d74e6e05..5c85b84d94bea 100644
--- a/libcxx/modules/std/iterator.inc
+++ b/libcxx/modules/std/iterator.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [iterator.assoc.types], associated types
// [incrementable.traits], incrementable traits
using std::incrementable_traits;
diff --git a/libcxx/modules/std/latch.inc b/libcxx/modules/std/latch.inc
index 922a55e038ec3..856f83b924110 100644
--- a/libcxx/modules/std/latch.inc
+++ b/libcxx/modules/std/latch.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_THREADS
using std::latch;
#endif // _LIBCPP_HAS_NO_THREADS
diff --git a/libcxx/modules/std/limits.inc b/libcxx/modules/std/limits.inc
index 9aae993baa6f7..c467732509e36 100644
--- a/libcxx/modules/std/limits.inc
+++ b/libcxx/modules/std/limits.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [fp.style], floating-point type properties
using std::float_denorm_style;
using std::float_round_style;
diff --git a/libcxx/modules/std/list.inc b/libcxx/modules/std/list.inc
index f38094c9b8a7c..7ef738f09a370 100644
--- a/libcxx/modules/std/list.inc
+++ b/libcxx/modules/std/list.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [list], class template list
using std::list;
diff --git a/libcxx/modules/std/locale.inc b/libcxx/modules/std/locale.inc
index 8975453864226..688a3b61f58c1 100644
--- a/libcxx/modules/std/locale.inc
+++ b/libcxx/modules/std/locale.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
// [locale], locale
using std::has_facet;
diff --git a/libcxx/modules/std/map.inc b/libcxx/modules/std/map.inc
index ed154e3e8c6fd..a9ebc9468afba 100644
--- a/libcxx/modules/std/map.inc
+++ b/libcxx/modules/std/map.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [map], class template map
using std::map;
diff --git a/libcxx/modules/std/mdspan.inc b/libcxx/modules/std/mdspan.inc
index ba3f3926c3abd..7f67231cd70a0 100644
--- a/libcxx/modules/std/mdspan.inc
+++ b/libcxx/modules/std/mdspan.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#if _LIBCPP_STD_VER >= 23
// [mdspan.extents], class template extents
using std::extents;
diff --git a/libcxx/modules/std/memory.inc b/libcxx/modules/std/memory.inc
index b23c27707afd6..139a46c8db730 100644
--- a/libcxx/modules/std/memory.inc
+++ b/libcxx/modules/std/memory.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [pointer.traits], pointer traits
using std::pointer_traits;
diff --git a/libcxx/modules/std/memory_resource.inc b/libcxx/modules/std/memory_resource.inc
index 740179baea273..e4b6478358b0e 100644
--- a/libcxx/modules/std/memory_resource.inc
+++ b/libcxx/modules/std/memory_resource.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std::pmr {
+_LIBCPP_MODULE_EXPORT namespace std::pmr {
// [mem.res.class], class memory_resource
using std::pmr::memory_resource;
diff --git a/libcxx/modules/std/mutex.inc b/libcxx/modules/std/mutex.inc
index 24c7f2e598a8b..f52dc429aaf14 100644
--- a/libcxx/modules/std/mutex.inc
+++ b/libcxx/modules/std/mutex.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_THREADS
// [thread.mutex.class], class mutex
using std::mutex;
diff --git a/libcxx/modules/std/new.inc b/libcxx/modules/std/new.inc
index 31c49057d0d28..2b4102751f632 100644
--- a/libcxx/modules/std/new.inc
+++ b/libcxx/modules/std/new.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [alloc.errors], storage allocation errors
using std::bad_alloc;
using std::bad_array_new_length;
@@ -34,9 +34,9 @@ export namespace std {
#endif
} // namespace std
-export {
+_LIBCPP_MODULE_EXPORT {
using ::operator new;
using ::operator delete;
using ::operator new[];
using ::operator delete[];
-} // export
+} // _LIBCPP_MODULE_EXPORT
diff --git a/libcxx/modules/std/numbers.inc b/libcxx/modules/std/numbers.inc
index 2f55f442b18dc..8bd362cecdbac 100644
--- a/libcxx/modules/std/numbers.inc
+++ b/libcxx/modules/std/numbers.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std::numbers {
+_LIBCPP_MODULE_EXPORT namespace std::numbers {
using std::numbers::e_v;
using std::numbers::egamma_v;
using std::numbers::inv_pi_v;
diff --git a/libcxx/modules/std/numeric.inc b/libcxx/modules/std/numeric.inc
index 3bc7b23168158..83189b19c6679 100644
--- a/libcxx/modules/std/numeric.inc
+++ b/libcxx/modules/std/numeric.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [accumulate], accumulate
using std::accumulate;
diff --git a/libcxx/modules/std/optional.inc b/libcxx/modules/std/optional.inc
index 0f812bc0e24a4..f7cc865fcfbd8 100644
--- a/libcxx/modules/std/optional.inc
+++ b/libcxx/modules/std/optional.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [optional.optional], class template optional
using std::optional;
diff --git a/libcxx/modules/std/ostream.inc b/libcxx/modules/std/ostream.inc
index 0e0e2d54fe6ba..6b75579639d22 100644
--- a/libcxx/modules/std/ostream.inc
+++ b/libcxx/modules/std/ostream.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
using std::basic_ostream;
diff --git a/libcxx/modules/std/print.inc b/libcxx/modules/std/print.inc
index 1ca52c7006887..2578c304428db 100644
--- a/libcxx/modules/std/print.inc
+++ b/libcxx/modules/std/print.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#if _LIBCPP_STD_VER >= 23
// [print.fun], print functions
using std::print;
diff --git a/libcxx/modules/std/queue.inc b/libcxx/modules/std/queue.inc
index d2fb18709c709..99c4f678b6498 100644
--- a/libcxx/modules/std/queue.inc
+++ b/libcxx/modules/std/queue.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [queue], class template queue
using std::queue;
diff --git a/libcxx/modules/std/random.inc b/libcxx/modules/std/random.inc
index 0b003fdd8902e..65ea4a81782dd 100644
--- a/libcxx/modules/std/random.inc
+++ b/libcxx/modules/std/random.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [rand.req.urng], uniform random bit generator requirements
using std::uniform_random_bit_generator;
diff --git a/libcxx/modules/std/ranges.inc b/libcxx/modules/std/ranges.inc
index f71efe948ede1..e39798431dfa5 100644
--- a/libcxx/modules/std/ranges.inc
+++ b/libcxx/modules/std/ranges.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
namespace ranges {
inline namespace __cpo {
// [range.access], range access
diff --git a/libcxx/modules/std/ratio.inc b/libcxx/modules/std/ratio.inc
index 4e1d4c61e7072..dfa3e1984a8b7 100644
--- a/libcxx/modules/std/ratio.inc
+++ b/libcxx/modules/std/ratio.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [ratio.ratio], class template ratio
using std::ratio;
diff --git a/libcxx/modules/std/rcu.inc b/libcxx/modules/std/rcu.inc
index abf5afad30c13..25c54f733641c 100644
--- a/libcxx/modules/std/rcu.inc
+++ b/libcxx/modules/std/rcu.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#if 0
# if _LIBCPP_STD_VER >= 23
// 2.2.3, class template rcu_obj_base using std::rcu_obj_base;
diff --git a/libcxx/modules/std/regex.inc b/libcxx/modules/std/regex.inc
index 8217e34bc22c8..1e7c147fadc5a 100644
--- a/libcxx/modules/std/regex.inc
+++ b/libcxx/modules/std/regex.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
// [re.const], regex constants
namespace regex_constants {
diff --git a/libcxx/modules/std/scoped_allocator.inc b/libcxx/modules/std/scoped_allocator.inc
index 91c9694db28f9..86c972fd3a11e 100644
--- a/libcxx/modules/std/scoped_allocator.inc
+++ b/libcxx/modules/std/scoped_allocator.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// class template scoped_allocator_adaptor
using std::scoped_allocator_adaptor;
diff --git a/libcxx/modules/std/semaphore.inc b/libcxx/modules/std/semaphore.inc
index a8c8a1b6018e1..1526effdc3742 100644
--- a/libcxx/modules/std/semaphore.inc
+++ b/libcxx/modules/std/semaphore.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_THREADS
// [thread.sema.cnt], class template counting_semaphore
using std::counting_semaphore;
diff --git a/libcxx/modules/std/set.inc b/libcxx/modules/std/set.inc
index a8db792b4b381..bf2a1df6396b2 100644
--- a/libcxx/modules/std/set.inc
+++ b/libcxx/modules/std/set.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [set], class template set
using std::set;
diff --git a/libcxx/modules/std/shared_mutex.inc b/libcxx/modules/std/shared_mutex.inc
index 5f09446e38bc7..6f6720f5de751 100644
--- a/libcxx/modules/std/shared_mutex.inc
+++ b/libcxx/modules/std/shared_mutex.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_THREADS
// [thread.sharedmutex.class], class shared_mutex
using std::shared_mutex;
diff --git a/libcxx/modules/std/source_location.inc b/libcxx/modules/std/source_location.inc
index 750ab164a38de..f9262fa15990f 100644
--- a/libcxx/modules/std/source_location.inc
+++ b/libcxx/modules/std/source_location.inc
@@ -7,6 +7,4 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
- using std::source_location;
-} // namespace std
+_LIBCPP_MODULE_EXPORT namespace std { using std::source_location; } // namespace std
diff --git a/libcxx/modules/std/span.inc b/libcxx/modules/std/span.inc
index 184591c6b170d..c7a4901494400 100644
--- a/libcxx/modules/std/span.inc
+++ b/libcxx/modules/std/span.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// constants
using std::dynamic_extent;
diff --git a/libcxx/modules/std/spanstream.inc b/libcxx/modules/std/spanstream.inc
index e6383a185e079..fc98ab31397c1 100644
--- a/libcxx/modules/std/spanstream.inc
+++ b/libcxx/modules/std/spanstream.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#if 0
using std::basic_spanbuf;
diff --git a/libcxx/modules/std/sstream.inc b/libcxx/modules/std/sstream.inc
index 2218001290d0f..bc5b29f885239 100644
--- a/libcxx/modules/std/sstream.inc
+++ b/libcxx/modules/std/sstream.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
using std::basic_stringbuf;
diff --git a/libcxx/modules/std/stack.inc b/libcxx/modules/std/stack.inc
index 3f736ff0e8410..8fb4a631f397c 100644
--- a/libcxx/modules/std/stack.inc
+++ b/libcxx/modules/std/stack.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [stack], class template stack
using std::stack;
diff --git a/libcxx/modules/std/stacktrace.inc b/libcxx/modules/std/stacktrace.inc
index c1184087c0df4..03ed2d09c46b0 100644
--- a/libcxx/modules/std/stacktrace.inc
+++ b/libcxx/modules/std/stacktrace.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#if 0
// [stacktrace.entry], class stacktrace_entry
using std::stacktrace_entry;
diff --git a/libcxx/modules/std/stdexcept.inc b/libcxx/modules/std/stdexcept.inc
index 15d37bafdba95..e5c8e00131a2c 100644
--- a/libcxx/modules/std/stdexcept.inc
+++ b/libcxx/modules/std/stdexcept.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
using std::domain_error;
using std::invalid_argument;
using std::length_error;
diff --git a/libcxx/modules/std/stdfloat.inc b/libcxx/modules/std/stdfloat.inc
index 7e7201a854154..81a42eca190c6 100644
--- a/libcxx/modules/std/stdfloat.inc
+++ b/libcxx/modules/std/stdfloat.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#if defined(__STDCPP_FLOAT16_T__)
using std::float16_t;
#endif
diff --git a/libcxx/modules/std/stop_token.inc b/libcxx/modules/std/stop_token.inc
index ad2401747d61c..548ac7181f666 100644
--- a/libcxx/modules/std/stop_token.inc
+++ b/libcxx/modules/std/stop_token.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_THREADS
# ifdef _LIBCPP_ENABLE_EXPERIMENTAL
// [stoptoken], class stop_token
diff --git a/libcxx/modules/std/streambuf.inc b/libcxx/modules/std/streambuf.inc
index 32914cfe53687..9abb05967aac2 100644
--- a/libcxx/modules/std/streambuf.inc
+++ b/libcxx/modules/std/streambuf.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
using std::basic_streambuf;
using std::streambuf;
diff --git a/libcxx/modules/std/string.inc b/libcxx/modules/std/string.inc
index 9808a96215a18..a162f2c5ceed5 100644
--- a/libcxx/modules/std/string.inc
+++ b/libcxx/modules/std/string.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [char.traits], character traits
using std::char_traits;
diff --git a/libcxx/modules/std/string_view.inc b/libcxx/modules/std/string_view.inc
index f4f9d80ddb83d..0a7ef7bd0c2c3 100644
--- a/libcxx/modules/std/string_view.inc
+++ b/libcxx/modules/std/string_view.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [string.view.template], class template basic_string_view
using std::basic_string_view;
diff --git a/libcxx/modules/std/strstream.inc b/libcxx/modules/std/strstream.inc
index 808796701abae..7722799bbf057 100644
--- a/libcxx/modules/std/strstream.inc
+++ b/libcxx/modules/std/strstream.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_LOCALIZATION
# if _LIBCPP_STD_VER < 26 || defined(_LIBCPP_ENABLE_CXX26_REMOVED_STRSTREAM)
using std::istrstream;
diff --git a/libcxx/modules/std/syncstream.inc b/libcxx/modules/std/syncstream.inc
index e3fb391b67c63..e2f645f65e7d7 100644
--- a/libcxx/modules/std/syncstream.inc
+++ b/libcxx/modules/std/syncstream.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION) && !defined(_LIBCPP_HAS_NO_EXPERIMENTAL_SYNCSTREAM)
using std::basic_syncbuf;
diff --git a/libcxx/modules/std/system_error.inc b/libcxx/modules/std/system_error.inc
index cf553a5ee4a18..331f71d813c93 100644
--- a/libcxx/modules/std/system_error.inc
+++ b/libcxx/modules/std/system_error.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
using std::error_category;
using std::generic_category;
using std::system_category;
diff --git a/libcxx/modules/std/text_encoding.inc b/libcxx/modules/std/text_encoding.inc
index 6d5e3f1d68c60..58ec258989b8f 100644
--- a/libcxx/modules/std/text_encoding.inc
+++ b/libcxx/modules/std/text_encoding.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#if 0
# if _LIBCPP_STD_VER >= 23
using std::text_encoding;
diff --git a/libcxx/modules/std/thread.inc b/libcxx/modules/std/thread.inc
index 6504a39a7aeae..9ea979a0bb0c2 100644
--- a/libcxx/modules/std/thread.inc
+++ b/libcxx/modules/std/thread.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
#ifndef _LIBCPP_HAS_NO_THREADS
// [thread.thread.class], class thread
using std::thread;
diff --git a/libcxx/modules/std/tuple.inc b/libcxx/modules/std/tuple.inc
index 706e2266c174b..1bd909d9d8c4d 100644
--- a/libcxx/modules/std/tuple.inc
+++ b/libcxx/modules/std/tuple.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [tuple.tuple], class template tuple
using std::tuple;
diff --git a/libcxx/modules/std/type_traits.inc b/libcxx/modules/std/type_traits.inc
index d368daf35ccb8..8ccfd40d64c24 100644
--- a/libcxx/modules/std/type_traits.inc
+++ b/libcxx/modules/std/type_traits.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [meta.help], helper class
using std::integral_constant;
diff --git a/libcxx/modules/std/typeindex.inc b/libcxx/modules/std/typeindex.inc
index 0fdcd8fb440f1..3019a9508a643 100644
--- a/libcxx/modules/std/typeindex.inc
+++ b/libcxx/modules/std/typeindex.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
using std::hash;
using std::type_index;
} // namespace std
diff --git a/libcxx/modules/std/typeinfo.inc b/libcxx/modules/std/typeinfo.inc
index ee1273baf4896..949afaebb5c29 100644
--- a/libcxx/modules/std/typeinfo.inc
+++ b/libcxx/modules/std/typeinfo.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
using std::bad_cast;
using std::bad_typeid;
using std::type_info;
diff --git a/libcxx/modules/std/unordered_map.inc b/libcxx/modules/std/unordered_map.inc
index eff62f30540a7..0f31935633e9a 100644
--- a/libcxx/modules/std/unordered_map.inc
+++ b/libcxx/modules/std/unordered_map.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [unord.map], class template unordered_map
using std::unordered_map;
diff --git a/libcxx/modules/std/unordered_set.inc b/libcxx/modules/std/unordered_set.inc
index c214e3420434b..58d6d6a321b18 100644
--- a/libcxx/modules/std/unordered_set.inc
+++ b/libcxx/modules/std/unordered_set.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [unord.set], class template unordered_set
using std::unordered_set;
diff --git a/libcxx/modules/std/utility.inc b/libcxx/modules/std/utility.inc
index 77c21b87640dd..9ce1957ef5c15 100644
--- a/libcxx/modules/std/utility.inc
+++ b/libcxx/modules/std/utility.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [utility.swap], swap
using std::swap;
diff --git a/libcxx/modules/std/valarray.inc b/libcxx/modules/std/valarray.inc
index 1cdf7f14060fb..6be0915d860b8 100644
--- a/libcxx/modules/std/valarray.inc
+++ b/libcxx/modules/std/valarray.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
using std::gslice;
using std::gslice_array;
using std::indirect_array;
diff --git a/libcxx/modules/std/variant.inc b/libcxx/modules/std/variant.inc
index 6fcecddbedaf5..7583ffce882d0 100644
--- a/libcxx/modules/std/variant.inc
+++ b/libcxx/modules/std/variant.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [variant.variant], class template variant
using std::variant;
diff --git a/libcxx/modules/std/vector.inc b/libcxx/modules/std/vector.inc
index 7168ec2bb7035..91063eb8d27c7 100644
--- a/libcxx/modules/std/vector.inc
+++ b/libcxx/modules/std/vector.inc
@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// [vector], class template vector
using std::vector;
diff --git a/libcxx/modules/std/version.inc b/libcxx/modules/std/version.inc
index 2ab8eb970e7a5..929fc550423cd 100644
--- a/libcxx/modules/std/version.inc
+++ b/libcxx/modules/std/version.inc
@@ -7,6 +7,6 @@
//
//===----------------------------------------------------------------------===//
-export namespace std {
+_LIBCPP_MODULE_EXPORT namespace std {
// This module exports nothing.
} // namespace std
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 0a48f855fba06..a4fbcc1af49a6 100644
--- a/libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp
+++ b/libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp
@@ -261,10 +261,17 @@ void header_exportable_declarations::check(const clang::ast_matchers::MatchFinde
return;
// For modules only take the declarations exported.
- if (is_module(file_type_))
+ if (is_module(file_type_)) {
if (decl->getModuleOwnershipKind() != clang::Decl::ModuleOwnershipKind::VisibleWhenImported)
return;
+ // The named declarations included in the global module fragment are
+ // attached to the global module. The exported named declarations should
+ // also be attached to the global module.
+ if (!decl->getOwningModule()->isGlobalModule())
+ return;
+ }
+
if (!is_valid_declaration_context(*decl, name, file_type_))
return;
diff --git a/libcxx/utils/libcxx/test/modules.py b/libcxx/utils/libcxx/test/modules.py
index aab7651c7bb03..fc78766aaa56e 100644
--- a/libcxx/utils/libcxx/test/modules.py
+++ b/libcxx/utils/libcxx/test/modules.py
@@ -118,6 +118,9 @@ def write_lit_configuration(self):
// The GCC compiler flags are not always compatible with clang-tidy.
// UNSUPPORTED: gcc
+// Clang 17 does not attach the declarations to the global module.
+// UNSUPPORTED: clang-17
+
// MODULE_DEPENDENCIES: {self.module}
// RUN: echo -n > {self.tmp_prefix}.all_partitions
More information about the libcxx-commits
mailing list