John McCall | 260611a | 2012-06-20 06:18:46 +0000 | [diff] [blame] | 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 |
Fariborz Jahanian | 3cd1ea3 | 2010-12-04 21:22:13 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -fsyntax-only -fms-extensions -Wno-address-of-temporary -Did="void *" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp |
Steve Naroff | 8599e7a | 2008-12-08 16:43:47 +0000 | [diff] [blame] | 3 | |
Fariborz Jahanian | 3cd1ea3 | 2010-12-04 21:22:13 +0000 | [diff] [blame] | 4 | void *sel_registerName(const char *); |
John McCall | f6a1648 | 2010-12-04 03:47:34 +0000 | [diff] [blame] | 5 | |
Steve Naroff | 8599e7a | 2008-12-08 16:43:47 +0000 | [diff] [blame] | 6 | @interface Foo { |
| 7 | int i; |
| 8 | int rrrr; |
| 9 | Foo *o; |
| 10 | } |
| 11 | @property int i; |
| 12 | @property(readonly) int rrrr; |
| 13 | @property int d; |
| 14 | @property(retain) Foo *o; |
| 15 | |
| 16 | - (void)foo; |
| 17 | @end |
| 18 | |
| 19 | @implementation Foo |
| 20 | @synthesize i; |
| 21 | @synthesize rrrr; |
| 22 | @synthesize o; |
| 23 | |
| 24 | @dynamic d; |
| 25 | |
| 26 | - (void)foo { |
| 27 | i = 99; |
| 28 | } |
| 29 | |
| 30 | - (int)bar { |
| 31 | return i; |
| 32 | } |
| 33 | @end |
| 34 | |
| 35 | @interface Bar { |
| 36 | } |
| 37 | @end |
| 38 | |
| 39 | @implementation Bar |
| 40 | |
John McCall | 15e310a | 2011-02-19 02:53:41 +0000 | [diff] [blame] | 41 | static int func(int i) { return 0; } |
Steve Naroff | 8599e7a | 2008-12-08 16:43:47 +0000 | [diff] [blame] | 42 | |
| 43 | - (void)baz { |
| 44 | Foo *obj1, *obj2; |
| 45 | int i; |
| 46 | if (obj1.i == obj2.rrrr) |
| 47 | obj1.i = 33; |
| 48 | obj1.i = func(obj2.rrrr); |
| 49 | obj1.i = obj2.rrrr; |
| 50 | obj1.i = (obj2.rrrr); |
| 51 | [obj1 setI:[obj2 rrrr]]; |
| 52 | obj1.i = [obj2 rrrr]; |
Steve Naroff | b619d95 | 2008-12-09 12:56:34 +0000 | [diff] [blame] | 53 | obj1.i = 3 + [obj2 rrrr]; |
Steve Naroff | 8599e7a | 2008-12-08 16:43:47 +0000 | [diff] [blame] | 54 | i = obj1.o.i; |
| 55 | obj1.o.i = 77; |
| 56 | } |
| 57 | @end |