1 // RUN: %clang_cc1 -std=c++1z %s -triple x86_64-linux-gnu -fexceptions -fcxx-exceptions -emit-llvm -o - | FileCheck %s
20 // CHECK: @_ZN8Constant2c1E ={{.*}} global { i8 } zeroinitializer, align 1
21 // CHECK: @_ZN8Constant2c2E ={{.*}} global { i8 } { i8 1 }, align 1
23 // Test packing bases into tail padding.
27 // CHECK: @_ZN8Constant2d1E ={{.*}} global { i32, i8, i8 } zeroinitializer, align 4
28 // CHECK: @_ZN8Constant2d2E ={{.*}} global { i32, i8, i8 } { i32 1, i8 2, i8 3 }, align 4
29 // CHECK: @_ZN8Constant2d3E ={{.*}} global { i32, i8, i8 } { i32 1, i8 0, i8 0 }, align 4
31 // CHECK-LABEL: define {{.*}}global_var_init
32 // CHECK: call {{.*}} @__cxa_atexit({{.*}} @_ZN8Constant1DD1Ev {{.*}} @_ZN8Constant2d1E
34 // CHECK-LABEL: define {{.*}}global_var_init
35 // CHECK: call {{.*}} @__cxa_atexit({{.*}} @_ZN8Constant1DD1Ev {{.*}} @_ZN8Constant2d2E
37 // CHECK-LABEL: define {{.*}}global_var_init
38 // CHECK: call {{.*}} @__cxa_atexit({{.*}} @_ZN8Constant1DD1Ev {{.*}} @_ZN8Constant2d3E
45 A(const char*, unsigned);
59 int f(), g(), h(), i();
65 // CHECK-LABEL: define {{.*}}global_var_init
66 // CHECK: call void @_ZN7Dynamic1AC2Ev({{.*}} @_ZN7Dynamic2d1E
67 // CHECK: store i32 5, {{.*}}i8* getelementptr inbounds {{.*}} @_ZN7Dynamic2d1E{{.*}}, i64 8
68 // CHECK: invoke void @_ZN7Dynamic1CC2Eb({{.*}} @_ZN7Dynamic2d1E{{.*}}, i1 noundef zeroext true)
69 // CHECK: unwind label %[[UNWIND:.*]]
70 // CHECK: invoke noundef i32 @_ZN7Dynamic1fEv()
71 // CHECK: unwind label %[[UNWIND:.*]]
72 // CHECK: store i32 {{.*}}, i32* getelementptr {{.*}} @_ZN7Dynamic2d1E, i32 0, i32 2
73 // CHECK: call {{.*}} @__cxa_atexit({{.*}} @_ZN7Dynamic1DD1Ev {{.*}} @_ZN7Dynamic2d1E
77 // CHECK: call void @_ZN7Dynamic1BD1Ev({{.*}}i8* getelementptr inbounds {{.*}} @_ZN7Dynamic2d1E{{.*}}, i64 8
78 // CHECK: call void @_ZN7Dynamic1AD1Ev({{.*}} @_ZN7Dynamic2d1E
81 // CHECK-LABEL: define {{.*}}global_var_init
82 // CHECK: call void @_ZN7Dynamic1AC1Ei({{.*}} @_ZN7Dynamic2d2E{{.*}}, i32 noundef 1)
83 // CHECK: store i32 2, {{.*}}i8* getelementptr inbounds {{.*}}@_ZN7Dynamic2d2E{{.*}}, i64 8
84 // CHECK: invoke void @_ZN7Dynamic1CC1Eb({{.*}} @_ZN7Dynamic2d2E{{.*}}, i1 noundef zeroext false)
85 // CHECK: invoke noundef i32 @_ZN7Dynamic1fEv()
86 // CHECK: store i32 {{.*}}, i32* getelementptr {{.*}} @_ZN7Dynamic2d2E, i32 0, i32 2
87 // CHECK: call {{.*}} @__cxa_atexit({{.*}} @_ZN7Dynamic1DD1Ev {{.*}} @_ZN7Dynamic2d2E
90 D d3
= {g(), h(), {}, i()};
91 // CHECK-LABEL: define {{.*}}global_var_init
92 // CHECK: %[[G_CALL:.*]] = call noundef i32 @_ZN7Dynamic1gEv()
93 // CHECK: call void @_ZN7Dynamic1AC1Ei({{.*}} @_ZN7Dynamic2d3E{{.*}}, i32 noundef %[[G_CALL]])
94 // CHECK: %[[H_CALL:.*]] = invoke noundef i32 @_ZN7Dynamic1hEv()
95 // CHECK: unwind label %[[DESTROY_A_LPAD:.*]]
96 // CHECK: store i32 %[[H_CALL]], {{.*}}i8* getelementptr inbounds {{.*}} @_ZN7Dynamic2d3E{{.*}}, i64 8
97 // CHECK: invoke void @_ZN7Dynamic1CC2Eb({{.*}} @_ZN7Dynamic2d3E{{.*}}, i1 noundef zeroext true)
98 // CHECK: unwind label %[[DESTROY_AB_LPAD:.*]]
99 // CHECK: %[[I_CALL:.*]] = invoke noundef i32 @_ZN7Dynamic1iEv()
100 // CHECK: unwind label %[[DESTROY_AB_LPAD:.*]]
101 // CHECK: store i32 %[[I_CALL]], i32* getelementptr {{.*}} @_ZN7Dynamic2d3E, i32 0, i32 2
102 // CHECK: call {{.*}} @__cxa_atexit({{.*}} @_ZN7Dynamic1DD1Ev {{.*}} @_ZN7Dynamic2d3E to i8*
106 // CHECK: br label %[[A_CLEANUP:.*]]
109 // CHECK: call void @_ZN7Dynamic1BD1Ev({{.*}}i8* getelementptr inbounds {{.*}} @_ZN7Dynamic2d3E{{.*}}, i64 8
110 // CHECK: br label %[[A_CLEANUP:.*]]
113 // CHECK: call void @_ZN7Dynamic1AD1Ev({{.*}} @_ZN7Dynamic2d3E
116 namespace Instantiated1
{
118 struct B
: A
{ using A::A
; };
119 template<int> B
v({});
121 // CHECK-LABEL: define {{.*}}global_var_init{{.*}} comdat($_ZN13Instantiated11vILi0EEE) {
122 // CHECK: call void @_ZN13Instantiated11BC1Ev(%{{.*}}* {{[^,]*}} @_ZN13Instantiated11vILi0EEE)
125 namespace Instantiated2
{
128 template<int> B
v({});
130 // CHECK-LABEL: define {{.*}}global_var_init{{.*}} comdat($_ZN13Instantiated21vILi0EEE) {
131 // CHECK: call void @_ZN13Instantiated21AC2Ev(