Improve retain/release test cases for ownership attributes.

llvm-svn: 70327
This commit is contained in:
Ted Kremenek 2009-04-28 21:43:40 +00:00
parent b925652433
commit 89c3861061
2 changed files with 46 additions and 4 deletions

View File

@ -152,13 +152,31 @@ void test_attr_3(TestOwnershipAttr *X) {
[str release];
}
void test_attr_4(TestOwnershipAttr *X) {
void test_attr_4a(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedString]; // no-warning
}
void test_attr_4b(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedString]; // no-warning
[X myRelease:str];
}
void test_attr_4c(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedString]; // no-warning
[X myRetain:str];
[X myRelease:str];
}
void test_attr_5(TestOwnershipAttr *X) {
void test_attr_5a(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedString]; // no-waring
}
void test_attr_5b(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedString];
[X myCFRelease:str]; // expected-warning{{Incorrect decrement of the reference count of an object is not owned at this point by the caller}}
}
void test_attr_5c(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedString]; // no-warning
[X myCFRetain:str];
[X myCFRelease:str];

View File

@ -433,13 +433,37 @@ void test_attr_3(TestOwnershipAttr *X) {
[str release];
}
void test_attr_4(TestOwnershipAttr *X) {
void test_attr_4a(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedString]; // expected-warning{{leak}}
}
void test_attr_4b(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedString]; // no-warning
[X myRelease:str];
}
void test_attr_4c(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedString]; // expected-warning{{leak}}
[X myRetain:str];
[X myRelease:str];
}
void test_attr_5(TestOwnershipAttr *X) {
void test_attr_4d(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedString];
[X myRelease:str];
[X myRelease:str]; // expected-warning{{Reference-counted object is used after it is released}}
}
void test_attr_5a(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedString]; // expected-warning{{leak}}
}
void test_attr_5b(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedString]; // no-warning
[X myCFRelease:str];
}
void test_attr_5c(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedString]; // expected-warning{{leak}}
[X myCFRetain:str];
[X myCFRelease:str];