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 i8* @objc_read_weak
23// CHECK-LP32: call i8* @objc_read_weak
24
25