[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Modules / cxx20-module-file-info.cpp
blob9ef061f076330c80d6431fd3dab4d1fa9e26d122
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=A=%t/A.pcm -fmodule-file=B=%t/B.pcm -o %t/Foo.pcm
22 // RUN: %clang_cc1 -std=c++20 -module-file-info %t/Foo.pcm -fmodule-file=A=%t/A.pcm \
23 // RUN: -fmodule-file=B=%t/B.pcm | FileCheck \
24 // RUN: --check-prefix=CHECK-FOO %s
26 // expected-no-diagnostics
28 //--- mod-info-tu1.cpp
29 export module A;
31 void a();
33 // CHECK-A: ====== C++20
34 // CHECK-A-NEXT: Interface Unit 'A' is the Primary Module at index #1
36 //--- mod-info-tu2.cpp
37 export module B;
39 void b();
41 // CHECK-B: ====== C++20
42 // CHECK-B-NEXT: Interface Unit 'B' is the Primary Module at index #1
44 //--- mod-info-tu3.cpp
45 module;
47 export module Foo;
49 import A;
50 export import B;
52 namespace hello {
53 export void say(const char *);
56 void foo() {}
58 // CHECK-FOO: ====== C++20
59 // CHECK-FOO-NEXT: Interface Unit 'Foo' is the Primary Module at index #3
60 // CHECK-FOO-NEXT: Sub Modules:
61 // CHECK-FOO-NEXT: Global Module Fragment '<global>' is at index #4
62 // CHECK-FOO-NEXT: Imports:
63 // CHECK-FOO-NEXT: Interface Unit 'A' is at index #1
64 // CHECK-FOO-NEXT: Exports:
65 // CHECK-FOO-NEXT: Interface Unit 'B' is at index #2