summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2012-12-13 00:42:19 +0000
committerAnna Zaks <ganna@apple.com>2012-12-13 00:42:19 +0000
commit3f12949b256bbdbaad89fee9671d1236e99ea1d1 (patch)
tree16833c9ae7ce4ccc527d15d8ad1533f7c9f85f9c /clang/test/Analysis
parentb487388be1f45cfea1e24be8e35c485b20e47045 (diff)
downloadbcm5719-llvm-3f12949b256bbdbaad89fee9671d1236e99ea1d1.tar.gz
bcm5719-llvm-3f12949b256bbdbaad89fee9671d1236e99ea1d1.zip
[analyzer] Fix a self-init checker false positive.
This is a Band-Aid fix to a false positive, where we complain about not initializing self to [super init], where self is not coming from the init method, but is coming from the caller to init. The proper solution would be to associate the self and it's state with the enclosing init. llvm-svn: 170059
Diffstat (limited to 'clang/test/Analysis')
-rw-r--r--clang/test/Analysis/self-init.m25
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/test/Analysis/self-init.m b/clang/test/Analysis/self-init.m
index b0c51a2b37e..d8e8888287d 100644
--- a/clang/test/Analysis/self-init.m
+++ b/clang/test/Analysis/self-init.m
@@ -281,3 +281,28 @@ typedef signed char BOOL;
}
@end
+// Test for radar://12838705.
+@interface ABCClass : NSObject
+@property (nonatomic, strong) NSString *foo;
+@property (nonatomic, strong) NSString *bar;
+@property (nonatomic, strong) NSString *baz;
+@end
+
+@implementation ABCClass
+@synthesize foo = foo_;
+@synthesize bar = bar_;
+@synthesize baz = baz_;
+
+- (id)initWithABC:(ABCClass *)abc {
+ self = [super init];
+ baz_ = abc->baz_;
+ return self;
+}
+
+- (ABCClass *)abcWithFoo:(NSString *)foo {
+ ABCClass *copy = [[ABCClass alloc] initWithABC:self];
+ return copy;
+}
+
+@end
+
OpenPOWER on IntegriCloud