xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/exceptions.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s -fexceptions -fblocks | FileCheck %s
2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple armv7-apple-unknown -emit-llvm -o - %s -fexceptions -fsjlj-exceptions -fblocks | FileCheck %s -check-prefix=CHECK-ARM
3*f4a2713aSLionel Sambuc 
4*f4a2713aSLionel Sambuc // rdar://problem/8621849
test1()5*f4a2713aSLionel Sambuc void test1() {
6*f4a2713aSLionel Sambuc   extern void test1_helper(void (^)(int));
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc   // CHECK-LABEL:     define void @test1()
9*f4a2713aSLionel Sambuc   // CHECK-ARM-LABEL: define arm_aapcscc void @test1()
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc   __block int x = 10;
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc   // CHECK:     invoke void @test1_helper(
14*f4a2713aSLionel Sambuc   // CHECK-ARM: invoke arm_aapcscc void @test1_helper(
15*f4a2713aSLionel Sambuc   test1_helper(^(int v) { x = v; });
16*f4a2713aSLionel Sambuc 
17*f4a2713aSLionel Sambuc   // CHECK:          landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gcc_personality_v0 to i8*)
18*f4a2713aSLionel Sambuc   // CHECK-NEXT:       cleanup
19*f4a2713aSLionel Sambuc   // CHECK-ARM:      landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gcc_personality_sj0 to i8*)
20*f4a2713aSLionel Sambuc   // CHECK-ARM-NEXT:   cleanup
21*f4a2713aSLionel Sambuc }
22*f4a2713aSLionel Sambuc 
23*f4a2713aSLionel Sambuc void test2_helper();
test2()24*f4a2713aSLionel Sambuc void test2() {
25*f4a2713aSLionel Sambuc   __block int x = 10;
26*f4a2713aSLionel Sambuc   test2_helper(5, 6, 7);
27*f4a2713aSLionel Sambuc }
test2_helper(int x,int y)28*f4a2713aSLionel Sambuc void test2_helper(int x, int y) {
29*f4a2713aSLionel Sambuc }
30*f4a2713aSLionel Sambuc // CHECK: invoke void @test2_helper(i32 5, i32 6)
31