1// RUN: %clang_cc1 -fblocks -fobjc-runtime-has-weak -fobjc-arc -triple x86_64-apple-darwin -print-ivar-layout -emit-llvm -o /dev/null %s > %t-64.layout 2// RUN: FileCheck -check-prefix=CHECK -check-prefix=CHECK-64 --input-file=%t-64.layout %s 3// RUN: %clang_cc1 -fblocks -fobjc-runtime-has-weak -fobjc-arc -triple i386-apple-darwin -print-ivar-layout -emit-llvm -o /dev/null %s > %t-32.layout 4// RUN: FileCheck -check-prefix=CHECK -check-prefix=CHECK-32 --input-file=%t-32.layout %s 5// rdar://12184410 6// rdar://12184410 7 8void x(id y) {} 9void y(int a) {} 10 11extern id opaque_id(); 12__weak id wid; 13 14void f() { 15 __block int byref_int = 0; 16 const id bar = (id) opaque_id(); 17 id baz = 0; 18 __strong id strong_void_sta; 19 __block id byref_bab = (id)0; 20 __block id bl_var1; 21 22// block variable layout: BL_STRONG:1, BL_OPERATOR:0 23// CHECK: Inline block variable layout: 0x0100, BL_STRONG:1, BL_OPERATOR:0 24 void (^b)() = ^{ 25 x(bar); 26 }; 27 28// block variable layout: BL_STRONG:2, BL_BYREF:1, BL_OPERATOR:0 29// CHECK: Inline block variable layout: 0x0210, BL_STRONG:2, BL_BYREF:1, BL_OPERATOR:0 30 void (^c)() = ^{ 31 x(bar); 32 x(baz); 33 byref_int = 1; 34 }; 35 36// block variable layout: BL_STRONG:2, BL_BYREF:3, BL_OPERATOR:0 37// CHECK: Inline block variable layout: 0x0230, BL_STRONG:2, BL_BYREF:3, BL_OPERATOR:0 38 void (^d)() = ^{ 39 x(bar); 40 x(baz); 41 byref_int = 1; 42 bl_var1 = 0; 43 byref_bab = 0; 44 }; 45 46// block variable layout: BL_STRONG:2, BL_BYREF:3, BL_OPERATOR:0 47// CHECK: Inline block variable layout: 0x0230, BL_STRONG:2, BL_BYREF:3, BL_OPERATOR:0 48 id (^e)() = ^{ 49 x(bar); 50 x(baz); 51 byref_int = 1; 52 bl_var1 = 0; 53 byref_bab = 0; 54 return wid; 55 }; 56 57// CHECK: Inline block variable layout: 0x020, BL_BYREF:2, BL_OPERATOR:0 58 void (^ii)() = ^{ 59 byref_int = 1; 60 byref_bab = 0; 61 }; 62} 63