summaryrefslogtreecommitdiffstats
path: root/test/Analysis/refcnt_naming.m
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/refcnt_naming.m')
-rw-r--r--test/Analysis/refcnt_naming.m29
1 files changed, 26 insertions, 3 deletions
diff --git a/test/Analysis/refcnt_naming.m b/test/Analysis/refcnt_naming.m
index 9defce2..7299001 100644
--- a/test/Analysis/refcnt_naming.m
+++ b/test/Analysis/refcnt_naming.m
@@ -11,6 +11,10 @@ typedef signed char BOOL;
@class NSArray, NSString, NSURL;
@interface NamingTest : NSObject {}
+-(NSObject*)copyPhoto;
+-(NSObject*)mutableCopyPhoto;
+-(NSObject*)mutable;
+-(NSObject*)mutableCopying;
-(NSObject*)photocopy; // read as "photocopy"
-(NSObject*)photoCopy; // read as "photo Copy"
-(NSObject*)__blebPRCopy; // read as "bleb PRCopy"
@@ -26,7 +30,9 @@ typedef signed char BOOL;
}
- (NSURL *)myMethod:(NSString *)inString;
- (NSURL *)getMethod:(NSString*)inString;
-- (void)addObject:(id)X;
+- (NSURL *)getMethod2:(NSString*)inString;
+- (void)addObject:(id) __attribute__((ns_consumed)) X;
+- (void)addObject2:(id) X;
@end
@implementation MyClass
@@ -44,10 +50,21 @@ typedef signed char BOOL;
return url; // no-warning
}
+- (NSURL *)getMethod2:(NSString *)inString
+{
+ NSURL *url = (NSURL *)CFURLCreateWithString(0, (CFStringRef)inString, 0); // expected-warning{{leak}}
+ [self addObject2:url];
+ return url;
+}
+
void testNames(NamingTest* x) {
+ [x copyPhoto]; // expected-warning{{leak}}
+ [x mutableCopyPhoto]; // expected-warning{{leak}}
+ [x mutable]; // no-warning
+ [x mutableCopying]; // no-warning
[x photocopy]; // no-warning
- [x photoCopy]; // expected-warning{{leak}}
- [x __blebPRCopy]; // expected-warning{{leak}}
+ [x photoCopy]; // no-warning
+ [x __blebPRCopy]; // no-warning
[x __blebPRcopy]; // no-warning
[x new_theprefixdoescount]; // expected-warning{{leak}}
[x newestAwesomeStuff]; // no-warning
@@ -59,4 +76,10 @@ void testNames(NamingTest* x) {
myObject = X;
}
+- (void)addObject2:(id)X
+{
+ myObject = X;
+}
+
@end
+
OpenPOWER on IntegriCloud