summaryrefslogtreecommitdiffstats
path: root/test/CodeGenObjC/exceptions.m
blob: 5be695932b0f5407a795d29cf4d326360036eeb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -O2 -o - %s | FileCheck %s
//
// <rdar://problem/7471679> [irgen] [eh] Exception code built with clang (x86_64) crashes

// Just check that we don't emit any dead blocks.
@interface NSArray @end
void f0() {
  @try {
    @try {
      @throw @"a";
    } @catch(NSArray *e) {
    }
  } @catch (id e) {
  }
}

// CHECK: define void @f1()
void f1() {
  extern void foo(void);

  while (1) {
    // CHECK:      call void @objc_exception_try_enter
    // CHECK-NEXT: getelementptr
    // CHECK-NEXT: call i32 @_setjmp(
    // CHECK-NEXT: icmp
    // CHECK-NEXT: br i1
    @try {
    // CHECK:      call void @foo()
      foo();
    // CHECK:      call void @objc_exception_try_exit
    // CHECK-NEXT: ret void

    // CHECK:      call i8* @objc_exception_extract
    // CHECK-NEXT: ret void
    } @finally {
      break;
    }
  }
}
OpenPOWER on IntegriCloud