aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>2023-02-24 16:41:52 +0800
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>2023-03-03 14:25:33 +0800
commit57833636816a13ccda53714413c532dc81e3b5ff (patch)
tree4b66de65267ad029ccb73c00d2804c9ed3f70d13
parentfe758254181a824d73ad960b651b42f671f8936b (diff)
downloadllvm-57833636816a13ccda53714413c532dc81e3b5ff.zip
llvm-57833636816a13ccda53714413c532dc81e3b5ff.tar.gz
llvm-57833636816a13ccda53714413c532dc81e3b5ff.tar.bz2
[C++20] [Modules] Deprecate to load C++20 Modules eagerly
Close https://github.com/llvm/llvm-project/issues/60824 The form -fmodule-file=<path-to-BMI> will load modules eagerly and the form -fmodule-file=<module-name>=<path-to-BMI> will load modules lazily. The inconsistency adds many additional burdens to the implementations. And the inconsistency looks not helpful and necessary neither. So I want to deprecate the form -fmodule-file=<path-to-BMI> for named modules. This is pretty helpful for us (the developers). Does this change make any regression from the perspective of the users? To be honest, yes. But I think such regression is acceptable. Here is the example: ``` // M.cppm export module M; export int m = 5; // N.cpp // import M; // woops, we forgot to import M. int n = m; ``` In the original version, the compiler can diagnose the users to import `M` since the compiler have already imported M. But in the later style, the compiler can only say "unknown identifier `m`". But I think such regression doesn't make a deal since it only works if the user put `-fmodule-file=M.pcm` in the command line. But how can the user put `-fmodule-file=M.pcm` in the command line without `import M;`? Especially currently such options are generated by build systems. And the build systems will only generate the command line from the source file. So I think this change is pretty pretty helpful for developers and almost innocent for users and we should accept this one. I'll add the release notes and edit the document after we land this. Differential Revision: https://reviews.llvm.org/D144707
-rw-r--r--clang/include/clang/Basic/DiagnosticSerializationKinds.td5
-rw-r--r--clang/lib/Serialization/ASTReader.cpp6
-rw-r--r--clang/test/CXX/basic/basic.link/p10-ex2.cpp2
-rw-r--r--clang/test/CXX/basic/basic.link/p2.cpp2
-rw-r--r--clang/test/CXX/basic/basic.lookup/basic.lookup.argdep/p5-ex2.cpp6
-rw-r--r--clang/test/CXX/basic/basic.scope/basic.scope.namespace/p2.cpp19
-rw-r--r--clang/test/CXX/module/basic/basic.def.odr/p6.cppm18
-rw-r--r--clang/test/CXX/module/basic/basic.link/module-declaration.cpp31
-rw-r--r--clang/test/CXX/module/basic/basic.link/p2.cppm4
-rw-r--r--clang/test/CXX/module/basic/basic.search/module-import.cppm9
-rw-r--r--clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.import/p1.cppm13
-rw-r--r--clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.interface/p1.cppm2
-rw-r--r--clang/test/CXX/module/dcl.dcl/dcl.module/p1.cpp6
-rw-r--r--clang/test/CXX/module/dcl.dcl/dcl.module/p5.cpp6
-rw-r--r--clang/test/CXX/module/module.context/p7.cpp6
-rw-r--r--clang/test/CXX/module/module.interface/p1.cpp2
-rw-r--r--clang/test/CXX/module/module.interface/p2.cpp6
-rw-r--r--clang/test/CXX/module/module.unit/p8.cpp19
-rw-r--r--clang/test/Modules/cxx20-10-1-ex2.cpp10
-rw-r--r--clang/test/Modules/cxx20-10-2-ex2.cpp2
-rw-r--r--clang/test/Modules/cxx20-10-2-ex5.cpp4
-rw-r--r--clang/test/Modules/cxx20-10-3-ex1.cpp4
-rw-r--r--clang/test/Modules/cxx20-10-3-ex2.cpp2
-rw-r--r--clang/test/Modules/cxx20-10-5-ex1.cpp2
-rw-r--r--clang/test/Modules/cxx20-import-diagnostics-a.cpp16
-rw-r--r--clang/test/Modules/cxx20-import-diagnostics-b.cpp10
-rw-r--r--clang/test/Modules/eagerly-load-cxx-named-modules.cppm24
-rw-r--r--clang/test/Modules/named-modules-adl-2.cppm4
-rw-r--r--clang/test/Modules/named-modules-adl.cppm2
-rw-r--r--clang/test/Modules/pr60036.cppm10
-rw-r--r--clang/test/SemaCXX/modules.cppm30
31 files changed, 141 insertions, 141 deletions
diff --git a/clang/include/clang/Basic/DiagnosticSerializationKinds.td b/clang/include/clang/Basic/DiagnosticSerializationKinds.td
index f515ea0..30ee291 100644
--- a/clang/include/clang/Basic/DiagnosticSerializationKinds.td
+++ b/clang/include/clang/Basic/DiagnosticSerializationKinds.td
@@ -127,6 +127,11 @@ def warn_module_system_bit_conflict : Warning<
"module file '%0' was validated as a system module and is now being imported "
"as a non-system module; any difference in diagnostic options will be ignored">,
InGroup<ModuleConflict>;
+
+def warn_eagerly_load_for_standard_cplusplus_modules : Warning<
+ "the form '-fmodule-file=<BMI-path>' is deprecated for standard C++ named modules;"
+ "consider to use '-fmodule-file=<module-name>=<BMI-path>' instead">,
+ InGroup<DiagGroup<"eager-load-cxx-named-modules">>;
} // let CategoryName
let CategoryName = "AST Serialization Issue" in {
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 5587237..96ca312 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -5644,6 +5644,12 @@ llvm::Error ASTReader::ReadSubmoduleBlock(ModuleFile &F,
if (DeserializationListener)
DeserializationListener->ModuleRead(GlobalID, CurrentModule);
+ // If we're loading a module before we initialize the sema, it implies
+ // we're performing eagerly loading.
+ if (!getSema() && CurrentModule->isModulePurview() &&
+ !getContext().getLangOpts().isCompilingModule())
+ Diag(clang::diag::warn_eagerly_load_for_standard_cplusplus_modules);
+
SubmodulesLoaded[GlobalIndex] = CurrentModule;
// Clear out data that will be replaced by what is in the module file.
diff --git a/clang/test/CXX/basic/basic.link/p10-ex2.cpp b/clang/test/CXX/basic/basic.link/p10-ex2.cpp
index 322785e..95fdb56 100644
--- a/clang/test/CXX/basic/basic.link/p10-ex2.cpp
+++ b/clang/test/CXX/basic/basic.link/p10-ex2.cpp
@@ -5,7 +5,7 @@
//
// RUN: %clang_cc1 -std=c++20 M.cpp -fsyntax-only -DTEST_INTERFACE -verify
// RUN: %clang_cc1 -std=c++20 M.cpp -emit-module-interface -o M.pcm
-// RUN: %clang_cc1 -std=c++20 useM.cpp -fsyntax-only -fmodule-file=M.pcm -verify
+// RUN: %clang_cc1 -std=c++20 useM.cpp -fsyntax-only -fmodule-file=M=M.pcm -verify
//--- decls.h
int f(); // #1, attached to the global module
diff --git a/clang/test/CXX/basic/basic.link/p2.cpp b/clang/test/CXX/basic/basic.link/p2.cpp
index 54e347c..ccad420 100644
--- a/clang/test/CXX/basic/basic.link/p2.cpp
+++ b/clang/test/CXX/basic/basic.link/p2.cpp
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -std=c++2a -DEXPORT %s -verify
// RUN: %clang_cc1 -std=c++2a -DEXPORT %s -emit-module-interface -o %t.pcm
-// RUN: %clang_cc1 -std=c++2a -UEXPORT %s -verify -fmodule-file=%t.pcm
+// RUN: %clang_cc1 -std=c++2a -UEXPORT %s -verify -fmodule-file=M=%t.pcm
#ifdef EXPORT
// expected-no-diagnostics
diff --git a/clang/test/CXX/basic/basic.lookup/basic.lookup.argdep/p5-ex2.cpp b/clang/test/CXX/basic/basic.lookup/basic.lookup.argdep/p5-ex2.cpp
index 05044d1..8c3004f 100644
--- a/clang/test/CXX/basic/basic.lookup/basic.lookup.argdep/p5-ex2.cpp
+++ b/clang/test/CXX/basic/basic.lookup/basic.lookup.argdep/p5-ex2.cpp
@@ -5,10 +5,10 @@
//
// RUN: %clang_cc1 -std=c++20 M.cpp -emit-module-interface -o M.pcm
// RUN: %clang_cc1 -std=c++20 N.cpp -emit-module-interface -o N.pcm \
-// RUN: -fmodule-file=M.pcm
+// RUN: -fmodule-file=M=M.pcm
// RUN: %clang_cc1 -std=c++20 Q.cpp -emit-module-interface -o Q.pcm
-// RUN: %clang_cc1 -std=c++20 Q-impl.cpp -fsyntax-only -fmodule-file=Q.pcm \
-// RUN: -fmodule-file=N.pcm -verify
+// RUN: %clang_cc1 -std=c++20 Q-impl.cpp -fsyntax-only -fmodule-file=Q=Q.pcm \
+// RUN: -fmodule-file=N=N.pcm -verify
//--- M.cpp
export module M;
diff --git a/clang/test/CXX/basic/basic.scope/basic.scope.namespace/p2.cpp b/clang/test/CXX/basic/basic.scope/basic.scope.namespace/p2.cpp
index d4b425b..d69db40 100644
--- a/clang/test/CXX/basic/basic.scope/basic.scope.namespace/p2.cpp
+++ b/clang/test/CXX/basic/basic.scope/basic.scope.namespace/p2.cpp
@@ -5,8 +5,8 @@
// RUN: echo 'extern int in_header;' >> %t/foo.h
// RUN: echo '#endif' >> %t/foo.h
// RUN: %clang_cc1 -std=c++2a -I%t -emit-module-interface -DINTERFACE %s -o %t.pcm
-// RUN: %clang_cc1 -std=c++2a -I%t -fmodule-file=%t.pcm -DIMPLEMENTATION %s -verify -fno-modules-error-recovery
-// RUN: %clang_cc1 -std=c++2a -I%t -fmodule-file=%t.pcm %s -verify -fno-modules-error-recovery
+// RUN: %clang_cc1 -std=c++2a -I%t -fmodule-file=A=%t.pcm -DIMPLEMENTATION %s -verify -fno-modules-error-recovery
+// RUN: %clang_cc1 -std=c++2a -I%t -fmodule-file=A=%t.pcm %s -verify -fno-modules-error-recovery
#ifdef INTERFACE
module;
@@ -29,21 +29,17 @@ module;
#endif
void test_early() {
- in_header = 1; // expected-error {{missing '#include "foo.h"'; 'in_header' must be declared before it is used}}
+ in_header = 1; // expected-error {{use of undeclared identifier 'in_header'}}
// expected-note@* {{not visible}}
- global_module_fragment = 1; // expected-error {{missing '#include'; 'global_module_fragment' must be declared before it is used}}
- // expected-note@p2.cpp:16 {{not visible}}
+ global_module_fragment = 1; // expected-error {{use of undeclared identifier 'global_module_fragment'}}
- exported = 1; // expected-error {{must be imported from module 'A'}}
- // expected-note@p2.cpp:18 {{declaration here is not visible}}
+ exported = 1; // expected-error {{use of undeclared identifier 'exported'}}
- not_exported = 1; // expected-error {{declaration of 'not_exported' must be imported from module 'A' before it is required}}
- // expected-note@p2.cpp:19 {{declaration here is not visible}}
+ not_exported = 1; // expected-error {{use of undeclared identifier 'not_exported'}}
// FIXME: We need better diagnostic message for static variable.
- internal = 1; // expected-error {{declaration of 'internal' must be imported from module 'A' before it is required}}
- // expected-note@p2.cpp:20 {{declaration here is not visible}}
+ internal = 1; // expected-error {{use of undeclared identifier 'internal'}}
not_exported_private = 1; // expected-error {{undeclared identifier}}
@@ -61,7 +57,6 @@ void test_late() {
// expected-note@* {{not visible}}
global_module_fragment = 1; // expected-error {{missing '#include'; 'global_module_fragment' must be declared before it is used}}
- // expected-note@p2.cpp:16 {{not visible}}
exported = 1;
diff --git a/clang/test/CXX/module/basic/basic.def.odr/p6.cppm b/clang/test/CXX/module/basic/basic.def.odr/p6.cppm
index ae9a55a..d84c05c 100644
--- a/clang/test/CXX/module/basic/basic.def.odr/p6.cppm
+++ b/clang/test/CXX/module/basic/basic.def.odr/p6.cppm
@@ -7,23 +7,23 @@
// RUN: %clang_cc1 -std=c++20 -verify %t/global-vs-module.cppm -DUSING
//
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/global-vs-module.cppm -o %t/M.pcm -DNO_GLOBAL -DEXPORT
-// RUN: %clang_cc1 -std=c++20 -verify %t/module-vs-global.cpp -fmodule-file=%t/M.pcm
+// RUN: %clang_cc1 -std=c++20 -verify %t/module-vs-global.cpp -fmodule-file=M=%t/M.pcm
//
// Some of the following tests intentionally have no -verify in their RUN
// lines; we are testing that those cases do not produce errors.
//
-// RUN: %clang_cc1 -std=c++20 %t/module-vs-module.cpp -fmodule-file=%t/M.pcm -DMODULE_INTERFACE -verify
-// RUN: %clang_cc1 -std=c++20 %t/module-vs-module.cpp -fmodule-file=%t/M.pcm -DMODULE_INTERFACE -DNO_IMPORT
+// RUN: %clang_cc1 -std=c++20 %t/module-vs-module.cpp -fmodule-file=M=%t/M.pcm -DMODULE_INTERFACE -verify
+// RUN: %clang_cc1 -std=c++20 %t/module-vs-module.cpp -fmodule-file=M=%t/M.pcm -DMODULE_INTERFACE -DNO_IMPORT
//
-// RUN: %clang_cc1 -std=c++20 %t/module-vs-module.cpp -fmodule-file=%t/M.pcm -emit-module-interface -o %t/N.pcm -DMODULE_INTERFACE -DNO_ERRORS
-// RUN: %clang_cc1 -std=c++20 %t/module-vs-module.cpp -fmodule-file=%t/N.pcm -verify
+// RUN: %clang_cc1 -std=c++20 %t/module-vs-module.cpp -fmodule-file=M=%t/M.pcm -emit-module-interface -o %t/N.pcm -DMODULE_INTERFACE -DNO_ERRORS
+// RUN: %clang_cc1 -std=c++20 %t/module-vs-module.cpp -fmodule-file=M=%t/M.pcm -fmodule-file=N=%t/N.pcm -verify
// FIXME: Once we start importing "import" declarations properly, this should
// be rejected (-verify should be added to the following line).
-// RUN: %clang_cc1 -std=c++20 %t/module-vs-module.cpp -fmodule-file=%t/N.pcm -DNO_IMPORT
+// RUN: %clang_cc1 -std=c++20 %t/module-vs-module.cpp -fmodule-file=M=%t/M.pcm -fmodule-file=N=%t/N.pcm -DNO_IMPORT
//
-// RUN: %clang_cc1 -std=c++20 %t/module-vs-module.cpp -fmodule-file=%t/M.pcm -emit-module-interface -o %t/N-no-M.pcm -DMODULE_INTERFACE -DNO_ERRORS -DNO_IMPORT
-// RUN: %clang_cc1 -std=c++20 %t/module-vs-module.cpp -fmodule-file=%t/N-no-M.pcm -verify
-// RUN: %clang_cc1 -std=c++20 %t/module-vs-module.cpp -fmodule-file=%t/N-no-M.pcm -DNO_IMPORT
+// RUN: %clang_cc1 -std=c++20 %t/module-vs-module.cpp -fmodule-file=M=%t/M.pcm -emit-module-interface -o %t/N-no-M.pcm -DMODULE_INTERFACE -DNO_ERRORS -DNO_IMPORT
+// RUN: %clang_cc1 -std=c++20 %t/module-vs-module.cpp -fmodule-file=M=%t/M.pcm -fmodule-file=N=%t/N-no-M.pcm -verify
+// RUN: %clang_cc1 -std=c++20 %t/module-vs-module.cpp -fmodule-file=N=%t/N-no-M.pcm -DNO_IMPORT
//--- global-vs-module.cppm
#ifndef NO_GLOBAL
diff --git a/clang/test/CXX/module/basic/basic.link/module-declaration.cpp b/clang/test/CXX/module/basic/basic.link/module-declaration.cpp
index 81b6a98..d71358cc 100644
--- a/clang/test/CXX/module/basic/basic.link/module-declaration.cpp
+++ b/clang/test/CXX/module/basic/basic.link/module-declaration.cpp
@@ -5,29 +5,29 @@
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/x.cppm -o %t/x.pcm
-// RUN: %clang_cc1 -std=c++20 -emit-module-interface -fmodule-file=%t/x.pcm %t/x.y.cppm -o %t/x.y.pcm
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface -fmodule-file=x=%t/x.pcm %t/x.y.cppm -o %t/x.y.pcm
//
// Module implementation for unknown and known module. (The former is ill-formed.)
-// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=%t/x.y.pcm -verify -x c++ %t/M.cpp \
+// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=x.y=%t/x.y.pcm -verify -x c++ %t/M.cpp \
// RUN: -DTEST=1 -DEXPORT= -DMODULE_NAME=z
-// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=%t/x.y.pcm -verify -x c++ %t/M.cpp \
+// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=x=%t/x.pcm -fmodule-file=x.y=%t/x.y.pcm -verify -x c++ %t/M.cpp \
// RUN: -DTEST=2 -DEXPORT= -DMODULE_NAME=x
//
// Module interface for unknown and known module. (The latter is ill-formed due to
// redefinition.)
-// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=%t/x.y.pcm -verify %t/M.cpp \
+// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=x.y=%t/x.y.pcm -verify %t/M.cpp \
// RUN: -DTEST=3 -DEXPORT=export -DMODULE_NAME=z
-// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=%t/x.y.pcm -verify %t/M.cpp \
+// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=x.y=%t/x.y.pcm -verify %t/M.cpp \
// RUN: -DTEST=4 -DEXPORT=export -DMODULE_NAME=x
//
// Miscellaneous syntax.
-// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=%t/x.y.pcm -verify %t/M.cpp \
+// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=x.y=%t/x.y.pcm -verify %t/M.cpp \
// RUN: -DTEST=7 -DEXPORT=export -DMODULE_NAME='z elderberry'
-// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=%t/x.y.pcm -verify %t/M.cpp \
+// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=x.y=%t/x.y.pcm -verify %t/M.cpp \
// RUN: -DTEST=8 -DEXPORT=export -DMODULE_NAME='z [[]]'
-// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=%t/x.y.pcm -verify %t/M.cpp \
+// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=x.y=%t/x.y.pcm -verify %t/M.cpp \
// RUN: -DTEST=9 -DEXPORT=export -DMODULE_NAME='z [[fancy]]'
-// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=%t/x.y.pcm -verify %t/M.cpp \
+// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=x.y=%t/x.y.pcm -verify %t/M.cpp \
// RUN: -DTEST=10 -DEXPORT=export -DMODULE_NAME='z [[maybe_unused]]'
//--- x.cppm
@@ -41,17 +41,14 @@ int c;
//--- M.cpp
EXPORT module MODULE_NAME;
-#if TEST == 4
-// expected-error@-2 {{redefinition of module 'x'}}
-// expected-note-re@* {{loaded from '{{.*[/\\]}}x.pcm'}}
-#elif TEST == 7
-// expected-error@-5 {{expected ';'}} expected-error@-5 {{a type specifier is required}}
+#if TEST == 7
+// expected-error@-2 {{expected ';'}} expected-error@-2 {{a type specifier is required}}
#elif TEST == 9
-// expected-warning@-7 {{unknown attribute 'fancy' ignored}}
+// expected-warning@-4 {{unknown attribute 'fancy' ignored}}
#elif TEST == 10
-// expected-error-re@-9 {{'maybe_unused' attribute cannot be applied to a module{{$}}}}
+// expected-error-re@-6 {{'maybe_unused' attribute cannot be applied to a module{{$}}}}
#elif TEST == 1
-// expected-error@-11 {{module 'z' not found}}
+// expected-error@-8 {{module 'z' not found}}
#else
// expected-no-diagnostics
#endif
diff --git a/clang/test/CXX/module/basic/basic.link/p2.cppm b/clang/test/CXX/module/basic/basic.link/p2.cppm
index e82a00b..e04412e 100644
--- a/clang/test/CXX/module/basic/basic.link/p2.cppm
+++ b/clang/test/CXX/module/basic/basic.link/p2.cppm
@@ -4,9 +4,9 @@
// RUN: %clang_cc1 -std=c++20 %t/M.cppm -verify
// RUN: %clang_cc1 -std=c++20 %t/M.cppm -emit-module-interface -o %t/M.pcm
-// RUN: %clang_cc1 -std=c++20 -fmodule-file=%t/M.pcm %t/M.cpp -verify
+// RUN: %clang_cc1 -std=c++20 -fmodule-file=M=%t/M.pcm %t/M.cpp -verify
//
-// RUN: %clang_cc1 -std=c++20 -fmodule-file=%t/M.pcm %t/user.cpp -verify
+// RUN: %clang_cc1 -std=c++20 -fmodule-file=M=%t/M.pcm %t/user.cpp -verify
//--- M.cppm
// expected-no-diagnostics
diff --git a/clang/test/CXX/module/basic/basic.search/module-import.cppm b/clang/test/CXX/module/basic/basic.search/module-import.cppm
index 18b7eb4..fe5a060 100644
--- a/clang/test/CXX/module/basic/basic.search/module-import.cppm
+++ b/clang/test/CXX/module/basic/basic.search/module-import.cppm
@@ -5,12 +5,7 @@
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/x.cppm -o %t/x.pcm
-// RUN: %clang_cc1 -std=c++20 -emit-module-interface -fmodule-file=%t/x.pcm %t/y.cppm -o %t/y.pcm
-//
-// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=%t/x.pcm -verify %t/use.cpp \
-// RUN: -DMODULE_NAME=x
-// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=%t/y.pcm -verify %t/use.cpp \
-// RUN: -DMODULE_NAME=y
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface -fmodule-file=x=%t/x.pcm %t/y.cppm -o %t/y.pcm
//
// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=x=%t/x.pcm -verify %t/use.cpp \
// RUN: -DMODULE_NAME=x
@@ -21,8 +16,6 @@
//
// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=x=%t/a.pcm -verify %t/use.cpp \
// RUN: -DMODULE_NAME=x
-// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=%t/y.pcm -fmodule-file=x=%t/a.pcm -verify %t/use.cpp \
-// RUN: -DMODULE_NAME=y
// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=y=%t/y.pcm -fmodule-file=x=%t/a.pcm -verify %t/use.cpp \
// RUN: -DMODULE_NAME=y
//
diff --git a/clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.import/p1.cppm b/clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.import/p1.cppm
index 64133ac..873e4c0 100644
--- a/clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.import/p1.cppm
+++ b/clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.import/p1.cppm
@@ -3,14 +3,14 @@
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/x.cppm -o %t/x.pcm
-// RUN: %clang_cc1 -std=c++20 -emit-module-interface -fmodule-file=%t/x.pcm %t/x.y.cppm -o %t/x.y.pcm
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface -fmodule-file=x=%t/x.pcm %t/x.y.cppm -o %t/x.y.pcm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/a.b.cppm -o %t/a.b.pcm
//
-// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=%t/x.y.pcm -fmodule-file=%t/a.b.pcm -verify %t/test.cpp \
+// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=x.y=%t/x.y.pcm -fmodule-file=x=%t/x.pcm -verify %t/test.cpp \
// RUN: -DMODULE_NAME=z -DINTERFACE
-// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=%t/x.y.pcm -fmodule-file=%t/a.b.pcm -verify %t/test.cpp \
-// RUN: -DMODULE_NAME=a.b
-// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=%t/x.y.pcm -fmodule-file=%t/a.b.pcm -verify %t/test.x.cpp
+// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=x.y=%t/x.y.pcm -fmodule-file=x=%t/x.pcm \
+// RUN: -fmodule-file=a.b=%t/a.b.pcm -verify %t/test.cpp -DMODULE_NAME=a.b
+// RUN: %clang_cc1 -std=c++20 -I%t -fmodule-file=x.y=%t/x.y.pcm -fmodule-file=x=%t/x.pcm -verify %t/test.x.cpp
//--- x.cppm
export module x;
@@ -31,8 +31,7 @@ int use_1 = a; // ok
int use_2 = b; // ok
// There is no relation between module x and module x.y.
-int use_3 = c; // expected-error {{declaration of 'c' must be imported from module 'x.y'}}
- // expected-note@x.y.cppm:2 {{not visible}}
+int use_3 = c; // expected-error {{use of undeclared identifier 'c'}}
//--- test.cpp
#ifdef INTERFACE
diff --git a/clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.interface/p1.cppm b/clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.interface/p1.cppm
index 963a8bc..3072b76 100644
--- a/clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.interface/p1.cppm
+++ b/clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.interface/p1.cppm
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -std=c++20 %s -verify -o /dev/null
// RUN: %clang_cc1 -std=c++20 %s -DINTERFACE -verify -emit-module-interface -o %t
-// RUN: %clang_cc1 -std=c++20 %s -DIMPLEMENTATION -verify -fmodule-file=%t -o /dev/null
+// RUN: %clang_cc1 -std=c++20 %s -DIMPLEMENTATION -verify -fmodule-file=A=%t -o /dev/null
//
// RUN: %clang_cc1 -std=c++20 %s -DBUILT_AS_INTERFACE -emit-module-interface -verify -o /dev/null
// RUN: %clang_cc1 -std=c++20 %s -DINTERFACE -DBUILT_AS_INTERFACE -emit-module-interface -verify -o /dev/null
diff --git a/clang/test/CXX/module/dcl.dcl/dcl.module/p1.cpp b/clang/test/CXX/module/dcl.dcl/dcl.module/p1.cpp
index 52da32c..db86b5d 100644
--- a/clang/test/CXX/module/dcl.dcl/dcl.module/p1.cpp
+++ b/clang/test/CXX/module/dcl.dcl/dcl.module/p1.cpp
@@ -1,9 +1,9 @@
// RUN: %clang_cc1 -std=c++20 -verify %s -DFOO=export -DBAR=export
// RUN: %clang_cc1 -std=c++20 -verify %s -DFOO=export -DBAR=
// RUN: %clang_cc1 -std=c++20 %s -DFOO=export -emit-module-interface -o %t
-// RUN: %clang_cc1 -std=c++20 %s -fmodule-file=%t -DFOO=
-// RUN: %clang_cc1 -std=c++20 %s -fmodule-file=%t -DBAR=export
-// RUN: %clang_cc1 -std=c++20 -verify %s -fmodule-file=%t -DFOO= -DBAR=export
+// RUN: %clang_cc1 -std=c++20 %s -fmodule-file=foo=%t -DFOO=
+// RUN: %clang_cc1 -std=c++20 %s -fmodule-file=foo=%t -DBAR=export
+// RUN: %clang_cc1 -std=c++20 -verify %s -fmodule-file=foo=%t -DFOO= -DBAR=export
#ifdef FOO
FOO module foo; // expected-note {{previous module declaration is here}}
diff --git a/clang/test/CXX/module/dcl.dcl/dcl.module/p5.cpp b/clang/test/CXX/module/dcl.dcl/dcl.module/p5.cpp
index f594e76..ca10044 100644
--- a/clang/test/CXX/module/dcl.dcl/dcl.module/p5.cpp
+++ b/clang/test/CXX/module/dcl.dcl/dcl.module/p5.cpp
@@ -1,8 +1,8 @@
// RUN: rm -rf %t
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -o %t -DINTERFACE
-// RUN: %clang_cc1 -std=c++20 -fmodule-file=%t %s -verify -DIMPLEMENTATION
-// RUN: %clang_cc1 -std=c++20 -fmodule-file=%t %s -verify -DEARLY_IMPLEMENTATION
-// RUN: %clang_cc1 -std=c++20 -fmodule-file=%t %s -verify -DUSER
+// RUN: %clang_cc1 -std=c++20 -fmodule-file=Foo=%t %s -verify -DIMPLEMENTATION
+// RUN: %clang_cc1 -std=c++20 -fmodule-file=Foo=%t %s -verify -DEARLY_IMPLEMENTATION
+// RUN: %clang_cc1 -std=c++20 -fmodule-file=Foo=%t %s -verify -DUSER
// expected-no-diagnostics
diff --git a/clang/test/CXX/module/module.context/p7.cpp b/clang/test/CXX/module/module.context/p7.cpp
index 6a63e3e..2a08705 100644
--- a/clang/test/CXX/module/module.context/p7.cpp
+++ b/clang/test/CXX/module/module.context/p7.cpp
@@ -12,13 +12,13 @@
// RUN: -o stuff.pcm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface std-10-6-ex1-M1.cpp \
-// RUN: -fmodule-file=stuff.pcm -o M1.pcm -fmodule-file=defn.pcm
+// RUN: -fmodule-file=stuff=stuff.pcm -o M1.pcm -fmodule-file=defn.pcm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface std-10-6-ex1-M2.cpp \
-// RUN: -fmodule-file=stuff.pcm -o M2.pcm -fmodule-file=decl.pcm
+// RUN: -fmodule-file=stuff=stuff.pcm -o M2.pcm -fmodule-file=decl.pcm
// RUN: %clang_cc1 -std=c++20 std-10-6-ex1-use.cpp \
-// RUN: -fmodule-file=M1.pcm -fmodule-file=M2.pcm -fsyntax-only -verify
+// RUN: -fmodule-file=M1=M1.pcm -fmodule-file=M2=M2.pcm -fsyntax-only -verify
//--- std-10-6-ex1-decl.h
struct X;
diff --git a/clang/test/CXX/module/module.interface/p1.cpp b/clang/test/CXX/module/module.interface/p1.cpp
index fcc88af..54a201e 100644
--- a/clang/test/CXX/module/module.interface/p1.cpp
+++ b/clang/test/CXX/module/module.interface/p1.cpp
@@ -1,6 +1,6 @@
// RUN: %clang_cc1 -std=c++2a %s -DERRORS -verify
// RUN: %clang_cc1 -std=c++2a %s -emit-module-interface -o %t.pcm
-// RUN: %clang_cc1 -std=c++2a %s -fmodule-file=%t.pcm -DIMPLEMENTATION -verify -Db=b2 -Dc=c2
+// RUN: %clang_cc1 -std=c++2a %s -fmodule-file=M=%t.pcm -DIMPLEMENTATION -verify -Db=b2 -Dc=c2
module;
diff --git a/clang/test/CXX/module/module.interface/p2.cpp b/clang/test/CXX/module/module.interface/p2.cpp
index ed6772f..dc16161 100644
--- a/clang/test/CXX/module/module.interface/p2.cpp
+++ b/clang/test/CXX/module/module.interface/p2.cpp
@@ -3,9 +3,9 @@
// RUN: %clang_cc1 -std=c++20 -x c++-header %S/Inputs/header.h -emit-header-unit -o %t/h.pcm
// RUN: %clang_cc1 -std=c++20 %s -DX_INTERFACE -emit-module-interface -o %t/x.pcm
// RUN: %clang_cc1 -std=c++20 %s -DY_INTERFACE -emit-module-interface -o %t/y.pcm
-// RUN: %clang_cc1 -std=c++20 %s -DINTERFACE -fmodule-file=%t/x.pcm -fmodule-file=%t/y.pcm -emit-module-interface -o %t/m.pcm
-// RUN: %clang_cc1 -std=c++20 %s -DIMPLEMENTATION -I%S/Inputs -fmodule-file=%t/h.pcm -fmodule-file=%t/m.pcm -verify
-// RUN: %clang_cc1 -std=c++20 %s -DUSER -I%S/Inputs -fmodule-file=%t/h.pcm -fmodule-file=%t/m.pcm -verify
+// RUN: %clang_cc1 -std=c++20 %s -DINTERFACE -fmodule-file=X=%t/x.pcm -fmodule-file=Y=%t/y.pcm -emit-module-interface -o %t/m.pcm
+// RUN: %clang_cc1 -std=c++20 %s -DIMPLEMENTATION -I%S/Inputs -fmodule-file=%t/h.pcm -fmodule-file=p2=%t/m.pcm -verify
+// RUN: %clang_cc1 -std=c++20 %s -DUSER -I%S/Inputs -fmodule-file=%t/h.pcm -fmodule-file=p2=%t/m.pcm -verify
#if defined(X_INTERFACE)
export module X;
diff --git a/clang/test/CXX/module/module.unit/p8.cpp b/clang/test/CXX/module/module.unit/p8.cpp
index e22da16..a5c01c4 100644
--- a/clang/test/CXX/module/module.unit/p8.cpp
+++ b/clang/test/CXX/module/module.unit/p8.cpp
@@ -1,11 +1,11 @@
// RUN: echo 'export module foo; export int n;' > %t.cppm
// RUN: %clang_cc1 -std=c++2a %t.cppm -emit-module-interface -o %t.pcm
-// RUN: %clang_cc1 -std=c++2a -fmodule-file=%t.pcm -verify -DMODE=0 %s
-// RUN: %clang_cc1 -std=c++2a -fmodule-file=%t.pcm -verify -DMODE=1 %s
-// RUN: %clang_cc1 -std=c++2a -fmodule-file=%t.pcm -verify -DMODE=2 %s
-// RUN: %clang_cc1 -std=c++2a -fmodule-file=%t.pcm -verify -DMODE=3 %s
-// RUN: %clang_cc1 -std=c++2a -fmodule-file=%t.pcm -verify -DMODE=4 %s
-// RUN: %clang_cc1 -std=c++2a -fmodule-file=%t.pcm -verify -DMODE=5 %s
+// RUN: %clang_cc1 -std=c++2a -fmodule-file=foo=%t.pcm -verify -DMODE=0 %s
+// RUN: %clang_cc1 -std=c++2a -fmodule-file=foo=%t.pcm -verify -DMODE=1 %s
+// RUN: %clang_cc1 -std=c++2a -fmodule-file=foo=%t.pcm -verify -DMODE=2 %s
+// RUN: %clang_cc1 -std=c++2a -fmodule-file=foo=%t.pcm -verify -DMODE=3 %s
+// RUN: %clang_cc1 -std=c++2a -fmodule-file=foo=%t.pcm -verify -DMODE=4 %s
+// RUN: %clang_cc1 -std=c++2a -fmodule-file=foo=%t.pcm -verify -DMODE=5 %s
#if MODE == 0
// no module declaration
@@ -16,9 +16,7 @@ module foo; // Implementation, implicitly imports foo.
#define IMPORTED
#elif MODE == 2
-export module foo; // expected-error {{redefinition of module 'foo'}}
-// expected-note-re@* {{module loaded from '{{.*}}.pcm'}}
-#define IMPORTED
+export module foo;
#elif MODE == 3
export module bar; // A different module
@@ -35,6 +33,5 @@ export module foo:bar; // Partition interface
int k = n;
#ifndef IMPORTED
-// expected-error@-2 {{declaration of 'n' must be imported from module 'foo' before it is required}}
-// expected-note@* {{not visible}}
+// expected-error@-2 {{use of undeclared identifier 'n'}}
#endif
diff --git a/clang/test/Modules/cxx20-10-1-ex2.cpp b/clang/test/Modules/cxx20-10-1-ex2.cpp
index 03e2e26..04219cd 100644
--- a/clang/test/Modules/cxx20-10-1-ex2.cpp
+++ b/clang/test/Modules/cxx20-10-1-ex2.cpp
@@ -7,22 +7,22 @@
// RUN: -o %t/B_Y.pcm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/std10-1-ex2-tu2.cpp \
-// RUN: -fmodule-file=%t/B_Y.pcm -o %t/B.pcm
+// RUN: -fmodule-file=B:Y=%t/B_Y.pcm -o %t/B.pcm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/std10-1-ex2-tu3.cpp \
// RUN: -o %t/B_X1.pcm -verify
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/std10-1-ex2-tu4.cpp \
-// RUN:-fmodule-file=%t/B.pcm -o %t/B_X2.pcm
+// RUN:-fmodule-file=B=%t/B.pcm -o %t/B_X2.pcm
// RUN: %clang_cc1 -std=c++20 -emit-obj %t/std10-1-ex2-tu5.cpp \
-// RUN: -fmodule-file=%t/B.pcm -o %t/b_tu5.o
+// RUN: -fmodule-file=B=%t/B.pcm -o %t/b_tu5.o
// RUN: %clang_cc1 -std=c++20 -S %t/std10-1-ex2-tu6.cpp \
-// RUN: -fmodule-file=%t/B.pcm -o %t/b_tu6.s -verify
+// RUN: -fmodule-file=B=%t/B.pcm -o %t/b_tu6.s -verify
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/std10-1-ex2-tu7.cpp \
-// RUN: -fmodule-file=%t/B_X2.pcm -o %t/B_X3.pcm -verify
+// RUN: -fmodule-file=B:X2=%t/B_X2.pcm -o %t/B_X3.pcm -verify
//--- std10-1-ex2-tu1.cpp
module B:Y;
diff --git a/clang/test/Modules/cxx20-10-2-ex2.cpp b/clang/test/Modules/cxx20-10-2-ex2.cpp
index 1b0a02c..659e4fe 100644
--- a/clang/test/Modules/cxx20-10-2-ex2.cpp
+++ b/clang/test/Modules/cxx20-10-2-ex2.cpp
@@ -11,7 +11,7 @@
// RUN: -o %t/X.pcm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/std-10-2-ex2-tu2.cpp \
-// RUN: -fmodule-file=%t/std-10-2-ex2-c.pcm -fmodule-file=%t/X.pcm \
+// RUN: -fmodule-file=%t/std-10-2-ex2-c.pcm -fmodule-file=X=%t/X.pcm \
// RUN: -pedantic-errors -verify -o %t/M.pcm
//--- std-10-2-ex2-b.h
diff --git a/clang/test/Modules/cxx20-10-2-ex5.cpp b/clang/test/Modules/cxx20-10-2-ex5.cpp
index 32a9350..49c5934 100644
--- a/clang/test/Modules/cxx20-10-2-ex5.cpp
+++ b/clang/test/Modules/cxx20-10-2-ex5.cpp
@@ -8,10 +8,10 @@
// RUN: -o %t/M.pcm
// RUN: %clang_cc1 -std=c++20 -emit-obj %t/std-10-2-ex5-tu2.cpp \
-// RUN: -fmodule-file=%t/M.pcm -o %t/tu-2.o
+// RUN: -fmodule-file=M=%t/M.pcm -o %t/tu-2.o
// RUN: %clang_cc1 -std=c++20 -emit-obj %t/std-10-2-ex5-tu3.cpp \
-// RUN: -fmodule-file=%t/M.pcm -verify -o %t/main.o
+// RUN: -fmodule-file=M=%t/M.pcm -verify -o %t/main.o
//--- std-10-2-ex5-tu1.cpp
export module M;
diff --git a/clang/test/Modules/cxx20-10-3-ex1.cpp b/clang/test/Modules/cxx20-10-3-ex1.cpp
index 69a48c4..5d6e255 100644
--- a/clang/test/Modules/cxx20-10-3-ex1.cpp
+++ b/clang/test/Modules/cxx20-10-3-ex1.cpp
@@ -6,13 +6,13 @@
// RUN: -o %t/M_PartImpl.pcm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/std10-3-ex1-tu2.cpp \
-// RUN: -fmodule-file=%t/M_PartImpl.pcm -o %t/M.pcm -verify
+// RUN: -fmodule-file=M:PartImpl=%t/M_PartImpl.pcm -o %t/M.pcm -verify
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/std10-3-ex1-tu3.cpp \
// RUN: -o %t/M_Part.pcm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/std10-3-ex1-tu4.cpp \
-// RUN: -fmodule-file=%t/M_Part.pcm -o %t/M.pcm
+// RUN: -fmodule-file=M:Part=%t/M_Part.pcm -o %t/M.pcm
//--- std10-3-ex1-tu1.cpp
module M:PartImpl;
diff --git a/clang/test/Modules/cxx20-10-3-ex2.cpp b/clang/test/Modules/cxx20-10-3-ex2.cpp
index 589d8cb..b1d6d66 100644
--- a/clang/test/Modules/cxx20-10-3-ex2.cpp
+++ b/clang/test/Modules/cxx20-10-3-ex2.cpp
@@ -6,7 +6,7 @@
// RUN: -o %t/M.pcm
// RUN: %clang_cc1 -std=c++20 -S %t/std10-3-ex2-tu2.cpp \
-// RUN: -fmodule-file=%t/M.pcm -o %t/tu_8.s -verify
+// RUN: -fmodule-file=M=%t/M.pcm -o %t/tu_8.s -verify
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/std10-3-ex2-tu3.cpp \
// RUN: -o %t/M.pcm -verify
diff --git a/clang/test/Modules/cxx20-10-5-ex1.cpp b/clang/test/Modules/cxx20-10-5-ex1.cpp
index c24fb5f..a83162c 100644
--- a/clang/test/Modules/cxx20-10-5-ex1.cpp
+++ b/clang/test/Modules/cxx20-10-5-ex1.cpp
@@ -8,7 +8,7 @@
// RUN: %clang_cc1 -std=c++20 -emit-module-interface std-10-5-ex1-interface.cpp \
// RUN: -o A.pcm
-// RUN: %clang_cc1 -std=c++20 std-10-5-ex1-use.cpp -fmodule-file=A.pcm \
+// RUN: %clang_cc1 -std=c++20 std-10-5-ex1-use.cpp -fmodule-file=A=A.pcm \
// RUN: -fsyntax-only -verify
//--- std-10-5-ex1-interface.cpp
diff --git a/clang/test/Modules/cxx20-import-diagnostics-a.cpp b/clang/test/Modules/cxx20-import-diagnostics-a.cpp
index 4c94a59..6c2594a 100644
--- a/clang/test/Modules/cxx20-import-diagnostics-a.cpp
+++ b/clang/test/Modules/cxx20-import-diagnostics-a.cpp
@@ -9,31 +9,31 @@
// RUN: -o %t/C.pcm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/import-diags-tu3.cpp \
-// RUN: -fmodule-file=%t/B.pcm -fmodule-file=%t/C.pcm -o %t/AOK1.pcm
+// RUN: -fmodule-file=B=%t/B.pcm -fmodule-file=C=%t/C.pcm -o %t/AOK1.pcm
// RUN: %clang_cc1 -std=c++20 -S %t/import-diags-tu4.cpp \
-// RUN: -fmodule-file=%t/AOK1.pcm -o %t/tu_3.s -verify
+// RUN: -fmodule-file=AOK1=%t/AOK1.pcm -fmodule-file=C=%t/C.pcm -o %t/tu_3.s -verify
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/import-diags-tu5.cpp \
-// RUN: -fmodule-file=%t/B.pcm -fmodule-file=%t/C.pcm -o %t/BC.pcm -verify
+// RUN: -fmodule-file=B=%t/B.pcm -fmodule-file=C=%t/C.pcm -o %t/BC.pcm -verify
// RUN: %clang_cc1 -std=c++20 -S %t/import-diags-tu6.cpp \
-// RUN: -fmodule-file=%t/B.pcm -fmodule-file=%t/C.pcm -o %t/tu_5.s -verify
+// RUN: -fmodule-file=B=%t/B.pcm -fmodule-file=C=%t/C.pcm -o %t/tu_5.s -verify
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/import-diags-tu7.cpp \
-// RUN: -fmodule-file=%t/B.pcm -o %t/D.pcm -verify
+// RUN: -fmodule-file=B=%t/B.pcm -o %t/D.pcm -verify
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/import-diags-tu8.cpp \
-// RUN: -fmodule-file=%t/B.pcm -o %t/D.pcm -verify
+// RUN: -fmodule-file=B=%t/B.pcm -o %t/D.pcm -verify
// RUN: %clang_cc1 -std=c++20 -S %t/import-diags-tu9.cpp \
-// RUN: -fmodule-file=%t/B.pcm -o %t/tu_8.s -verify
+// RUN: -fmodule-file=B=%t/B.pcm -o %t/tu_8.s -verify
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/import-diags-tu10.cpp \
// RUN: -o %t/B.pcm -verify
// RUN: %clang_cc1 -std=c++20 -emit-obj %t/import-diags-tu11.cpp \
-// RUN: -fmodule-file=%t/C.pcm -o %t/impl.o
+// RUN: -fmodule-file=C=%t/C.pcm -o %t/impl.o
// Test diagnostics for incorrect module import sequences.
diff --git a/clang/test/Modules/cxx20-import-diagnostics-b.cpp b/clang/test/Modules/cxx20-import-diagnostics-b.cpp
index f252190..7d43263 100644
--- a/clang/test/Modules/cxx20-import-diagnostics-b.cpp
+++ b/clang/test/Modules/cxx20-import-diagnostics-b.cpp
@@ -5,22 +5,22 @@
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/a.cpp -o %t/a.pcm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/c.cpp \
-// RUN: -fmodule-file=%t/a.pcm -o %t/c.pcm
+// RUN: -fmodule-file=a=%t/a.pcm -o %t/c.pcm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/d.cpp \
-// RUN: -fmodule-file=%t/a.pcm -o %t/d.pcm
+// RUN: -fmodule-file=a=%t/a.pcm -o %t/d.pcm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/e.cpp \
-// RUN: -fmodule-file=%t/a.pcm -o %t/e.pcm
+// RUN: -fmodule-file=a=%t/a.pcm -o %t/e.pcm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/a-part.cpp \
// RUN: -o %t/a-part.pcm
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/f.cpp \
-// RUN: -fmodule-file=%t/a.pcm -o %t/f.pcm -verify
+// RUN: -fmodule-file=a=%t/a.pcm -o %t/f.pcm -verify
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/g.cpp \
-// RUN: -fmodule-file=%t/a.pcm -o %t/g.pcm -verify
+// RUN: -fmodule-file=a=%t/a.pcm -o %t/g.pcm -verify
//--- a.cpp
export module a;
diff --git a/clang/test/Modules/eagerly-load-cxx-named-modules.cppm b/clang/test/Modules/eagerly-load-cxx-named-modules.cppm
new file mode 100644
index 0000000..07b5ce2
--- /dev/null
+++ b/clang/test/Modules/eagerly-load-cxx-named-modules.cppm
@@ -0,0 +1,24 @@
+// RUN: rm -rf %t
+// RUN: mkdir %t
+// RUN: split-file %s %t
+//
+// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm
+// RUN: %clang_cc1 -std=c++20 %t/user.cpp -fmodule-file=%t/a.pcm -fsyntax-only \
+// RUN: 2>&1 | FileCheck %t/user.cpp
+// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -o %t/b.pcm \
+// RUN: -fprebuilt-module-path=%t
+// RUN: %clang_cc1 -std=c++20 %t/b.pcm -S -emit-llvm 2>&1 -o - | FileCheck %t/b.cppm
+
+//--- a.cppm
+export module a;
+
+//--- b.cppm
+export module b;
+import a;
+
+// CHECK-NOT: warning
+
+//--- user.cpp
+import a;
+
+// CHECK: the form '-fmodule-file=<BMI-path>' is deprecated for standard C++ named modules;consider to use '-fmodule-file=<module-name>=<BMI-path>' instead
diff --git a/clang/test/Modules/named-modules-adl-2.cppm b/clang/test/Modules/named-modules-adl-2.cppm
index 1203e69..45cb628 100644
--- a/clang/test/Modules/named-modules-adl-2.cppm
+++ b/clang/test/Modules/named-modules-adl-2.cppm
@@ -3,8 +3,8 @@
// RUN: cd %t
//
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm
-// RUN: %clang_cc1 -std=c++20 %t/b.cppm -fmodule-file=%t/a.pcm -emit-module-interface -o %t/b.pcm
-// RUN: %clang_cc1 -std=c++20 %t/c.cppm -fmodule-file=%t/b.pcm -fsyntax-only -verify
+// RUN: %clang_cc1 -std=c++20 %t/b.cppm -fmodule-file=a=%t/a.pcm -emit-module-interface -o %t/b.pcm
+// RUN: %clang_cc1 -std=c++20 %t/c.cppm -fmodule-file=b=%t/b.pcm -fsyntax-only -verify
//--- a.cppm
export module a;
diff --git a/clang/test/Modules/named-modules-adl.cppm b/clang/test/Modules/named-modules-adl.cppm
index 91f37307..d5133ef 100644
--- a/clang/test/Modules/named-modules-adl.cppm
+++ b/clang/test/Modules/named-modules-adl.cppm
@@ -3,7 +3,7 @@
// RUN: cd %t
//
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm
-// RUN: %clang_cc1 -std=c++20 %t/b.cppm -fmodule-file=%t/a.pcm -fsyntax-only -verify
+// RUN: %clang_cc1 -std=c++20 %t/b.cppm -fmodule-file=a=%t/a.pcm -fsyntax-only -verify
//--- a.h
namespace n {
diff --git a/clang/test/Modules/pr60036.cppm b/clang/test/Modules/pr60036.cppm
index 187a68f..113bef5 100644
--- a/clang/test/Modules/pr60036.cppm
+++ b/clang/test/Modules/pr60036.cppm
@@ -14,12 +14,12 @@
//
// Tests that the behavior is fine with specifying module file with `-fmodule-file`.
// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-module-interface -o %t/a.pcm
-// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -fmodule-file=%t/a.pcm -o %t/b.pcm
-// RUN: %clang_cc1 -std=c++20 %t/c.cppm -emit-module-interface -fmodule-file=%t/a.pcm -o %t/c.pcm
+// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-module-interface -fmodule-file=a=%t/a.pcm -o %t/b.pcm
+// RUN: %clang_cc1 -std=c++20 %t/c.cppm -emit-module-interface -fmodule-file=a=%t/a.pcm -o %t/c.pcm
// RUN: %clang_cc1 -std=c++20 %t/d.cppm -emit-module-interface -o %t/d.pcm
-// RUN: %clang_cc1 -std=c++20 %t/e.cppm -emit-module-interface -fmodule-file=%t/d.pcm -o %t/e.pcm
-// RUN: %clang_cc1 -std=c++20 %t/f.cppm -emit-module-interface -fmodule-file=%t/a.pcm -fmodule-file=%t/b.pcm -fmodule-file=%t/c.pcm -fmodule-file=%t/d.pcm -o %t/f.pcm
-// RUN: %clang_cc1 -std=c++20 %t/g.cppm -fmodule-file=%t/e.pcm -fmodule-file=%t/f.pcm -verify -fsyntax-only
+// RUN: %clang_cc1 -std=c++20 %t/e.cppm -emit-module-interface -fmodule-file=d=%t/d.pcm -o %t/e.pcm
+// RUN: %clang_cc1 -std=c++20 %t/f.cppm -emit-module-interface -fmodule-file=a=%t/a.pcm -fmodule-file=b=%t/b.pcm -fmodule-file=c=%t/c.pcm -fmodule-file=d=%t/d.pcm -o %t/f.pcm
+// RUN: %clang_cc1 -std=c++20 %t/g.cppm -fmodule-file=e=%t/e.pcm -fmodule-file=f=%t/f.pcm -verify -fsyntax-only
//--- a.cppm
export module a;
diff --git a/clang/test/SemaCXX/modules.cppm b/clang/test/SemaCXX/modules.cppm
index afa9176..39d8275 100644
--- a/clang/test/SemaCXX/modules.cppm
+++ b/clang/test/SemaCXX/modules.cppm
@@ -1,32 +1,17 @@
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -o %t.0.pcm -verify -DTEST=0
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -o %t.1.pcm -verify -DTEST=1
-// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -fmodule-file=%t.0.pcm -o %t.2.pcm -verify -DTEST=2
-// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -fmodule-file=%t.0.pcm -o %t.3.pcm -verify -Dfoo=bar -DTEST=3
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -fmodule-file=foo=%t.0.pcm -o %t.2.pcm -verify -DTEST=2
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -fmodule-file=foo=%t.0.pcm -o %t.3.pcm -verify -Dfoo=bar -DTEST=3
-#if TEST == 0
+#if TEST == 0 || TEST == 2
// expected-no-diagnostics
#endif
export module foo;
-#if TEST == 2
-// expected-error@-2 {{redefinition of module 'foo'}}
-// expected-note@modules.cppm:* {{loaded from}}
-#endif
static int m;
-#if TEST == 2
-// expected-error@-2 {{redefinition of '}}
-// expected-note@-3 {{unguarded header; consider using #ifdef guards or #pragma once}}
-// FIXME: We should drop the "header from" in this diagnostic.
-// expected-note-re@modules.cppm:1 {{'{{.*}}modules.cppm' included multiple times, additional include site in header from module 'foo'}}
-#endif
+
int n;
-#if TEST == 2
-// expected-error@-2 {{redefinition of '}}
-// expected-note@-3 {{unguarded header; consider using #ifdef guards or #pragma once}}
-// FIXME: We should drop the "header from" in this diagnostic.
-// expected-note-re@modules.cppm:1 {{'{{.*}}modules.cppm' included multiple times, additional include site in header from module 'foo'}}
-#endif
#if TEST == 0
export {
@@ -43,8 +28,7 @@ export void f() {}
export struct T {
} t;
#elif TEST == 3
-int use_a = a; // expected-error {{declaration of 'a' must be imported from module 'foo' before it is required}}
-// expected-note@-14 {{declaration here is not visible}}
+int use_a = a; // expected-error {{use of undeclared identifier 'a'}}
#undef foo
import foo; // expected-error {{imports must immediately follow the module declaration}}
@@ -57,11 +41,11 @@ export { // expected-note {{begins here}}
static_assert(true); // expected-warning {{ISO C++20 does not permit a static_assert declaration to appear in an export block}}
}
-int use_b = b;
+int use_b = b; // expected-error{{use of undeclared identifier 'b'}}
int use_n = n; // FIXME: this should not be visible, because it is not exported
extern int n;
-static_assert(&n != p);
+static_assert(&n != p); // expected-error{{use of undeclared identifier 'p'}}
#endif
#if TEST == 1