iains created this revision.
iains added reviewers: urnathan, ChuanqiXu.
iains published this revision for review.
iains added a comment.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

probably qualifies as trivial/obvious but in case anyone has any comments.


This switches the testcase committed for initial C++20 modules import tracking 
to
use split-file rather than preprocessor directives.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D120352

Files:
  clang/test/Modules/cxx20-import-diagnostics-a.cpp

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
@@ -1,42 +1,43 @@
 // RUN: rm -rf %t
 // RUN: mkdir -p %t
+// RUN: split-file %s %t
 
-// RUN: %clang_cc1 -std=c++20 -emit-module-interface -D TU=0 -x c++ %s \
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/import-diags-tu1.cpp \
 // RUN:  -o %t/B.pcm
 
-// RUN: %clang_cc1 -std=c++20 -emit-module-interface -D TU=1 -x c++ %s \
+// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/import-diags-tu2.cpp \
 // RUN:  -o %t/C.pcm
 
-// RUN: %clang_cc1 -std=c++20 -emit-module-interface -D TU=2 -x c++ %s \
+// 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: %clang_cc1 -std=c++20 -S -D TU=3 -x c++ %s \
+// 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: %clang_cc1 -std=c++20 -emit-module-interface -D TU=4 -x c++ %s \
+// 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: %clang_cc1 -std=c++20 -S -D TU=5 -x c++ %s \
+// 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: %clang_cc1 -std=c++20 -emit-module-interface -D TU=6 -x c++ %s \
+// 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: %clang_cc1 -std=c++20 -emit-module-interface -D TU=7 -x c++ %s \
+// 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: %clang_cc1 -std=c++20 -S -D TU=8 -x c++ %s \
+// 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: %clang_cc1 -std=c++20 -emit-module-interface -D TU=9 -x c++ %s \
+// 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 -D TU=10 -x c++ %s \
+// RUN: %clang_cc1 -std=c++20 -emit-obj %t/import-diags-tu11.cpp \
 // RUN:  -fmodule-file=%t/C.pcm  -o %t/impl.o
 
 // Test diagnostics for incorrect module import sequences.
 
-#if TU == 0
+//--- import-diags-tu1.cpp
 
 export module B;
 
@@ -44,7 +45,7 @@
 
 // expected-no-diagnostics
 
-#elif TU == 1
+//--- import-diags-tu2.cpp
 
 export module C;
 
@@ -52,7 +53,7 @@
 
 // expected-no-diagnostics
 
-#elif TU == 2
+//--- import-diags-tu3.cpp
 
 export module AOK1;
 
@@ -63,7 +64,7 @@
 
 // expected-no-diagnostics
 
-#elif TU == 3
+//--- import-diags-tu4.cpp
 
 module;
 
@@ -73,7 +74,7 @@
 
 int theAnswer () { return 42; }
 
-#elif TU == 4
+//--- import-diags-tu5.cpp
 
 export module BC;
 
@@ -83,7 +84,7 @@
 
 import C; // expected-error {{imports must immediately follow the module declaration}}
 
-#elif TU == 5
+//--- import-diags-tu6.cpp
 
 module B; // implicitly imports B.
 
@@ -91,7 +92,7 @@
 
 import C; // expected-error {{imports must immediately follow the module declaration}}
 
-#elif TU == 6
+//--- import-diags-tu7.cpp
 
 module;
 // We can only have preprocessor commands here, which could include an include
@@ -103,7 +104,7 @@
 
 int delta ();
 
-#elif TU == 7
+//--- import-diags-tu8.cpp
 
 export module D;
 
@@ -113,19 +114,19 @@
 
 import B; // expected-error {{module imports cannot be in the private module fragment}}
 
-#elif TU == 8
+//--- import-diags-tu9.cpp
 
 module B;
 
 import B; // expected-error {{import of module 'B' appears within same top-level module 'B'}}
 
-#elif TU == 9
+//--- import-diags-tu10.cpp
 
 export module B;
 
 import B; // expected-error {{import of module 'B' appears within same top-level module 'B'}}
 
-#elif TU == 10
+//--- import-diags-tu11.cpp
 
 int x;
 
@@ -134,7 +135,3 @@
 int baz() { return 6174; }
 
 // expected-no-diagnostics
-
-#else
-#error "no MODE set"
-#endif
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to