In the latest episode of "Deserializing bugs caused by accessors" the series reached...
[clang.git] / test / Rewriter / rewrite-foreach-5.m
blobadfd7f837841628efcdf4162e9029beeb0ee1eb3
1 // RUN: %clang_cc1 -rewrite-objc %s -o -
3 @interface MyList
4 - (id) allKeys;
5 @end
6     
7 @implementation MyList
8 - (unsigned int)countByEnumeratingWithState:  (struct __objcFastEnumerationState *)state objects:  (id *)items count:(unsigned int)stackcount
10         return 0;
12 - (id) allKeys { return 0; }
13 @end
15 @interface MyList (BasicTest)
16 - (void)compilerTestAgainst;
17 @end
19 int LOOP();
20 @implementation MyList (BasicTest)
21 - (void)compilerTestAgainst {
22   MyList * el;
23   int i;
24         for (el in [el allKeys]) { 
25                 for (i = 0; i < 10; i++)
26                   if (i == 5)
27                    break;
29                 if (el == 0)
30                  break;
31                 if (el != self)
32                   continue;
33                 LOOP(); 
34           }
36         for (id el1 in[el allKeys]) { 
37             LOOP(); 
38             for (el in self) {
39               if (el)
40                 continue;
41             }
42             if (el1)
43               break;
44           }
46 @end