xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenCXX/threadsafe-statics-exceptions.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -emit-llvm -o - -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 %s | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc struct X {
4*f4a2713aSLionel Sambuc   X();
5*f4a2713aSLionel Sambuc   ~X();
6*f4a2713aSLionel Sambuc };
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc struct Y { };
9*f4a2713aSLionel Sambuc 
10*f4a2713aSLionel Sambuc // CHECK-LABEL: define void @_Z1fv
f()11*f4a2713aSLionel Sambuc void f() {
12*f4a2713aSLionel Sambuc   // CHECK: call i32 @__cxa_guard_acquire(i64* @_ZGVZ1fvE1x)
13*f4a2713aSLionel Sambuc   // CHECK: invoke void @_ZN1XC1Ev
14*f4a2713aSLionel Sambuc   // CHECK: call i32 @__cxa_atexit
15*f4a2713aSLionel Sambuc   // CHECK-NEXT: call void @__cxa_guard_release(i64* @_ZGVZ1fvE1x)
16*f4a2713aSLionel Sambuc   // CHECK: br
17*f4a2713aSLionel Sambuc   static X x;
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc   // CHECK: call i8* @__cxa_allocate_exception
20*f4a2713aSLionel Sambuc   // CHECK: call void @__cxa_throw
21*f4a2713aSLionel Sambuc   throw Y();
22*f4a2713aSLionel Sambuc 
23*f4a2713aSLionel Sambuc   // Finally, the landing pad.
24*f4a2713aSLionel Sambuc   // CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
25*f4a2713aSLionel Sambuc   // CHECK:   cleanup
26*f4a2713aSLionel Sambuc   // CHECK: call void @__cxa_guard_abort(i64* @_ZGVZ1fvE1x)
27*f4a2713aSLionel Sambuc   // CHECK: resume { i8*, i32 }
28*f4a2713aSLionel Sambuc }
29