blob: 769d120be32301b64c3f1ba0c48fe780a0948b92 [file] [log] [blame]
Anders Carlssonabea9512011-02-28 00:40:07 +00001// RUN: %clang_cc1 -emit-llvm -o - -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 %s | FileCheck %s
Douglas Gregor86a3a032010-05-16 01:24:12 +00002
3struct X {
4 X();
5 ~X();
6};
7
8struct Y { };
9
10// CHECK: define void @_Z1fv
11void f() {
12 // CHECK: call i32 @__cxa_guard_acquire(i64* @_ZGVZ1fvE1x)
13 // CHECK: invoke void @_ZN1XC1Ev
John McCall5cd91b52010-09-08 01:44:27 +000014 // CHECK: call i32 @__cxa_atexit
15 // CHECK-NEXT: call void @__cxa_guard_release(i64* @_ZGVZ1fvE1x)
Douglas Gregor86a3a032010-05-16 01:24:12 +000016 // CHECK: br
17 static X x;
John McCallf1549f62010-07-06 01:34:17 +000018
19 // CHECK: call i8* @__cxa_allocate_exception
John McCall224124c2010-08-10 18:51:44 +000020 // CHECK: call void @__cxa_throw
John McCallf1549f62010-07-06 01:34:17 +000021 throw Y();
22
23 // Finally, the landing pad.
Bill Wendling285cfd82011-09-19 20:31:14 +000024 // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
25 // CHECK: cleanup
Douglas Gregor86a3a032010-05-16 01:24:12 +000026 // CHECK: call void @__cxa_guard_abort(i64* @_ZGVZ1fvE1x)
Bill Wendling285cfd82011-09-19 20:31:14 +000027 // CHECK: resume { i8*, i32 }
Douglas Gregor86a3a032010-05-16 01:24:12 +000028}