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