xref: /aosp_15_r20/external/clang/test/Rewriter/rewrite-foreach-1.m (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li// RUN: %clang_cc1 -rewrite-objc -fobjc-runtime=macosx-fragile-10.5  %s -o -
2*67e74705SXin Li
3*67e74705SXin Li@protocol P @end
4*67e74705SXin Li
5*67e74705SXin Li@interface MyList
6*67e74705SXin Li@end
7*67e74705SXin Li
8*67e74705SXin Li@implementation MyList
9*67e74705SXin Li- (unsigned int)countByEnumeratingWithState:  (struct __objcFastEnumerationState *)state objects:  (id *)items count:(unsigned int)stackcount
10*67e74705SXin Li{
11*67e74705SXin Li        return 0;
12*67e74705SXin Li}
13*67e74705SXin Li@end
14*67e74705SXin Li
15*67e74705SXin Li@interface MyList (BasicTest)
16*67e74705SXin Li- (void)compilerTestAgainst;
17*67e74705SXin Li@end
18*67e74705SXin Li
19*67e74705SXin Liint LOOP();
20*67e74705SXin Li@implementation MyList (BasicTest)
21*67e74705SXin Li- (void)compilerTestAgainst {
22*67e74705SXin Li  id el;
23*67e74705SXin Li        for (el in self)
24*67e74705SXin Li	  { LOOP(); }
25*67e74705SXin Li        for (id el1 in self)
26*67e74705SXin Li	  LOOP();
27*67e74705SXin Li
28*67e74705SXin Li	for (el in (self))
29*67e74705SXin Li          if (el)
30*67e74705SXin Li            LOOP();
31*67e74705SXin Li
32*67e74705SXin Li	for (el in ((self)))
33*67e74705SXin Li          if (el)
34*67e74705SXin Li            LOOP();
35*67e74705SXin Li}
36*67e74705SXin Li@end
37*67e74705SXin Li
38