xref: /llvm-project/clang/test/CodeGenObjC/objc2-weak-block-call.m (revision 9466b49171dc4b21f56a48594fc82b1e52f5358a)
1// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -emit-llvm %s -o - | FileCheck -check-prefix CHECK-LP64 %s
2// RUN: %clang_cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -emit-llvm %s -o - | FileCheck -check-prefix CHECK-LP32 %s
3
4@interface MyView
5- (void)MyView_sharedInit;
6@end
7
8void foo(MyView *(^obj)(void)) ;
9
10@implementation MyView
11- (void)MyView_sharedInit {
12
13    __block __weak MyView *weakSelf = self;
14    foo(
15    ^{
16	return weakSelf;
17    });
18
19}
20@end
21
22// CHECK-LP64: call ptr @objc_read_weak
23// CHECK-LP32: call ptr @objc_read_weak
24
25