1 // Test output from -module-file-info about C++20 modules. 2 3 // RUN: rm -rf %t 4 // RUN: mkdir -p %t 5 // RUN: split-file %s %t 6 7 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/mod-info-tu1.cpp \ 8 // RUN: -o %t/A.pcm 9 10 // RUN: %clang_cc1 -std=c++20 -module-file-info %t/A.pcm | FileCheck \ 11 // RUN: --check-prefix=CHECK-A %s 12 13 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/mod-info-tu2.cpp \ 14 // RUN: -o %t/B.pcm 15 16 // RUN: %clang_cc1 -std=c++20 -module-file-info %t/B.pcm | FileCheck \ 17 // RUN: --check-prefix=CHECK-B %s 18 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 21 22 // RUN: %clang_cc1 -std=c++20 -module-file-info %t/Foo.pcm | FileCheck \ 23 // RUN: --check-prefix=CHECK-FOO %s 24 25 // expected-no-diagnostics 26 27 //--- mod-info-tu1.cpp 28 export module A; 29 30 void a(); 31 32 // CHECK-A: ====== C++20 33 // CHECK-A-NEXT: Interface Unit 'A' is the Primary Module at index #1 34 35 //--- mod-info-tu2.cpp 36 export module B; 37 38 void b(); 39 40 // CHECK-B: ====== C++20 41 // CHECK-B-NEXT: Interface Unit 'B' is the Primary Module at index #1 42 43 //--- mod-info-tu3.cpp 44 module; 45 46 export module Foo; 47 48 import A; 49 export import B; 50 51 namespace hello { 52 export void say(const char *); 53 } 54 55 void foo() {} 56 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 65