1 // RUN: %clang_cc1 -std=c++11 -triple i386-unknown-unknown -fexceptions -fcxx-exceptions %s -emit-llvm -o - | FileCheck %s
2 // REQUIRES: asserts
3
4 struct Throws {
5 Throws(int);
6 Throws();
7 ~Throws();
8 };
9
10 // CHECK-LABEL: define void @_Z7cleanupi
cleanup(int n)11 void cleanup(int n) {
12 // CHECK: invoke void @_ZN6ThrowsC1Ei
13 // CHECK-NEXT: to label %{{[^ ]+}} unwind label %[[LPAD:[^ ]+]]
14 // CHECK: invoke void @_ZN6ThrowsC1Ei
15 // CHECK-NEXT: to label %{{[^ ]+}} unwind label %[[LPAD]]
16 // CHECK: invoke void @_ZN6ThrowsC1Ei
17 // CHECK-NEXT: to label %{{[^ ]+}} unwind label %[[LPAD]]
18 // CHECK: invoke void @_ZN6ThrowsC1Ev
19 // CHECK-NEXT: to label %{{[^ ]+}} unwind label %[[LPAD]]
20 new Throws[n] { 1, 2, 3 };
21 // CHECK: [[LPAD]]:
22 // CHECK-NEXT: landingpad
23 // CHECK: call void @_ZN6ThrowsD1Ev
24 // CHECK: call void @_ZdaPv
25 }
26
27
28 // CHECK-LABEL: define void @_Z7cleanupv
cleanup()29 void cleanup() {
30 // CHECK: invoke void @_ZN6ThrowsC1Ei
31 // CHECK-NEXT: to label %{{[^ ]+}} unwind label %[[LPAD2:[^ ]+]]
32 // CHECK: invoke void @_ZN6ThrowsC1Ei
33 // CHECK-NEXT: to label %{{[^ ]+}} unwind label %[[LPAD2]]
34 // CHECK: invoke void @_ZN6ThrowsC1Ei
35 // CHECK-NEXT: to label %{{[^ ]+}} unwind label %[[LPAD2]]
36 new Throws[3] { 1, 2, 3 };
37 // CHECK: [[LPAD2]]:
38 // CHECK-NEXT: landingpad
39 // CHECK: call void @_ZN6ThrowsD1Ev
40 // CHECK: call void @_ZdaPv
41 }
42