1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -triple i386-apple-darwin -print-ivar-layout -emit-llvm -o /dev/null %s > %t-32.layout
2*f4a2713aSLionel Sambuc// RUN: FileCheck --input-file=%t-32.layout %s
3*f4a2713aSLionel Sambuc// rdar://12184410
4*f4a2713aSLionel Sambuc// rdar://12752901
5*f4a2713aSLionel Sambuc
6*f4a2713aSLionel Sambucvoid x(id y) {}
7*f4a2713aSLionel Sambucvoid y(int a) {}
8*f4a2713aSLionel Sambuc
9*f4a2713aSLionel Sambucextern id opaque_id();
10*f4a2713aSLionel Sambuc
11*f4a2713aSLionel Sambucvoid f() {
12*f4a2713aSLionel Sambuc    __weak id wid;
13*f4a2713aSLionel Sambuc    __block int byref_int = 0;
14*f4a2713aSLionel Sambuc    char ch = 'a';
15*f4a2713aSLionel Sambuc    char ch1 = 'b';
16*f4a2713aSLionel Sambuc    char ch2 = 'c';
17*f4a2713aSLionel Sambuc    short sh = 2;
18*f4a2713aSLionel Sambuc    const id bar = (id) opaque_id();
19*f4a2713aSLionel Sambuc    id baz = 0;
20*f4a2713aSLionel Sambuc    __strong id strong_void_sta;
21*f4a2713aSLionel Sambuc    __block id byref_bab = (id)0;
22*f4a2713aSLionel Sambuc    __block id bl_var1;
23*f4a2713aSLionel Sambuc    int i; double dob;
24*f4a2713aSLionel Sambuc
25*f4a2713aSLionel Sambuc// The patterns here are a sequence of bytes, each saying first how
26*f4a2713aSLionel Sambuc// many sizeof(void*) chunks to skip (high nibble) and then how many
27*f4a2713aSLionel Sambuc// to scan (low nibble).  A zero byte says that we've reached the end
28*f4a2713aSLionel Sambuc// of the pattern.
29*f4a2713aSLionel Sambuc//
30*f4a2713aSLionel Sambuc// All of these patterns start with 01 3x because the block header on
31*f4a2713aSLionel Sambuc// LP64 consists of an isa pointer (which we're supposed to scan for
32*f4a2713aSLionel Sambuc// some reason) followed by three words (2 ints, a function pointer,
33*f4a2713aSLionel Sambuc// and a descriptor pointer).
34*f4a2713aSLionel Sambuc
35*f4a2713aSLionel Sambuc// Test 1
36*f4a2713aSLionel Sambuc// CHECK: Inline instruction for block variable layout: 0x0320
37*f4a2713aSLionel Sambuc    void (^b)() = ^{
38*f4a2713aSLionel Sambuc        byref_int = sh + ch+ch1+ch2 ;
39*f4a2713aSLionel Sambuc        x(bar);
40*f4a2713aSLionel Sambuc        x(baz);
41*f4a2713aSLionel Sambuc        x((id)strong_void_sta);
42*f4a2713aSLionel Sambuc        x(byref_bab);
43*f4a2713aSLionel Sambuc    };
44*f4a2713aSLionel Sambuc    b();
45*f4a2713aSLionel Sambuc
46*f4a2713aSLionel Sambuc// Test 2
47*f4a2713aSLionel Sambuc// CHECK: Inline instruction for block variable layout: 0x0331
48*f4a2713aSLionel Sambuc    void (^c)() = ^{
49*f4a2713aSLionel Sambuc        byref_int = sh + ch+ch1+ch2 ;
50*f4a2713aSLionel Sambuc        x(bar);
51*f4a2713aSLionel Sambuc        x(baz);
52*f4a2713aSLionel Sambuc        x((id)strong_void_sta);
53*f4a2713aSLionel Sambuc        x(wid);
54*f4a2713aSLionel Sambuc        bl_var1 = 0;
55*f4a2713aSLionel Sambuc        x(byref_bab);
56*f4a2713aSLionel Sambuc    };
57*f4a2713aSLionel Sambuc}
58*f4a2713aSLionel Sambuc
59*f4a2713aSLionel Sambuc@class NSString, NSNumber;
60*f4a2713aSLionel Sambucvoid g() {
61*f4a2713aSLionel Sambuc  NSString *foo;
62*f4a2713aSLionel Sambuc   NSNumber *bar;
63*f4a2713aSLionel Sambuc   unsigned int bletch;
64*f4a2713aSLionel Sambuc   __weak id weak_delegate;
65*f4a2713aSLionel Sambuc  unsigned int i;
66*f4a2713aSLionel Sambuc  NSString *y;
67*f4a2713aSLionel Sambuc  NSString *z;
68*f4a2713aSLionel Sambuc// CHECK: Inline instruction for block variable layout: 0x0401
69*f4a2713aSLionel Sambuc  void (^c)() = ^{
70*f4a2713aSLionel Sambuc   int j = i + bletch;
71*f4a2713aSLionel Sambuc   x(foo);
72*f4a2713aSLionel Sambuc   x(bar);
73*f4a2713aSLionel Sambuc   x(weak_delegate);
74*f4a2713aSLionel Sambuc   x(y);
75*f4a2713aSLionel Sambuc   x(z);
76*f4a2713aSLionel Sambuc  };
77*f4a2713aSLionel Sambuc  c();
78*f4a2713aSLionel Sambuc}
79*f4a2713aSLionel Sambuc
80*f4a2713aSLionel Sambuc// Test 5 (unions/structs and their nesting):
81*f4a2713aSLionel Sambucvoid h() {
82*f4a2713aSLionel Sambuc  struct S5 {
83*f4a2713aSLionel Sambuc    int i1;
84*f4a2713aSLionel Sambuc    __unsafe_unretained id o1;
85*f4a2713aSLionel Sambuc    struct V {
86*f4a2713aSLionel Sambuc     int i2;
87*f4a2713aSLionel Sambuc     __unsafe_unretained id o2;
88*f4a2713aSLionel Sambuc    } v1;
89*f4a2713aSLionel Sambuc    int i3;
90*f4a2713aSLionel Sambuc    union UI {
91*f4a2713aSLionel Sambuc        void * i1;
92*f4a2713aSLionel Sambuc        __unsafe_unretained id o1;
93*f4a2713aSLionel Sambuc        int i3;
94*f4a2713aSLionel Sambuc        __unsafe_unretained id o3;
95*f4a2713aSLionel Sambuc    }ui;
96*f4a2713aSLionel Sambuc  };
97*f4a2713aSLionel Sambuc
98*f4a2713aSLionel Sambuc  union U {
99*f4a2713aSLionel Sambuc        void * i1;
100*f4a2713aSLionel Sambuc        __unsafe_unretained id o1;
101*f4a2713aSLionel Sambuc        int i3;
102*f4a2713aSLionel Sambuc        __unsafe_unretained id o3;
103*f4a2713aSLionel Sambuc  }ui;
104*f4a2713aSLionel Sambuc
105*f4a2713aSLionel Sambuc  struct S5 s2;
106*f4a2713aSLionel Sambuc  union U u2;
107*f4a2713aSLionel Sambuc  __block id block_id;
108*f4a2713aSLionel Sambuc
109*f4a2713aSLionel Sambuc/**
110*f4a2713aSLionel Sambucblock variable layout: BL_NON_OBJECT_WORD:1, BL_UNRETAINE:1, BL_NON_OBJECT_WORD:1,
111*f4a2713aSLionel Sambuc                       BL_UNRETAINE:1, BL_NON_OBJECT_WORD:3, BL_BYREF:1, BL_OPERATOR:0
112*f4a2713aSLionel Sambuc*/
113*f4a2713aSLionel Sambuc// CHECK: block variable layout: BL_BYREF:1, BL_NON_OBJECT_WORD:1, BL_UNRETAINED:1, BL_NON_OBJECT_WORD:1, BL_UNRETAINED:1, BL_OPERATOR:0
114*f4a2713aSLionel Sambuc  void (^c)() = ^{
115*f4a2713aSLionel Sambuc    x(s2.ui.o1);
116*f4a2713aSLionel Sambuc    x(u2.o1);
117*f4a2713aSLionel Sambuc    block_id = 0;
118*f4a2713aSLionel Sambuc  };
119*f4a2713aSLionel Sambuc  c();
120*f4a2713aSLionel Sambuc}
121*f4a2713aSLionel Sambuc
122*f4a2713aSLionel Sambuc// Test for array of stuff.
123*f4a2713aSLionel Sambucvoid arr1() {
124*f4a2713aSLionel Sambuc  struct S {
125*f4a2713aSLionel Sambuc    __unsafe_unretained id unsafe_unretained_var[4];
126*f4a2713aSLionel Sambuc } imported_s;
127*f4a2713aSLionel Sambuc
128*f4a2713aSLionel Sambuc// CHECK: block variable layout: BL_UNRETAINED:4, BL_OPERATOR:0
129*f4a2713aSLionel Sambuc    void (^c)() = ^{
130*f4a2713aSLionel Sambuc        x(imported_s.unsafe_unretained_var[2]);
131*f4a2713aSLionel Sambuc    };
132*f4a2713aSLionel Sambuc
133*f4a2713aSLionel Sambuc   c();
134*f4a2713aSLionel Sambuc}
135*f4a2713aSLionel Sambuc
136*f4a2713aSLionel Sambuc// Test2 for array of stuff.
137*f4a2713aSLionel Sambucvoid arr2() {
138*f4a2713aSLionel Sambuc  struct S {
139*f4a2713aSLionel Sambuc   int a;
140*f4a2713aSLionel Sambuc    __unsafe_unretained id unsafe_unretained_var[4];
141*f4a2713aSLionel Sambuc } imported_s;
142*f4a2713aSLionel Sambuc
143*f4a2713aSLionel Sambuc// CHECK: block variable layout: BL_NON_OBJECT_WORD:1, BL_UNRETAINED:4, BL_OPERATOR:0
144*f4a2713aSLionel Sambuc    void (^c)() = ^{
145*f4a2713aSLionel Sambuc        x(imported_s.unsafe_unretained_var[2]);
146*f4a2713aSLionel Sambuc    };
147*f4a2713aSLionel Sambuc
148*f4a2713aSLionel Sambuc   c();
149*f4a2713aSLionel Sambuc}
150*f4a2713aSLionel Sambuc
151*f4a2713aSLionel Sambuc// Test3 for array of stuff.
152*f4a2713aSLionel Sambucvoid arr3() {
153*f4a2713aSLionel Sambuc  struct S {
154*f4a2713aSLionel Sambuc   int a;
155*f4a2713aSLionel Sambuc    __unsafe_unretained id unsafe_unretained_var[0];
156*f4a2713aSLionel Sambuc } imported_s;
157*f4a2713aSLionel Sambuc
158*f4a2713aSLionel Sambuc// CHECK: block variable layout: BL_OPERATOR:0
159*f4a2713aSLionel Sambuc    void (^c)() = ^{
160*f4a2713aSLionel Sambuc      int i = imported_s.a;
161*f4a2713aSLionel Sambuc    };
162*f4a2713aSLionel Sambuc
163*f4a2713aSLionel Sambuc   c();
164*f4a2713aSLionel Sambuc}
165*f4a2713aSLionel Sambuc
166*f4a2713aSLionel Sambuc
167*f4a2713aSLionel Sambuc// Test4 for array of stuff.
168*f4a2713aSLionel Sambuc@class B;
169*f4a2713aSLionel Sambucvoid arr4() {
170*f4a2713aSLionel Sambuc  struct S {
171*f4a2713aSLionel Sambuc    struct s0 {
172*f4a2713aSLionel Sambuc      __unsafe_unretained id s_f0;
173*f4a2713aSLionel Sambuc      __unsafe_unretained id s_f1;
174*f4a2713aSLionel Sambuc    } f0;
175*f4a2713aSLionel Sambuc
176*f4a2713aSLionel Sambuc    __unsafe_unretained id f1;
177*f4a2713aSLionel Sambuc
178*f4a2713aSLionel Sambuc    struct s1 {
179*f4a2713aSLionel Sambuc      int *f0;
180*f4a2713aSLionel Sambuc      __unsafe_unretained B *f1;
181*f4a2713aSLionel Sambuc    } f4[2][2];
182*f4a2713aSLionel Sambuc  } captured_s;
183*f4a2713aSLionel Sambuc
184*f4a2713aSLionel Sambuc// CHECK: block variable layout: BL_UNRETAINED:3, BL_NON_OBJECT_WORD:1, BL_UNRETAINED:1, BL_NON_OBJECT_WORD:1, BL_UNRETAINED:1, BL_NON_OBJECT_WORD:1, BL_UNRETAINED:1, BL_NON_OBJECT_WORD:1, BL_UNRETAINED:1, BL_OPERATOR:0
185*f4a2713aSLionel Sambuc  void (^c)() = ^{
186*f4a2713aSLionel Sambuc      id i = captured_s.f0.s_f1;
187*f4a2713aSLionel Sambuc  };
188*f4a2713aSLionel Sambuc
189*f4a2713aSLionel Sambuc   c();
190*f4a2713aSLionel Sambuc}
191*f4a2713aSLionel Sambuc
192*f4a2713aSLionel Sambuc// Test1 bitfield in cpatured aggregate.
193*f4a2713aSLionel Sambucvoid bf1() {
194*f4a2713aSLionel Sambuc  struct S {
195*f4a2713aSLionel Sambuc    int flag : 25;
196*f4a2713aSLionel Sambuc    int flag1: 7;
197*f4a2713aSLionel Sambuc    int flag2 :1;
198*f4a2713aSLionel Sambuc    int flag3: 7;
199*f4a2713aSLionel Sambuc    int flag4: 24;
200*f4a2713aSLionel Sambuc  } s;
201*f4a2713aSLionel Sambuc
202*f4a2713aSLionel Sambuc// CHECK:  block variable layout: BL_OPERATOR:0
203*f4a2713aSLionel Sambuc  int (^c)() = ^{
204*f4a2713aSLionel Sambuc      return s.flag;
205*f4a2713aSLionel Sambuc  };
206*f4a2713aSLionel Sambuc  c();
207*f4a2713aSLionel Sambuc}
208*f4a2713aSLionel Sambuc
209*f4a2713aSLionel Sambuc// Test2 bitfield in cpatured aggregate.
210*f4a2713aSLionel Sambucvoid bf2() {
211*f4a2713aSLionel Sambuc  struct S {
212*f4a2713aSLionel Sambuc    int flag : 1;
213*f4a2713aSLionel Sambuc  } s;
214*f4a2713aSLionel Sambuc
215*f4a2713aSLionel Sambuc// CHECK: block variable layout: BL_OPERATOR:0
216*f4a2713aSLionel Sambuc  int (^c)() = ^{
217*f4a2713aSLionel Sambuc      return s.flag;
218*f4a2713aSLionel Sambuc  };
219*f4a2713aSLionel Sambuc  c();
220*f4a2713aSLionel Sambuc}
221*f4a2713aSLionel Sambuc
222*f4a2713aSLionel Sambuc// Test3 bitfield in cpatured aggregate.
223*f4a2713aSLionel Sambucvoid bf3() {
224*f4a2713aSLionel Sambuc
225*f4a2713aSLionel Sambuc     struct {
226*f4a2713aSLionel Sambuc        unsigned short _reserved : 16;
227*f4a2713aSLionel Sambuc
228*f4a2713aSLionel Sambuc        unsigned char _draggedNodesAreDeletable: 1;
229*f4a2713aSLionel Sambuc        unsigned char _draggedOutsideOutlineView : 1;
230*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_addRootPaths : 1;
231*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_moveDataNodes : 1;
232*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_removeRootDataNode : 1;
233*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_doubleClickDataNode : 1;
234*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_selectDataNode : 1;
235*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_textDidEndEditing : 1;
236*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_updateAndSaveRoots : 1;
237*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_askToDeleteRootNodes : 1;
238*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_contextMenuForSelectedNodes : 1;
239*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_pasteboardFilenamesForNodes : 1;
240*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_writeItemsToPasteboard : 1;
241*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_writeItemsToPasteboardXXXX : 1;
242*f4a2713aSLionel Sambuc
243*f4a2713aSLionel Sambuc        unsigned int _filler : 32;
244*f4a2713aSLionel Sambuc    } _flags;
245*f4a2713aSLionel Sambuc
246*f4a2713aSLionel Sambuc// CHECK: block variable layout: BL_OPERATOR:0
247*f4a2713aSLionel Sambuc  unsigned char (^c)() = ^{
248*f4a2713aSLionel Sambuc      return _flags._draggedNodesAreDeletable;
249*f4a2713aSLionel Sambuc  };
250*f4a2713aSLionel Sambuc
251*f4a2713aSLionel Sambuc   c();
252*f4a2713aSLionel Sambuc}
253*f4a2713aSLionel Sambuc
254*f4a2713aSLionel Sambuc// Test4 unnamed bitfield
255*f4a2713aSLionel Sambucvoid bf4() {
256*f4a2713aSLionel Sambuc
257*f4a2713aSLionel Sambuc     struct {
258*f4a2713aSLionel Sambuc        unsigned short _reserved : 16;
259*f4a2713aSLionel Sambuc
260*f4a2713aSLionel Sambuc        unsigned char _draggedNodesAreDeletable: 1;
261*f4a2713aSLionel Sambuc        unsigned char _draggedOutsideOutlineView : 1;
262*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_addRootPaths : 1;
263*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_moveDataNodes : 1;
264*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_removeRootDataNode : 1;
265*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_doubleClickDataNode : 1;
266*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_selectDataNode : 1;
267*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_textDidEndEditing : 1;
268*f4a2713aSLionel Sambuc
269*f4a2713aSLionel Sambuc        unsigned long long : 64;
270*f4a2713aSLionel Sambuc
271*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_updateAndSaveRoots : 1;
272*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_askToDeleteRootNodes : 1;
273*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_contextMenuForSelectedNodes : 1;
274*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_pasteboardFilenamesForNodes : 1;
275*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_writeItemsToPasteboard : 1;
276*f4a2713aSLionel Sambuc        unsigned char _adapterRespondsTo_writeItemsToPasteboardXXXX : 1;
277*f4a2713aSLionel Sambuc
278*f4a2713aSLionel Sambuc        unsigned int _filler : 32;
279*f4a2713aSLionel Sambuc    } _flags;
280*f4a2713aSLionel Sambuc
281*f4a2713aSLionel Sambuc// CHECK:  block variable layout: BL_OPERATOR:0
282*f4a2713aSLionel Sambuc  unsigned char (^c)() = ^{
283*f4a2713aSLionel Sambuc      return _flags._draggedNodesAreDeletable;
284*f4a2713aSLionel Sambuc  };
285*f4a2713aSLionel Sambuc
286*f4a2713aSLionel Sambuc   c();
287*f4a2713aSLionel Sambuc}
288*f4a2713aSLionel Sambuc
289*f4a2713aSLionel Sambuc
290*f4a2713aSLionel Sambuc
291*f4a2713aSLionel Sambuc// Test5 unnamed bitfield.
292*f4a2713aSLionel Sambucvoid bf5() {
293*f4a2713aSLionel Sambuc     struct {
294*f4a2713aSLionel Sambuc        unsigned char flag : 1;
295*f4a2713aSLionel Sambuc        unsigned int  : 32;
296*f4a2713aSLionel Sambuc        unsigned char flag1 : 1;
297*f4a2713aSLionel Sambuc    } _flags;
298*f4a2713aSLionel Sambuc
299*f4a2713aSLionel Sambuc// CHECK:  block variable layout: BL_OPERATOR:0
300*f4a2713aSLionel Sambuc  unsigned char (^c)() = ^{
301*f4a2713aSLionel Sambuc      return _flags.flag;
302*f4a2713aSLionel Sambuc  };
303*f4a2713aSLionel Sambuc
304*f4a2713aSLionel Sambuc   c();
305*f4a2713aSLionel Sambuc}
306*f4a2713aSLionel Sambuc
307*f4a2713aSLionel Sambuc
308*f4a2713aSLionel Sambuc// Test6 0 length bitfield.
309*f4a2713aSLionel Sambucvoid bf6() {
310*f4a2713aSLionel Sambuc     struct {
311*f4a2713aSLionel Sambuc        unsigned char flag : 1;
312*f4a2713aSLionel Sambuc        unsigned int  : 0;
313*f4a2713aSLionel Sambuc        unsigned char flag1 : 1;
314*f4a2713aSLionel Sambuc    } _flags;
315*f4a2713aSLionel Sambuc
316*f4a2713aSLionel Sambuc// CHECK: block variable layout: BL_OPERATOR:0
317*f4a2713aSLionel Sambuc  unsigned char (^c)() = ^{
318*f4a2713aSLionel Sambuc      return _flags.flag;
319*f4a2713aSLionel Sambuc  };
320*f4a2713aSLionel Sambuc
321*f4a2713aSLionel Sambuc   c();
322*f4a2713aSLionel Sambuc}
323*f4a2713aSLionel Sambuc
324*f4a2713aSLionel Sambuc// Test7 large number of captured variables.
325*f4a2713aSLionel Sambucvoid Test7() {
326*f4a2713aSLionel Sambuc    __weak id wid;
327*f4a2713aSLionel Sambuc    __weak id wid1, wid2, wid3, wid4;
328*f4a2713aSLionel Sambuc    __weak id wid5, wid6, wid7, wid8;
329*f4a2713aSLionel Sambuc    __weak id wid9, wid10, wid11, wid12;
330*f4a2713aSLionel Sambuc    __weak id wid13, wid14, wid15, wid16;
331*f4a2713aSLionel Sambuc    const id bar = (id) opaque_id();
332*f4a2713aSLionel Sambuc// CHECK: block variable layout: BL_STRONG:1, BL_WEAK:16, BL_OPERATOR:0
333*f4a2713aSLionel Sambuc    void (^b)() = ^{
334*f4a2713aSLionel Sambuc      x(bar);
335*f4a2713aSLionel Sambuc      x(wid1);
336*f4a2713aSLionel Sambuc      x(wid2);
337*f4a2713aSLionel Sambuc      x(wid3);
338*f4a2713aSLionel Sambuc      x(wid4);
339*f4a2713aSLionel Sambuc      x(wid5);
340*f4a2713aSLionel Sambuc      x(wid6);
341*f4a2713aSLionel Sambuc      x(wid7);
342*f4a2713aSLionel Sambuc      x(wid8);
343*f4a2713aSLionel Sambuc      x(wid9);
344*f4a2713aSLionel Sambuc      x(wid10);
345*f4a2713aSLionel Sambuc      x(wid11);
346*f4a2713aSLionel Sambuc      x(wid12);
347*f4a2713aSLionel Sambuc      x(wid13);
348*f4a2713aSLionel Sambuc      x(wid14);
349*f4a2713aSLionel Sambuc      x(wid15);
350*f4a2713aSLionel Sambuc      x(wid16);
351*f4a2713aSLionel Sambuc    };
352*f4a2713aSLionel Sambuc}
353*f4a2713aSLionel Sambuc
354*f4a2713aSLionel Sambuc
355*f4a2713aSLionel Sambuc// Test 8 very large number of captured variables.
356*f4a2713aSLionel Sambucvoid Test8() {
357*f4a2713aSLionel Sambuc__weak id wid;
358*f4a2713aSLionel Sambuc    __weak id wid1, wid2, wid3, wid4;
359*f4a2713aSLionel Sambuc    __weak id wid5, wid6, wid7, wid8;
360*f4a2713aSLionel Sambuc    __weak id wid9, wid10, wid11, wid12;
361*f4a2713aSLionel Sambuc    __weak id wid13, wid14, wid15, wid16;
362*f4a2713aSLionel Sambuc    __weak id w1, w2, w3, w4;
363*f4a2713aSLionel Sambuc    __weak id w5, w6, w7, w8;
364*f4a2713aSLionel Sambuc    __weak id w9, w10, w11, w12;
365*f4a2713aSLionel Sambuc    __weak id w13, w14, w15, w16;
366*f4a2713aSLionel Sambuc    const id bar = (id) opaque_id();
367*f4a2713aSLionel Sambuc// CHECK: block variable layout: BL_STRONG:1, BL_WEAK:16, BL_WEAK:16, BL_WEAK:1, BL_OPERATOR:0
368*f4a2713aSLionel Sambuc    void (^b)() = ^{
369*f4a2713aSLionel Sambuc      x(bar);
370*f4a2713aSLionel Sambuc      x(wid1);
371*f4a2713aSLionel Sambuc      x(wid2);
372*f4a2713aSLionel Sambuc      x(wid3);
373*f4a2713aSLionel Sambuc      x(wid4);
374*f4a2713aSLionel Sambuc      x(wid5);
375*f4a2713aSLionel Sambuc      x(wid6);
376*f4a2713aSLionel Sambuc      x(wid7);
377*f4a2713aSLionel Sambuc      x(wid8);
378*f4a2713aSLionel Sambuc      x(wid9);
379*f4a2713aSLionel Sambuc      x(wid10);
380*f4a2713aSLionel Sambuc      x(wid11);
381*f4a2713aSLionel Sambuc      x(wid12);
382*f4a2713aSLionel Sambuc      x(wid13);
383*f4a2713aSLionel Sambuc      x(wid14);
384*f4a2713aSLionel Sambuc      x(wid15);
385*f4a2713aSLionel Sambuc      x(wid16);
386*f4a2713aSLionel Sambuc      x(w1);
387*f4a2713aSLionel Sambuc      x(w2);
388*f4a2713aSLionel Sambuc      x(w3);
389*f4a2713aSLionel Sambuc      x(w4);
390*f4a2713aSLionel Sambuc      x(w5);
391*f4a2713aSLionel Sambuc      x(w6);
392*f4a2713aSLionel Sambuc      x(w7);
393*f4a2713aSLionel Sambuc      x(w8);
394*f4a2713aSLionel Sambuc      x(w9);
395*f4a2713aSLionel Sambuc      x(w10);
396*f4a2713aSLionel Sambuc      x(w11);
397*f4a2713aSLionel Sambuc      x(w12);
398*f4a2713aSLionel Sambuc      x(w13);
399*f4a2713aSLionel Sambuc      x(w14);
400*f4a2713aSLionel Sambuc      x(w15);
401*f4a2713aSLionel Sambuc      x(w16);
402*f4a2713aSLionel Sambuc      x(wid);
403*f4a2713aSLionel Sambuc    };
404*f4a2713aSLionel Sambuc}
405