Author: iains Date: 2022-02-23T11:07:36Z New Revision: e0f1dd018e0f94a7d694bc615975c3a7d26d9e50
URL: https://github.com/llvm/llvm-project/commit/e0f1dd018e0f94a7d694bc615975c3a7d26d9e50 DIFF: https://github.com/llvm/llvm-project/commit/e0f1dd018e0f94a7d694bc615975c3a7d26d9e50.diff LOG: [C++20][Modules] Rework testcase to use split file [NFC]. This switches the testcase committed for initial C++20 modules import tracking to use split-file rather than preprocessor directives. Differential Revision: https://reviews.llvm.org/D120352 Added: Modified: clang/test/Modules/cxx20-import-diagnostics-a.cpp Removed: ################################################################################ diff --git a/clang/test/Modules/cxx20-import-diagnostics-a.cpp b/clang/test/Modules/cxx20-import-diagnostics-a.cpp index fd4085bcb4713..8e2940a432e6d 100644 --- a/clang/test/Modules/cxx20-import-diagnostics-a.cpp +++ b/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 @@ int foo (); // expected-no-diagnostics -#elif TU == 1 +//--- import-diags-tu2.cpp export module C; @@ -52,7 +53,7 @@ int bar (); // expected-no-diagnostics -#elif TU == 2 +//--- import-diags-tu3.cpp export module AOK1; @@ -63,7 +64,7 @@ export int theAnswer (); // expected-no-diagnostics -#elif TU == 3 +//--- import-diags-tu4.cpp module; @@ -73,7 +74,7 @@ export import C; // expected-error {{export declaration can only be used within int theAnswer () { return 42; } -#elif TU == 4 +//--- import-diags-tu5.cpp export module BC; @@ -83,7 +84,7 @@ int foo () { return 10; } 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 @@ int foo () { return 10; } 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 @@ export module D; int delta (); -#elif TU == 7 +//--- import-diags-tu8.cpp export module D; @@ -113,19 +114,19 @@ module :private; 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 @@ import C; 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