54 lines · cpp
1// RUN: %clang_cc1 -std=c++11 -triple x86_64 -emit-llvm -o - %s | FileCheck %s2 3struct S {4 S(int x) { }5 S(int x, double y, double z) { }6};7 8void fn1() {9 // CHECK-LABEL: define{{.*}} void @_Z3fn1v10 S s { 1 };11 // CHECK: alloca %struct.S, align 112 // CHECK: call void @_ZN1SC1Ei(ptr {{[^,]*}} %s, i32 noundef 1)13}14 15void fn2() {16 // CHECK-LABEL: define{{.*}} void @_Z3fn2v17 S s { 1, 2.0, 3.0 };18 // CHECK: alloca %struct.S, align 119 // CHECK: call void @_ZN1SC1Eidd(ptr {{[^,]*}} %s, i32 noundef 1, double noundef 2.000000e+00, double noundef 3.000000e+00)20}21 22void fn3() {23 // CHECK-LABEL: define{{.*}} void @_Z3fn3v24 S sa[] { { 1 }, { 2 }, { 3 } };25 // CHECK: alloca [3 x %struct.S], align 126 // CHECK: call void @_ZN1SC1Ei(ptr {{[^,]*}} %{{.+}}, i32 noundef 1)27 // CHECK: call void @_ZN1SC1Ei(ptr {{[^,]*}} %{{.+}}, i32 noundef 2)28 // CHECK: call void @_ZN1SC1Ei(ptr {{[^,]*}} %{{.+}}, i32 noundef 3)29}30 31void fn4() {32 // CHECK-LABEL: define{{.*}} void @_Z3fn4v33 S sa[] { { 1, 2.0, 3.0 }, { 4, 5.0, 6.0 } };34 // CHECK: alloca [2 x %struct.S], align 135 // CHECK: call void @_ZN1SC1Eidd(ptr {{[^,]*}} %{{.+}}, i32 noundef 1, double noundef 2.000000e+00, double noundef 3.000000e+00)36 // CHECK: call void @_ZN1SC1Eidd(ptr {{[^,]*}} %{{.+}}, i32 noundef 4, double noundef 5.000000e+00, double noundef 6.000000e+00)37}38 39namespace TreeTransformBracedInit {40 struct S {};41 struct T { T(const S &); T(const T&); ~T(); };42 void x(const T &);43 template<typename> void foo(const S &s) {44 // Instantiation of this expression used to lose the CXXBindTemporaryExpr45 // node and thus not destroy the temporary.46 x({s});47 }48 template void foo<void>(const S&);49 // CHECK: define {{.*}} void @_ZN23TreeTransformBracedInit3fooIvEEvRKNS_1SE(50 // CHECK: call void @_ZN23TreeTransformBracedInit1TC1ERKNS_1SE(51 // CHECK-NEXT: call void @_ZN23TreeTransformBracedInit1xERKNS_1TE(52 // CHECK-NEXT: call void @_ZN23TreeTransformBracedInit1TD1Ev(53}54