summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-11-11 02:41:58 +0000
committerJohn McCall <rjmccall@apple.com>2009-11-11 02:41:58 +0000
commit0506e4af2cb1a86a88cf52df7cb5805df861e7ef (patch)
treec408d78c8216fb05adc5401b69fd483f584543b0 /clang/test
parentfde1f8d0d806186b0864067455951d9eb1cb3627 (diff)
downloadbcm5719-llvm-0506e4af2cb1a86a88cf52df7cb5805df861e7ef.tar.gz
bcm5719-llvm-0506e4af2cb1a86a88cf52df7cb5805df861e7ef.zip
Apparently the following idiom is specifically encouraged:
if (self = [super init]) Recognize it and only warn if -Wparentheses is explicitly enabled. llvm-svn: 86790
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaObjC/call-super-2.m10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/call-super-2.m b/clang/test/SemaObjC/call-super-2.m
index a481cffd288..afd35a8e263 100644
--- a/clang/test/SemaObjC/call-super-2.m
+++ b/clang/test/SemaObjC/call-super-2.m
@@ -6,6 +6,7 @@ typedef struct objc_object *id;
id objc_getClass(const char *s);
@interface Object
+- (id) initWithInt: (int) i;
@end
@protocol Func
@@ -28,6 +29,7 @@ id objc_getClass(const char *s);
- (int) instance_func5;
- (int) instance_func6;
- (int) instance_func7;
+- (id) initWithInt: (int) i;
@end
@implementation Derived
@@ -94,5 +96,13 @@ id objc_getClass(const char *s);
{
return [objc_getClass("Derived") class_func1];
}
+- (id) initWithInt: (int) i
+{
+ // Don't warn about parentheses here.
+ if (self = [super initWithInt: i]) {
+ [self instance_func1];
+ }
+ return self;
+}
@end
OpenPOWER on IntegriCloud