Enhance ownership attribute tests with functions that use the attributes!

llvm-svn: 70984
This commit is contained in:
Ted Kremenek 2009-05-05 17:46:22 +00:00
parent 44f9d7a8f0
commit dad8889d62
1 changed files with 16 additions and 0 deletions

View File

@ -463,6 +463,22 @@ void test_attr_1b(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedCFString]; // expected-warning{{leak}}
}
__attribute__((ns_returns_owned))
NSString* test_attr_1c(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedString]; // no-warning
return str;
}
void test_attr_1d_helper(NSString* str __attribute__((ns_retains)));
__attribute__((ns_returns_owned))
NSString* test_attr_1d(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedString]; // expected-warning{{leak}}
test_attr_1d_helper(str);
return str;
}
void test_attr_2(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedString]; // expected-warning{{leak}}
[X myRetain:str];