1f4a2713aSLionel 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*0a6a1f1dSLionel 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-LP32 %s 3f4a2713aSLionel Sambuc 4f4a2713aSLionel Sambuc@interface MyView 5f4a2713aSLionel Sambuc- (void)MyView_sharedInit; 6f4a2713aSLionel Sambuc@end 7f4a2713aSLionel Sambuc 8f4a2713aSLionel Sambucvoid foo(MyView *(^obj)(void)) ; 9f4a2713aSLionel Sambuc 10f4a2713aSLionel Sambuc@implementation MyView 11f4a2713aSLionel Sambuc- (void)MyView_sharedInit { 12f4a2713aSLionel Sambuc 13f4a2713aSLionel Sambuc __block __weak MyView *weakSelf = self; 14f4a2713aSLionel Sambuc foo( 15f4a2713aSLionel Sambuc ^{ 16f4a2713aSLionel Sambuc return weakSelf; 17f4a2713aSLionel Sambuc }); 18f4a2713aSLionel Sambuc 19f4a2713aSLionel Sambuc} 20f4a2713aSLionel Sambuc@end 21f4a2713aSLionel Sambuc 22f4a2713aSLionel Sambuc// CHECK-LP64: call i8* @objc_read_weak 23f4a2713aSLionel Sambuc// CHECK-LP32: call i8* @objc_read_weak 24f4a2713aSLionel Sambuc 25