brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · dcbc06c Raw
92 lines · plain
1// RUN: %clang_cc1 -fms-extensions -U__declspec -rewrite-objc -x objective-c++ -fblocks -o %t-rw.cpp %s2// RUN: %clang_cc1 -fsyntax-only -std=gnu++98 -Werror -Wno-address-of-temporary -Wno-attributes -D"Class=void*" -D"id=void*" -D"SEL=void*" -U__declspec -D"__declspec(X)=" %t-rw.cpp3 4typedef unsigned long size_t;5extern "C" __declspec(dllexport) void BreakTheRewriter(void) {6        __block int aBlockVariable = 0;7        void (^aBlock)(void) = ^ {8                aBlockVariable = 42;9        };10        aBlockVariable++;11        void (^bBlocks)(void) = ^ {12                aBlockVariable = 43;13        };14        void (^c)(void) = ^ {15                aBlockVariable = 44;16        };17 18}19__declspec(dllexport) extern "C" void AnotherBreakTheRewriter(int *p1, double d) {20 21        __block int bBlockVariable = 0;22        void (^aBlock)(void) = ^ {23                bBlockVariable = 42;24        };25        bBlockVariable++;26        void (^bBlocks)(void) = ^ {27                bBlockVariable = 43;28        };29        void (^c)(void) = ^ {30                bBlockVariable = 44;31        };32 33}34 35int36 37__declspec (dllexport)38 39main (int argc, char *argv[])40{41        __block int bBlockVariable = 0;42        void (^aBlock)(void) = ^ {43                bBlockVariable = 42;44        };45}46 47static char stringtype;48char CFStringGetTypeID();49void x(void (^)());50 51static void initStatics(int arg, ...) {52    x(^{53        stringtype = CFStringGetTypeID();54    });55}56static void initStatics1(...) {57    x(^{58        stringtype = CFStringGetTypeID();59    });60}61static void initStatics2() {62    x(^{63        stringtype = CFStringGetTypeID();64    });65}66 67static inline const void *auto_zone_base_pointer(void *zone, const void *ptr) { return 0; }68 69@interface I70{71   id list;72}73- (void) Meth;74// use before definition75- (void) allObjects;76@end77 78@implementation I79// use before definition80- (void) allObjects {81    __attribute__((__blocks__(byref))) id *listp;82 83    void (^B)(void) = ^(void) {84      *listp++ = 0;85    };86 87    B();88}89- (void) Meth { __attribute__((__blocks__(byref))) void ** listp = (void **)list; }90@end91 92