[llvm-branch-commits] [cfe-branch] r71344 - in /cfe/branches/Apple/Dib/test/Analysis: retain-release-gc-only.m retain-release.m
Mike Stump
mrs at apple.com
Fri May 8 23:23:57 PDT 2009
Author: mrs
Date: Sat May 9 01:23:57 2009
New Revision: 71344
URL: http://llvm.org/viewvc/llvm-project?rev=71344&view=rev
Log:
Merge in 71312:
Add back test cases for ns_returns_retained and cf_returns_retained.
Modified:
cfe/branches/Apple/Dib/test/Analysis/retain-release-gc-only.m
cfe/branches/Apple/Dib/test/Analysis/retain-release.m
Modified: cfe/branches/Apple/Dib/test/Analysis/retain-release-gc-only.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/test/Analysis/retain-release-gc-only.m?rev=71344&r1=71343&r2=71344&view=diff
==============================================================================
--- cfe/branches/Apple/Dib/test/Analysis/retain-release-gc-only.m (original)
+++ cfe/branches/Apple/Dib/test/Analysis/retain-release-gc-only.m Sat May 9 01:23:57 2009
@@ -124,3 +124,20 @@
CFRetain(A);
}
+//===----------------------------------------------------------------------===//
+// Tests of ownership attributes.
+//===----------------------------------------------------------------------===//
+
+ at interface TestOwnershipAttr : NSObject
+- (NSString*) returnsAnOwnedString __attribute__((ns_returns_retained));
+- (NSString*) returnsAnOwnedCFString __attribute__((cf_returns_retained));
+ at end
+
+void test_attr_1(TestOwnershipAttr *X) {
+ NSString *str = [X returnsAnOwnedString]; // no-warning
+}
+
+void test_attr_1b(TestOwnershipAttr *X) {
+ NSString *str = [X returnsAnOwnedCFString]; // expected-warning{{leak}}
+}
+
Modified: cfe/branches/Apple/Dib/test/Analysis/retain-release.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/test/Analysis/retain-release.m?rev=71344&r1=71343&r2=71344&view=diff
==============================================================================
--- cfe/branches/Apple/Dib/test/Analysis/retain-release.m (original)
+++ cfe/branches/Apple/Dib/test/Analysis/retain-release.m Sat May 9 01:23:57 2009
@@ -475,3 +475,20 @@
}
@end
+//===----------------------------------------------------------------------===//
+// Tests of ownership attributes.
+//===----------------------------------------------------------------------===//
+
+ at interface TestOwnershipAttr : NSObject
+- (NSString*) returnsAnOwnedString __attribute__((ns_returns_retained));
+- (NSString*) returnsAnOwnedCFString __attribute__((cf_returns_retained));
+ at end
+
+void test_attr_1(TestOwnershipAttr *X) {
+ NSString *str = [X returnsAnOwnedString]; // expected-warning{{leak}}
+}
+
+void test_attr_1b(TestOwnershipAttr *X) {
+ NSString *str = [X returnsAnOwnedCFString]; // expected-warning{{leak}}
+}
+
More information about the llvm-branch-commits
mailing list