xref: /minix3/external/bsd/llvm/dist/clang/test/Rewriter/rewrite-foreach-5.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// 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*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fsyntax-only -fblocks -Wno-address-of-temporary -D"id=struct objc_object*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambucvoid *sel_registerName(const char *);
5*f4a2713aSLionel Sambucvoid objc_enumerationMutation(id);
6*f4a2713aSLionel Sambuc
7*f4a2713aSLionel Sambuc@interface MyList
8*f4a2713aSLionel Sambuc- (id) allKeys;
9*f4a2713aSLionel Sambuc@end
10*f4a2713aSLionel Sambuc
11*f4a2713aSLionel Sambuc@implementation MyList
12*f4a2713aSLionel Sambuc- (unsigned int)countByEnumeratingWithState:  (struct __objcFastEnumerationState *)state objects:  (id *)items count:(unsigned int)stackcount
13*f4a2713aSLionel Sambuc{
14*f4a2713aSLionel Sambuc        return 0;
15*f4a2713aSLionel Sambuc}
16*f4a2713aSLionel Sambuc- (id) allKeys { return 0; }
17*f4a2713aSLionel Sambuc@end
18*f4a2713aSLionel Sambuc
19*f4a2713aSLionel Sambuc@interface MyList (BasicTest)
20*f4a2713aSLionel Sambuc- (void)compilerTestAgainst;
21*f4a2713aSLionel Sambuc@end
22*f4a2713aSLionel Sambuc
23*f4a2713aSLionel Sambucint LOOP();
24*f4a2713aSLionel Sambuc@implementation MyList (BasicTest)
25*f4a2713aSLionel Sambuc- (void)compilerTestAgainst {
26*f4a2713aSLionel Sambuc  MyList * el;
27*f4a2713aSLionel Sambuc  int i;
28*f4a2713aSLionel Sambuc        for (el in [el allKeys]) {
29*f4a2713aSLionel Sambuc		for (i = 0; i < 10; i++)
30*f4a2713aSLionel Sambuc		  if (i == 5)
31*f4a2713aSLionel Sambuc		   break;
32*f4a2713aSLionel Sambuc
33*f4a2713aSLionel Sambuc		if (el == 0)
34*f4a2713aSLionel Sambuc		 break;
35*f4a2713aSLionel Sambuc		if (el != self)
36*f4a2713aSLionel Sambuc		  continue;
37*f4a2713aSLionel Sambuc		LOOP();
38*f4a2713aSLionel Sambuc	  }
39*f4a2713aSLionel Sambuc
40*f4a2713aSLionel Sambuc        for (id el1 in[el allKeys]) {
41*f4a2713aSLionel Sambuc	    LOOP();
42*f4a2713aSLionel Sambuc	    for (el in self) {
43*f4a2713aSLionel Sambuc	      if (el)
44*f4a2713aSLionel Sambuc		continue;
45*f4a2713aSLionel Sambuc	    }
46*f4a2713aSLionel Sambuc	    if (el1)
47*f4a2713aSLionel Sambuc	      break;
48*f4a2713aSLionel Sambuc	  }
49*f4a2713aSLionel Sambuc}
50*f4a2713aSLionel Sambuc@end
51*f4a2713aSLionel Sambuc
52