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