summaryrefslogtreecommitdiffstats
path: root/test/Analysis/delegates.m
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/delegates.m')
-rw-r--r--test/Analysis/delegates.m25
1 files changed, 21 insertions, 4 deletions
diff --git a/test/Analysis/delegates.m b/test/Analysis/delegates.m
index 8f42b83..7fc4f2b 100644
--- a/test/Analysis/delegates.m
+++ b/test/Analysis/delegates.m
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount -analyzer-store=region -verify %s
+// RUN: %clang_cc1 -analyze -analyzer-checker=core,osx.cocoa.RetainCount -analyzer-store=region -Wno-objc-root-class -verify %s
//===----------------------------------------------------------------------===//
@@ -96,13 +96,12 @@ extern void *_NSConstantStringClassReference;
@implementation test_6062730
- (void) foo {
- NSString *str = [[NSString alloc] init];
+ NSString *str = [[NSString alloc] init]; // no-warning
[test_6062730 performSelectorOnMainThread:@selector(postNotification:) withObject:str waitUntilDone:1];
}
- (void) bar {
- NSString *str = [[NSString alloc] init]; // expected-warning{{leak}}
- // FIXME: We need to resolve [self class] to 'test_6062730'.
+ NSString *str = [[NSString alloc] init]; // no-warning
[[self class] performSelectorOnMainThread:@selector(postNotification:) withObject:str waitUntilDone:1];
}
@@ -111,3 +110,21 @@ extern void *_NSConstantStringClassReference;
}
@end
+
+@interface ObjectThatRequiresDelegate : NSObject
+- (id)initWithDelegate:(id)delegate;
+- (id)initWithNumber:(int)num delegate:(id)delegate;
+@end
+
+
+@interface DelegateRequirerTest
+@end
+@implementation DelegateRequirerTest
+
+- (void)test {
+ (void)[[ObjectThatRequiresDelegate alloc] initWithDelegate:self];
+ (void)[[ObjectThatRequiresDelegate alloc] initWithNumber:0 delegate:self];
+ // no leak warnings -- these objects could be released in callback methods
+}
+
+@end
OpenPOWER on IntegriCloud