1// 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// RUN: FileCheck --input-file=%t-32.layout %s 3// rdar://12184410 4// rdar://12752901 5 6@class NSString; 7extern void NSLog(NSString *format, ...); 8extern int printf(const char *, ...); 9 10int main() { 11 NSString *strong; 12 unsigned long long eightByte = 0x8001800181818181ull; 13 // Test1 14 // CHECK: Inline block variable layout: 0x0100, BL_STRONG:1, BL_OPERATOR:0 15 void (^block1)() = ^{ printf("%#llx", eightByte); NSLog(@"%@", strong); }; 16 17 // Test2 18 int i = 1; 19 // CHECK: Inline block variable layout: 0x0100, BL_STRONG:1, BL_OPERATOR:0 20 void (^block2)() = ^{ printf("%#llx, %d", eightByte, i); NSLog(@"%@", strong); }; 21 22 // Test3 23 char ch = 'a'; 24 // CHECK: Inline block variable layout: 0x0100, BL_STRONG:1, BL_OPERATOR:0 25 void (^block3)() = ^{ printf("%c %#llx", ch, eightByte); NSLog(@"%@", strong); }; 26 27 // Test4 28 unsigned long fourByte = 0x8001ul; 29 // CHECK: Inline block variable layout: 0x0100, BL_STRONG:1, BL_OPERATOR:0 30 void (^block4)() = ^{ printf("%c %#lx", ch, fourByte); NSLog(@"%@", strong); }; 31 32 // Test5 33 // CHECK: Inline block variable layout: 0x0100, BL_STRONG:1, BL_OPERATOR:0 34 void (^block5)() = ^{ NSLog(@"%@", strong); printf("%c %#llx", ch, eightByte); }; 35 36 // Test6 37 // CHECK: Block variable layout: BL_OPERATOR:0 38 void (^block6)() = ^{ printf("%#llx", eightByte); }; 39} 40 41/** 42struct __block_literal_generic { // 32bytes (64bit) and 20 bytes (32bit). 430 void *__isa; 444 int __flags; 458 int __reserved; 4612 void (*__invoke)(void *); 4716 struct __block_descriptor *__descriptor; 48}; 49*/ 50