| 1 |
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -fexceptions -fobjc-exceptions -fobjc-runtime-has-weak -o - %s | FileCheck %s |
| 2 |
|
| 3 |
@class Ety; |
| 4 |
|
| 5 |
// These first two tests are all PR11732 |
| 6 |
|
| 7 |
void test0_helper(void); |
| 8 |
void test0(void) { |
| 9 |
@try { |
| 10 |
test0_helper(); |
| 11 |
} @catch (Ety *e) { |
| 12 |
} |
| 13 |
} |
| 14 |
// CHECK-LABEL: define{{.*}} void @test0() |
| 15 |
// CHECK: [[E:%e]] = alloca ptr, align 8 |
| 16 |
// CHECK: invoke void @test0_helper() |
| 17 |
// CHECK: [[T0:%.*]] = call ptr @objc_begin_catch( |
| 18 |
// CHECK-NEXT: [[T3:%.*]] = call ptr @llvm.objc.retain(ptr [[T0]]) [[NUW:#[0-9]+]] |
| 19 |
// CHECK-NEXT: store ptr [[T3]], ptr [[E]] |
| 20 |
// CHECK-NEXT: call void @llvm.objc.storeStrong(ptr [[E]], ptr null) [[NUW]] |
| 21 |
// CHECK-NEXT: call void @objc_end_catch() [[NUW]] |
| 22 |
|
| 23 |
void test1_helper(void); |
| 24 |
void test1(void) { |
| 25 |
@try { |
| 26 |
test1_helper(); |
| 27 |
} @catch (__weak Ety *e) { |
| 28 |
} |
| 29 |
} |
| 30 |
// CHECK-LABEL: define{{.*}} void @test1() |
| 31 |
// CHECK: [[E:%e]] = alloca ptr, align 8 |
| 32 |
// CHECK: invoke void @test1_helper() |
| 33 |
// CHECK: [[T0:%.*]] = call ptr @objc_begin_catch( |
| 34 |
// CHECK-NEXT: call ptr @llvm.objc.initWeak(ptr [[E]], ptr [[T0]]) [[NUW]] |
| 35 |
// CHECK-NEXT: call void @llvm.objc.destroyWeak(ptr [[E]]) [[NUW]] |
| 36 |
// CHECK-NEXT: call void @objc_end_catch() [[NUW]] |
| 37 |
|
| 38 |
// CHECK: attributes [[NUW]] = { nounwind } |