Patrick Beard | acfbe9e | 2012-04-06 18:12:22 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify -Wparentheses -Wno-objc-root-class %s |
John McCall | b0e419e | 2009-11-12 00:06:05 +0000 | [diff] [blame] | 2 | |
Ted Kremenek | 2b2e06d | 2011-04-29 20:30:39 +0000 | [diff] [blame] | 3 | // Don't warn about some common ObjC idioms unless we have -Widiomatic-parentheses on. |
John McCall | b0e419e | 2009-11-12 00:06:05 +0000 | [diff] [blame] | 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 |