summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-11-12 00:06:05 +0000
committerJohn McCall <rjmccall@apple.com>2009-11-12 00:06:05 +0000
commitb0e419e34dc06187c3b26dedb2d7eee3e9301a2f (patch)
treea7d925d5d2b7e75deb45636c17e0e52bb426ef3b /clang/test
parentc998409cceb9a781cce489f2c82675724c69f62f (diff)
downloadbcm5719-llvm-b0e419e34dc06187c3b26dedb2d7eee3e9301a2f.tar.gz
bcm5719-llvm-b0e419e34dc06187c3b26dedb2d7eee3e9301a2f.zip
Add <foo> = [<bar> nextObject] to the -Widiomatic-parentheses category,
and give that category an explicit test. Generalize the internal diagnostic name. llvm-svn: 86905
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaObjC/idiomatic-parentheses.m35
1 files changed, 35 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/idiomatic-parentheses.m b/clang/test/SemaObjC/idiomatic-parentheses.m
new file mode 100644
index 00000000000..b4c52fa0d14
--- /dev/null
+++ b/clang/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
OpenPOWER on IntegriCloud