John McCall | c8d8ac5 | 2009-11-12 00:06:05 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
| 2 | |
| 3 | // Don't warn about some common ObjC idioms unless we have -Wparentheses on. |
| 4 | // <rdar://problem/7382435> |
| 5 | |
| 6 | @interface Object |
| 7 | - (id) init; |
| 8 | - (id) initWithInt: (int) i; |
| 9 | - (void) iterate: (id) coll; |
| 10 | - (id) nextObject; |
| 11 | @end |
| 12 | |
| 13 | @implementation Object |
| 14 | - (id) init { |
| 15 | if (self = [self init]) { |
| 16 | } |
| 17 | return self; |
| 18 | } |
| 19 | |
| 20 | - (id) initWithInt: (int) i { |
| 21 | if (self = [self initWithInt: i]) { |
| 22 | } |
| 23 | return self; |
| 24 | } |
| 25 | |
| 26 | - (void) iterate: (id) coll { |
| 27 | id cur; |
| 28 | while (cur = [coll nextObject]) { |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | - (id) nextObject { |
| 33 | return self; |
| 34 | } |
| 35 | @end |