diff options
Diffstat (limited to 'test/SemaObjC/idiomatic-parentheses.m')
-rw-r--r-- | test/SemaObjC/idiomatic-parentheses.m | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/SemaObjC/idiomatic-parentheses.m b/test/SemaObjC/idiomatic-parentheses.m new file mode 100644 index 0000000000000..b4c52fa0d1462 --- /dev/null +++ b/test/SemaObjC/idiomatic-parentheses.m @@ -0,0 +1,35 @@ +// RUN: clang-cc -fsyntax-only -verify %s + +// Don't warn about some common ObjC idioms unless we have -Wparentheses on. +// <rdar://problem/7382435> + +@interface Object +- (id) init; +- (id) initWithInt: (int) i; +- (void) iterate: (id) coll; +- (id) nextObject; +@end + +@implementation Object +- (id) init { + if (self = [self init]) { + } + return self; +} + +- (id) initWithInt: (int) i { + if (self = [self initWithInt: i]) { + } + return self; +} + +- (void) iterate: (id) coll { + id cur; + while (cur = [coll nextObject]) { + } +} + +- (id) nextObject { + return self; +} +@end |