ChuanqiXu updated this revision to Diff 500662.
ChuanqiXu added a comment.

Don't emit the warning if we're compiling a .pcm file directly.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144707/new/

https://reviews.llvm.org/D144707

Files:
  clang/include/clang/Basic/DiagnosticSerializationKinds.td
  clang/lib/Serialization/ASTReader.cpp
  clang/test/CXX/basic/basic.link/p10-ex2.cpp
  clang/test/CXX/basic/basic.link/p2.cpp
  clang/test/CXX/basic/basic.lookup/basic.lookup.argdep/p5-ex2.cpp
  clang/test/CXX/basic/basic.scope/basic.scope.namespace/p2.cpp
  clang/test/CXX/module/basic/basic.def.odr/p6.cppm
  clang/test/CXX/module/basic/basic.link/module-declaration.cpp
  clang/test/CXX/module/basic/basic.link/p2.cppm
  clang/test/CXX/module/basic/basic.search/module-import.cppm
  clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.import/p1.cppm
  clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.interface/p1.cppm
  clang/test/CXX/module/dcl.dcl/dcl.module/p1.cpp
  clang/test/CXX/module/dcl.dcl/dcl.module/p5.cpp
  clang/test/CXX/module/module.context/p7.cpp
  clang/test/CXX/module/module.interface/p1.cpp
  clang/test/CXX/module/module.interface/p2.cpp
  clang/test/CXX/module/module.unit/p8.cpp
  clang/test/Modules/cxx20-10-1-ex2.cpp
  clang/test/Modules/cxx20-10-2-ex2.cpp
  clang/test/Modules/cxx20-10-2-ex5.cpp
  clang/test/Modules/cxx20-10-3-ex1.cpp
  clang/test/Modules/cxx20-10-3-ex2.cpp
  clang/test/Modules/cxx20-10-5-ex1.cpp
  clang/test/Modules/cxx20-import-diagnostics-a.cpp
  clang/test/Modules/cxx20-import-diagnostics-b.cpp
  clang/test/Modules/eagerly-load-cxx-named-modules.cppm
  clang/test/Modules/named-modules-adl-2.cppm
  clang/test/Modules/named-modules-adl.cppm
  clang/test/Modules/pr60036.cppm
  clang/test/SemaCXX/modules.cppm

Index: clang/test/SemaCXX/modules.cppm
===================================================================
--- clang/test/SemaCXX/modules.cppm
+++ 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-n...@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...@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...@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 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 @@
   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
Index: clang/test/Modules/pr60036.cppm
===================================================================
--- clang/test/Modules/pr60036.cppm
+++ 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;
Index: clang/test/Modules/named-modules-adl.cppm
===================================================================
--- clang/test/Modules/named-modules-adl.cppm
+++ 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 {
Index: clang/test/Modules/named-modules-adl-2.cppm
===================================================================
--- clang/test/Modules/named-modules-adl-2.cppm
+++ 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;
Index: clang/test/Modules/eagerly-load-cxx-named-modules.cppm
===================================================================
--- /dev/null
+++ 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
Index: clang/test/Modules/cxx20-import-diagnostics-b.cpp
===================================================================
--- clang/test/Modules/cxx20-import-diagnostics-b.cpp
+++ 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;
Index: clang/test/Modules/cxx20-import-diagnostics-a.cpp
===================================================================
--- clang/test/Modules/cxx20-import-diagnostics-a.cpp
+++ 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.
 
Index: clang/test/Modules/cxx20-10-5-ex1.cpp
===================================================================
--- clang/test/Modules/cxx20-10-5-ex1.cpp
+++ 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
Index: clang/test/Modules/cxx20-10-3-ex2.cpp
===================================================================
--- clang/test/Modules/cxx20-10-3-ex2.cpp
+++ 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
Index: clang/test/Modules/cxx20-10-3-ex1.cpp
===================================================================
--- clang/test/Modules/cxx20-10-3-ex1.cpp
+++ 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;
Index: clang/test/Modules/cxx20-10-2-ex5.cpp
===================================================================
--- clang/test/Modules/cxx20-10-2-ex5.cpp
+++ 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;
Index: clang/test/Modules/cxx20-10-2-ex2.cpp
===================================================================
--- clang/test/Modules/cxx20-10-2-ex2.cpp
+++ 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
Index: clang/test/Modules/cxx20-10-1-ex2.cpp
===================================================================
--- clang/test/Modules/cxx20-10-1-ex2.cpp
+++ 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;
Index: clang/test/CXX/module/module.unit/p8.cpp
===================================================================
--- clang/test/CXX/module/module.unit/p8.cpp
+++ 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 @@
 #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 @@
 
 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
Index: clang/test/CXX/module/module.interface/p2.cpp
===================================================================
--- clang/test/CXX/module/module.interface/p2.cpp
+++ 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;
Index: clang/test/CXX/module/module.interface/p1.cpp
===================================================================
--- clang/test/CXX/module/module.interface/p1.cpp
+++ 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;
 
Index: clang/test/CXX/module/module.context/p7.cpp
===================================================================
--- clang/test/CXX/module/module.context/p7.cpp
+++ 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;
Index: clang/test/CXX/module/dcl.dcl/dcl.module/p5.cpp
===================================================================
--- clang/test/CXX/module/dcl.dcl/dcl.module/p5.cpp
+++ 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
 
Index: clang/test/CXX/module/dcl.dcl/dcl.module/p1.cpp
===================================================================
--- clang/test/CXX/module/dcl.dcl/dcl.module/p1.cpp
+++ 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}}
Index: clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.interface/p1.cppm
===================================================================
--- clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.interface/p1.cppm
+++ 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
Index: clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.import/p1.cppm
===================================================================
--- clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.import/p1.cppm
+++ 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_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-n...@x.y.cppm:2 {{not visible}}
+int use_3 = c; // expected-error {{use of undeclared identifier 'c'}}
 
 //--- test.cpp
 #ifdef INTERFACE
Index: clang/test/CXX/module/basic/basic.search/module-import.cppm
===================================================================
--- clang/test/CXX/module/basic/basic.search/module-import.cppm
+++ 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
 //
Index: clang/test/CXX/module/basic/basic.link/p2.cppm
===================================================================
--- clang/test/CXX/module/basic/basic.link/p2.cppm
+++ 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
Index: clang/test/CXX/module/basic/basic.link/module-declaration.cpp
===================================================================
--- clang/test/CXX/module/basic/basic.link/module-declaration.cpp
+++ 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 @@
 //--- 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
Index: clang/test/CXX/module/basic/basic.def.odr/p6.cppm
===================================================================
--- clang/test/CXX/module/basic/basic.def.odr/p6.cppm
+++ 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
Index: clang/test/CXX/basic/basic.scope/basic.scope.namespace/p2.cpp
===================================================================
--- clang/test/CXX/basic/basic.scope/basic.scope.namespace/p2.cpp
+++ 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 @@
 #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-n...@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-n...@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-n...@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-n...@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 @@
   // expected-note@* {{not visible}}
 
   global_module_fragment = 1; // expected-error {{missing '#include'; 'global_module_fragment' must be declared before it is used}}
-  // expected-n...@p2.cpp:16 {{not visible}}
 
   exported = 1;
 
Index: clang/test/CXX/basic/basic.lookup/basic.lookup.argdep/p5-ex2.cpp
===================================================================
--- clang/test/CXX/basic/basic.lookup/basic.lookup.argdep/p5-ex2.cpp
+++ 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;
Index: clang/test/CXX/basic/basic.link/p2.cpp
===================================================================
--- clang/test/CXX/basic/basic.link/p2.cpp
+++ 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
Index: clang/test/CXX/basic/basic.link/p10-ex2.cpp
===================================================================
--- clang/test/CXX/basic/basic.link/p10-ex2.cpp
+++ 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
Index: clang/lib/Serialization/ASTReader.cpp
===================================================================
--- clang/lib/Serialization/ASTReader.cpp
+++ clang/lib/Serialization/ASTReader.cpp
@@ -5644,6 +5644,12 @@
       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.
Index: clang/include/clang/Basic/DiagnosticSerializationKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticSerializationKinds.td
+++ clang/include/clang/Basic/DiagnosticSerializationKinds.td
@@ -127,6 +127,11 @@
   "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 {
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D144707: [C++20] [Modul... Chuanqi Xu via Phabricator via cfe-commits

Reply via email to