1 // RUN: %clang_cc1 -std=c++1y -triple x86_64-linux-gnu -fexceptions -fcxx-exceptions -emit-llvm %s -o - | FileCheck %s
14 // CHECK-LABEL: define{{.*}} void @_Z1fv(
16 // CHECK: call void @_ZN1SC1Ev(
17 // CHECK: invoke void @__cxa_throw
19 // Ensure we call the lambda destructor here, and do not call the destructor
23 // CHECK: call void @"_ZZ1fvEN3$_0D1Ev"(
26 [s
= S()] {}, throw 0;
31 // CHECK-LABEL: define{{.*}} void @_Z1gv(
33 // CHECK: call void @_ZN1SC1Ev(
34 // CHECK: invoke void @__cxa_throw
36 // Ensure we call the lambda destructor here, and do not call the destructor
39 // CHECK-NOT: @"_ZZ1gvEN3$_0D1Ev"(
40 // CHECK: call void @_ZN1SD1Ev(
41 // CHECK-NOT: @"_ZZ1gvEN3$_0D1Ev"(
43 [s
= S(), t
= (throw 0, 1)] {};
51 // CHECK-LABEL: define{{.*}} void @_Z1hbb(
52 void h(bool b1
, bool b2
) {
53 // CHECK: {{.*}} = alloca i1,
54 // CHECK: %[[S_ISACTIVE:.*]] = alloca i1,
55 // CHECK: {{.*}} = alloca i1,
57 // lambda init: s and t, branch on b1
58 // CHECK: call void @_ZN1SC1Ev(
59 // CHECK: store i1 true, ptr %[[S_ISACTIVE]], align 1
60 // CHECK: call void @_ZN1TC1Ev(
64 // CHECK: invoke void @__cxa_throw
66 // completion of lambda init, branch on b2
67 // CHECK: store i32 42,
68 // CHECK: store i1 false, ptr %[[S_ISACTIVE]], align 1
72 // CHECK: invoke void @__cxa_throw
74 // end of full-expression
75 // CHECK: call void @_Z1xv(
76 // CHECK: call void @"_ZZ1hbbEN3$_0D1Ev"(
77 // CHECK: call void @_ZN1TD1Ev(
78 // CHECK: call void @_Z1yv(
81 // cleanups for throw 1
83 // CHECK-NOT: @"_ZZ1hbbEN3$_0D1Ev"(
86 // cleanups for throw 2
88 // CHECK: call void @"_ZZ1hbbEN3$_0D1Ev"(
91 // common cleanup code
92 // CHECK: call void @_ZN1TD1Ev(
93 // CHECK: load i1, ptr %[[S_ISACTIVE]],
96 // CHECK: call void @_ZN1SD1Ev(
100 [s
= S(), t
= T().n
, u
= (b1
? throw 1 : 42)] {}, (b2
? throw 2 : 0), x();