summaryrefslogtreecommitdiffstats
path: root/test/Analysis/retain-release.m
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/retain-release.m')
-rw-r--r--test/Analysis/retain-release.m28
1 files changed, 27 insertions, 1 deletions
diff --git a/test/Analysis/retain-release.m b/test/Analysis/retain-release.m
index 3ff007e..c7c5e24 100644
--- a/test/Analysis/retain-release.m
+++ b/test/Analysis/retain-release.m
@@ -704,5 +704,31 @@ void test_attr_1(TestOwnershipAttr *X) {
void test_attr_1b(TestOwnershipAttr *X) {
NSString *str = [X returnsAnOwnedCFString]; // expected-warning{{leak}}
}
-//<<SLICER
+
+@interface MyClassTestCFAttr : NSObject {}
+- (NSDate*) returnsCFRetained __attribute__((cf_returns_retained));
+- (NSDate*) alsoReturnsRetained;
+- (NSDate*) returnsNSRetained __attribute__((ns_returns_retained));
+@end
+
+__attribute__((cf_returns_retained))
+CFDateRef returnsRetainedCFDate() {
+ return CFDateCreate(0, CFAbsoluteTimeGetCurrent());
+}
+
+@implementation MyClassTestCFAttr
+- (NSDate*) returnsCFRetained {
+ return (NSDate*) returnsRetainedCFDate(); // No leak.
+}
+
+- (NSDate*) alsoReturnsRetained {
+ return (NSDate*) returnsRetainedCFDate(); // expected-warning{{leak}}
+}
+
+- (NSDate*) returnsNSRetained {
+ return (NSDate*) returnsRetainedCFDate(); // no-warning
+}
+@end
+
+
OpenPOWER on IntegriCloud