[cfe-commits] r70327 - in /cfe/trunk/test/Analysis: retain-release-gc-only.m retain-release.m
Ted Kremenek
kremenek at apple.com
Tue Apr 28 14:43:40 PDT 2009
Author: kremenek
Date: Tue Apr 28 16:43:40 2009
New Revision: 70327
URL: http://llvm.org/viewvc/llvm-project?rev=70327&view=rev
Log:
Improve retain/release test cases for ownership attributes.
Modified:
cfe/trunk/test/Analysis/retain-release-gc-only.m
cfe/trunk/test/Analysis/retain-release.m
Modified: cfe/trunk/test/Analysis/retain-release-gc-only.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/retain-release-gc-only.m?rev=70327&r1=70326&r2=70327&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/retain-release-gc-only.m (original)
+++ cfe/trunk/test/Analysis/retain-release-gc-only.m Tue Apr 28 16:43:40 2009
@@ -152,13 +152,31 @@
[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];
Modified: cfe/trunk/test/Analysis/retain-release.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/retain-release.m?rev=70327&r1=70326&r2=70327&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/retain-release.m (original)
+++ cfe/trunk/test/Analysis/retain-release.m Tue Apr 28 16:43:40 2009
@@ -433,13 +433,37 @@
[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];
More information about the cfe-commits
mailing list