1 // RUN: %clang_cc1 -x objective-c++ -fblocks -fobjc-gc -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -print-ivar-layout -emit-llvm -o /dev/null %s > %t-64.layout
2 // RUN: FileCheck --input-file=%t-64.layout %s
4 // See commentary in test/CodeGenObjC/block-var-layout.m, from which
5 // this is largely cloned.
22 extern id opaque_id();
25 __block int byref_int = 0;
30 const id bar = (id) opaque_id();
32 __strong void *strong_void_sta;
33 __block id byref_bab = (id)0;
34 __block void *bl_var1;
38 // byref int, short, char, char, char, id, id, strong void*, byref id
40 // CHECK: block variable layout for block: 0x01, 0x35, 0x10, 0x00
42 byref_int = sh + ch+ch1+ch2 ;
45 x((id)strong_void_sta);
51 // byref int, short, char, char, char, id, id, strong void*, byref void*, byref id
53 // CHECK: 0x01, 0x36, 0x10, 0x00
55 byref_int = sh + ch+ch1+ch2 ;
58 x((id)strong_void_sta);
66 // byref int, short, char, char, char, id, id, byref void*, int, double, byref id
68 // CHECK: block variable layout for block: 0x01, 0x35, 0x30, 0x00
70 byref_int = sh + ch+ch1+ch2 ;
81 // struct S (int, id, int, id, int, id)
83 // CHECK: block variable layout for block: 0x01, 0x41, 0x11, 0x11, 0x00
91 // Test 5 (unions/structs and their nesting):
119 // struct s2 (int, id, int, id, int, id?), union u2 (id?)
121 // CHECK: block variable layout for block: 0x01, 0x41, 0x11, 0x12, 0x00
131 void notifyBlock(id dependentBlock) {
132 id singleObservationToken;
138 // CHECK: block variable layout for block: 0x01, 0x33, 0x00
139 void (^wrapperBlock)() = ^() {
140 CFRelease(singleObservationToken);
141 CFRelease(singleObservationToken);
143 CFRelease(singleObservationToken);
149 void test_empty_block() {
151 // CHECK: block variable layout for block: 0x01, 0x30, 0x00
152 void (^wrapperBlock)() = ^() {