1// RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc %s -o %t-rw.cpp 2// RUN: %clang_cc1 -fsyntax-only -Werror -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -U__declspec -D"__declspec(X)=" %t-rw.cpp 3 4typedef unsigned long size_t; 5typedef struct { 6 char byte0; 7 char byte1; 8} CFUUIDBytes; 9 10void x(void *); 11 12void y() { 13 __block CFUUIDBytes bytes; 14 15 void (^bar)() = ^{ 16 x(&bytes); 17 }; 18} 19 20int foo() { 21 __block int hello; 22 return hello; 23} 24 25// rewriting multiple __block decls on wintin same decl stmt. 26void radar7547630() { 27 __block int BI1, BI2; 28 29 __block float FLOAT1, FT2, FFFFFFFF3, 30 FFFXXX4; 31 32 __block void (^B)(), (^BB)(); 33} 34 35// rewriting multiple __block decls on wintin same decl stmt 36// with initializers. 37int rdar7547630(const char *keybuf, const char *valuebuf) { 38 __block int BI1 = 1, BI2 = 2; 39 40 double __block BYREFVAR = 1.34, BYREFVAR_NO_INIT, BYREFVAR2 = 1.37; 41 42 __block const char *keys = keybuf, *values = valuebuf, *novalues; 43 44 return BI2; 45} 46 47typedef struct _z { 48 int location; 49 int length; 50} z; 51 52z w(int loc, int len); 53 54@interface rdar11326988 55@end 56@implementation rdar11326988 57- (void)y:(int)options { 58 __attribute__((__blocks__(byref))) z firstRange = w(1, 0); 59 options &= ~(1 | 2); 60} 61@end 62 63int Test18799145() { return ^(){return 0;}(); } 64