252
|
1 // Address: https://github.com/llvm/llvm-project/issues/60275
|
|
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 -triple %itanium_abi_triple -emit-module-interface %t/a.cppm -o %t/a.pcm
|
|
8 // RUN: %clang_cc1 -std=c++20 -triple %itanium_abi_triple %t/b.cpp -fmodule-file=%t/a.pcm -emit-llvm -o - | FileCheck %t/b.cpp
|
|
9 //--- foo.h
|
|
10
|
|
11 consteval void global() {}
|
|
12
|
|
13 //--- a.cppm
|
|
14 module;
|
|
15 #include "foo.h"
|
|
16 export module a;
|
|
17
|
|
18 //--- b.cpp
|
|
19 #include "foo.h"
|
|
20 import a;
|
|
21
|
|
22 consteval int b() {
|
|
23 return 0;
|
|
24 }
|
|
25
|
|
26 struct bb {
|
|
27 int m = b();
|
|
28 };
|
|
29
|
|
30 void bbb() {
|
|
31 bb x;
|
|
32 }
|
|
33
|
|
34 // CHECK: define{{.*}}_ZN2bbC2Ev({{.*}}[[THIS:%.+]])
|
|
35 // CHECK-NEXT: entry:
|
|
36 // CHECK-NEXT: [[THIS_ADDR:%.*]] = alloca ptr
|
|
37 // CHECK-NEXT: store ptr [[THIS]], ptr [[THIS_ADDR]]
|
|
38 // CHECK-NEXT: [[THIS1:%.*]] = load ptr, ptr [[THIS_ADDR]]
|
|
39 // CHECK-NEXT: [[M_ADDR:%.*]] = getelementptr{{.*}}%struct.bb, ptr [[THIS1]], i32 0, i32 0
|
|
40 // CHECK-NEXT: store i32 0, ptr [[M_ADDR]]
|