66 lines · cpp
1// Test output from -module-file-info about C++20 modules.2 3// RUN: rm -rf %t4// RUN: mkdir -p %t5// RUN: split-file %s %t6 7// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/mod-info-tu1.cpp \8// RUN: -o %t/A.pcm9 10// RUN: %clang_cc1 -std=c++20 -module-file-info %t/A.pcm | FileCheck \11// RUN: --check-prefix=CHECK-A %s12 13// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/mod-info-tu2.cpp \14// RUN: -o %t/B.pcm15 16// RUN: %clang_cc1 -std=c++20 -module-file-info %t/B.pcm | FileCheck \17// RUN: --check-prefix=CHECK-B %s18 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.pcm21 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 %s25 26// expected-no-diagnostics27 28//--- mod-info-tu1.cpp29export module A;30 31void a();32 33// CHECK-A: ====== C++2034// CHECK-A-NEXT: Interface Unit 'A' is the Primary Module at index #135 36//--- mod-info-tu2.cpp37export module B;38 39void b();40 41// CHECK-B: ====== C++2042// CHECK-B-NEXT: Interface Unit 'B' is the Primary Module at index #143 44//--- mod-info-tu3.cpp45module;46 47export module Foo;48 49import A;50export import B;51 52namespace hello {53export void say(const char *);54}55 56void foo() {}57 58// CHECK-FOO: ====== C++2059// CHECK-FOO-NEXT: Interface Unit 'Foo' is the Primary Module at index #360// CHECK-FOO-NEXT: Sub Modules:61// CHECK-FOO-NEXT: Global Module Fragment '<global>' is at index #462// CHECK-FOO-NEXT: Imports:63// CHECK-FOO-NEXT: Interface Unit 'A' is at index #164// CHECK-FOO-NEXT: Exports:65// CHECK-FOO-NEXT: Interface Unit 'B' is at index #266