57 lines · plain
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.cpp2// RUN: %clang_cc1 -fsyntax-only -std=gnu++98 -fblocks -Wno-address-of-temporary -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp3 4extern "C" __declspec(dllexport) void BreakTheRewriter(int i) {5 __block int aBlockVariable = 0;6 void (^aBlock)(void) = ^ {7 aBlockVariable = 42;8 };9 aBlockVariable++;10 if (i) {11 __block int bbBlockVariable = 0;12 void (^aBlock)(void) = ^ {13 bbBlockVariable = 42;14 };15 }16}17 18__declspec(dllexport) extern "C" __declspec(dllexport) void XXXXBreakTheRewriter(void) {19 20 __block int aBlockVariable = 0;21 void (^aBlock)(void) = ^ {22 aBlockVariable = 42;23 };24 aBlockVariable++;25 void (^bBlocks)(void) = ^ {26 aBlockVariable = 43;27 };28 void (^c)(void) = ^ {29 aBlockVariable = 44;30 };31 32}33 34@interface I35{36 id list;37}38- (void) Meth;39// use before definition40- (void) allObjects;41@end42 43@implementation I44// use before definition45- (void) allObjects {46 __attribute__((__blocks__(byref))) id *listp;47 48 ^(void) {49 *listp++ = 0;50 };51}52- (void) Meth { __attribute__((__blocks__(byref))) void ** listp = (void **)list; }53@end54 55// $CLANG -cc1 -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 -x objective-c++ -fblocks bug.mm56// g++ -c -D"__declspec(X)=" bug.cpp57