xref: /llvm-project/clang/test/Modules/module-init-duplicated-import.cppm (revision 7c1d9b15eee3a34678addab2bab66f3020ac0753)
1// RUN: rm -rf %t
2// RUN: split-file %s %t
3// RUN: cd %t
4//
5// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 %t/a.cppm \
6// RUN:      -emit-module-interface -o %t/a.pcm
7// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 %t/m.cppm \
8// RUN:      -emit-module-interface -fmodule-file=a=%t/a.pcm -o %t/m.pcm
9// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 %t/m.pcm  \
10// RUN:      -fmodule-file=a=%t/a.pcm -emit-llvm -o - | FileCheck %t/m.cppm
11
12// Test again with reduced BMI.
13// Note that we can't use reduced BMI here for m.cppm since it is required
14// to generate the backend code.
15// RUN: rm %t/a.pcm %t/m.pcm
16// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 %t/a.cppm \
17// RUN:      -emit-reduced-module-interface -o %t/a.pcm
18// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 %t/m.cppm \
19// RUN:      -emit-module-interface -fmodule-file=a=%t/a.pcm -o %t/m.pcm
20// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 %t/m.pcm  \
21// RUN:      -fmodule-file=a=%t/a.pcm -emit-llvm -o - | FileCheck %t/m.cppm
22
23//--- a.cppm
24export module a;
25export struct A {
26  A(){};
27};
28export A __dynamic_inited_a;
29
30//--- m.cppm
31export module m;
32import a;
33export import a;
34
35
36// CHECK: define void @_ZGIW1m
37// CHECK: store i8 1, ptr @_ZGIW1m__in_chrg
38// CHECK: call{{.*}}@_ZGIW1a
39