summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-12-17 04:44:43 +0000
committerTed Kremenek <kremenek@apple.com>2010-12-17 04:44:43 +0000
commitedb1cdff77a4ee34dc1abe9d1b5b125d74dc4b2a (patch)
treeaf72b70e566215ebbf2f40dac6e890cadb73eba5 /clang/test/Analysis
parent3a9a2a551c1593e3aeaf2b8a4c25a6b2faca7138 (diff)
downloadbcm5719-llvm-edb1cdff77a4ee34dc1abe9d1b5b125d74dc4b2a.tar.gz
bcm5719-llvm-edb1cdff77a4ee34dc1abe9d1b5b125d74dc4b2a.zip
Revise Cocoa conventions detection: 'copy' and 'mutableCopy'
only indicates the create rule if it starts at the beginning of the method name, not within the method name. llvm-svn: 122036
Diffstat (limited to 'clang/test/Analysis')
-rw-r--r--clang/test/Analysis/refcnt_naming.m8
-rw-r--r--clang/test/Analysis/retain-release.m8
2 files changed, 10 insertions, 6 deletions
diff --git a/clang/test/Analysis/refcnt_naming.m b/clang/test/Analysis/refcnt_naming.m
index 9defce2735e..f84dd6e0543 100644
--- a/clang/test/Analysis/refcnt_naming.m
+++ b/clang/test/Analysis/refcnt_naming.m
@@ -11,6 +11,8 @@ typedef signed char BOOL;
@class NSArray, NSString, NSURL;
@interface NamingTest : NSObject {}
+-(NSObject*)copyPhoto;
+-(NSObject*)mutableCopyPhoto;
-(NSObject*)photocopy; // read as "photocopy"
-(NSObject*)photoCopy; // read as "photo Copy"
-(NSObject*)__blebPRCopy; // read as "bleb PRCopy"
@@ -45,9 +47,11 @@ typedef signed char BOOL;
}
void testNames(NamingTest* x) {
+ [x copyPhoto]; // expected-warning{{leak}}
+ [x mutableCopyPhoto]; // expected-warning{{leak}}
[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
diff --git a/clang/test/Analysis/retain-release.m b/clang/test/Analysis/retain-release.m
index edaedcb4f50..f6e43c99e88 100644
--- a/clang/test/Analysis/retain-release.m
+++ b/clang/test/Analysis/retain-release.m
@@ -762,13 +762,13 @@ int RDar6320065_test() {
@end
@implementation RDar6859457
-- (NSString*) NoCopyString { return [[NSString alloc] init]; } // no-warning
-- (NSString*) noCopyString { return [[NSString alloc] init]; } // no-warning
+- (NSString*) NoCopyString { return [[NSString alloc] init]; } // expected-warning{{leak}}
+- (NSString*) noCopyString { return [[NSString alloc] init]; } // expected-warning{{leak}}
@end
void test_RDar6859457(RDar6859457 *x, void *bytes, NSUInteger dataLength) {
- [x NoCopyString]; // expected-warning{{leak}}
- [x noCopyString]; // expected-warning{{leak}}
+ [x NoCopyString]; // no-warning
+ [x noCopyString]; // no-warning
[NSData dataWithBytesNoCopy:bytes length:dataLength]; // no-warning
[NSData dataWithBytesNoCopy:bytes length:dataLength freeWhenDone:1]; // no-warning
}
OpenPOWER on IntegriCloud