1// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o %t-rw.cpp 2// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp 3// radar 7540194 4 5extern "C" __declspec(dllexport) void BreakTheRewriter(int i) { 6 __block int aBlockVariable = 0; 7 void (^aBlock)(void) = ^ { 8 aBlockVariable = 42; 9 }; 10 aBlockVariable++; 11 if (i) { 12 __block int bbBlockVariable = 0; 13 void (^aBlock)(void) = ^ { 14 bbBlockVariable = 42; 15 }; 16 } 17} 18 19__declspec(dllexport) extern "C" __declspec(dllexport) void XXXXBreakTheRewriter(void) { 20 21 __block int aBlockVariable = 0; 22 void (^aBlock)(void) = ^ { 23 aBlockVariable = 42; 24 }; 25 aBlockVariable++; 26 void (^bBlocks)(void) = ^ { 27 aBlockVariable = 43; 28 }; 29 void (^c)(void) = ^ { 30 aBlockVariable = 44; 31 }; 32 33} 34 35@interface I 36{ 37 id list; 38} 39- (void) Meth; 40// radar 7589385 use before definition 41- (void) allObjects; 42@end 43 44@implementation I 45// radar 7589385 use before definition 46- (void) allObjects { 47 __attribute__((__blocks__(byref))) id *listp; 48 49 ^(void) { 50 *listp++ = 0; 51 }; 52} 53- (void) Meth { __attribute__((__blocks__(byref))) void ** listp = (void **)list; } 54@end 55 56// $CLANG -cc1 -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 -x objective-c++ -fblocks bug.mm 57// g++ -c -D"__declspec(X)=" bug.cpp 58