53 lines · plain
1// RUN: %clang_cc1 %s -emit-llvm -o - -fobjc-gc -fblocks -triple i386-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 | FileCheck %s --check-prefix=CHECK --check-prefix=OBJC2// RUN: %clang_cc1 -x objective-c++ %s -emit-llvm -o - -fobjc-gc -fblocks -triple i386-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 | FileCheck %s --check-prefix=CHECK --check-prefix=OBJCXX3 4// OBJC-LABEL: define{{.*}} void @test1(5// OBJCXX-LABEL: define{{.*}} void @_Z5test1P12NSDictionary(6 7// CHECK-LABEL: define linkonce_odr hidden void @__copy_helper_block_8// CHECK: call void @_Block_object_assign(9 10// CHECK-LABEL: define linkonce_odr hidden void @__destroy_helper_block_11// CHECK: call void @_Block_object_dispose(12 13// OBJC-LABEL: define{{.*}} void @foo(14// OBJCXX-LABEL: define{{.*}} void @_Z3foov(15// CHECK: call ptr @objc_read_weak(16// CHECK: call ptr @objc_assign_weak(17// CHECK: call void @_Block_object_dispose(18 19// OBJC-LABEL: define{{.*}} void @test2(20// OBJCXX-LABEL: define{{.*}} void @_Z5test2v(21// CHECK: call ptr @objc_assign_weak(22// CHECK: call void @_Block_object_dispose(23 24// CHECK-LABEL: define linkonce_odr hidden void @__copy_helper_block_25// CHECK: call void @_Block_object_assign(26 27// CHECK-LABEL: define linkonce_odr hidden void @__destroy_helper_block_28// CHECK: call void @_Block_object_dispose(29 30@interface NSDictionary @end31 32void test1(NSDictionary * dict) {33 ^{ (void)dict; }();34}35 36@interface D37@end38 39void foo(void) {40 __block __weak D *weakSelf;41 ^{ (void)weakSelf; };42 D *l;43 l = weakSelf;44 weakSelf = l;45}46 47void (^__weak b)(void);48 49void test2(void) {50 __block int i = 0;51 b = ^ { ++i; };52}53