Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Modules / cxx20-module-file-info.cpp
blob99a215645e8fe76e96600aeb213790ac3dda67ae
1 // Test output from -module-file-info about C++20 modules.
3 // RUN: rm -rf %t
4 // RUN: mkdir -p %t
5 // RUN: split-file %s %t
7 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/mod-info-tu1.cpp \
8 // RUN: -o %t/A.pcm
10 // RUN: %clang_cc1 -std=c++20 -module-file-info %t/A.pcm | FileCheck \
11 // RUN: --check-prefix=CHECK-A %s
13 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/mod-info-tu2.cpp \
14 // RUN: -o %t/B.pcm
16 // RUN: %clang_cc1 -std=c++20 -module-file-info %t/B.pcm | FileCheck \
17 // RUN: --check-prefix=CHECK-B %s
19 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/mod-info-tu3.cpp \
20 // RUN: -fmodule-file=%t/A.pcm -fmodule-file=%t/B.pcm -o %t/Foo.pcm
22 // RUN: %clang_cc1 -std=c++20 -module-file-info %t/Foo.pcm | FileCheck \
23 // RUN: --check-prefix=CHECK-FOO %s
25 // expected-no-diagnostics
27 //--- mod-info-tu1.cpp
28 export module A;
30 void a();
32 // CHECK-A: ====== C++20
33 // CHECK-A-NEXT: Interface Unit 'A' is the Primary Module at index #1
35 //--- mod-info-tu2.cpp
36 export module B;
38 void b();
40 // CHECK-B: ====== C++20
41 // CHECK-B-NEXT: Interface Unit 'B' is the Primary Module at index #1
43 //--- mod-info-tu3.cpp
44 module;
46 export module Foo;
48 import A;
49 export import B;
51 namespace hello {
52 export void say(const char *);
55 void foo() {}
57 // CHECK-FOO: ====== C++20
58 // CHECK-FOO-NEXT: Interface Unit 'Foo' is the Primary Module at index #3
59 // CHECK-FOO-NEXT: Sub Modules:
60 // CHECK-FOO-NEXT: Global Module Fragment '<global>' is at index #4
61 // CHECK-FOO-NEXT: Imports:
62 // CHECK-FOO-NEXT: Interface Unit 'A' is at index #1
63 // CHECK-FOO-NEXT: Exports:
64 // CHECK-FOO-NEXT: Interface Unit 'B' is at index #2