xref: /llvm-project/clang/test/Rewriter/rewrite-foreach-in-block.mm (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
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 -std=gnu++98 -Wno-address-of-temporary -D"id=struct objc_object*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
3// RUN: %clang_cc1 -x objective-c++ -Wno-return-type -fblocks -fms-extensions -rewrite-objc %s -o %t-modern-rw.cpp
4// RUN: %clang_cc1 -fsyntax-only -std=gnu++98 -Wno-address-of-temporary -D"id=struct objc_object*" -D"SEL=void*" -D"__declspec(X)=" %t-modern-rw.cpp
5
6typedef unsigned long size_t;
7
8void objc_enumerationMutation(id);
9void *sel_registerName(const char *);
10typedef void (^CoreDAVCompletionBlock)(void);
11
12@interface I
13- (void)M;
14- (id) ARR;
15@property (readwrite, copy, nonatomic) CoreDAVCompletionBlock c;
16@end
17
18@implementation I
19- (void)M {
20    I* ace;
21    self.c = ^() {
22          // Basic correctness check for the changes.
23	  [ace ARR];
24          for (I *privilege in [ace ARR]) { }
25    };
26    self.c = ^() {
27          // Basic correctness test for the changes.
28	  [ace ARR];
29    };
30}
31@end
32