aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-08-07 01:11:14 +0000
committerJordan Rose <jordan_rose@apple.com>2012-08-07 01:11:14 +0000
commitdaa88985ed6d174aeb8c6ddca394f734a73268b7 (patch)
tree4c5772ad8611b25e4ce23a40f4064ca6422b2507
parentc7fb74806190220ba46bc175568f5c0edd49b810 (diff)
[analyzer] Add a test case for OS X 10.8's NSMakeCollectable under non-GC.
This is an additional test for r161349 (ignoring 10.8's annotations for NSMakeCollectable). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161380 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/Analysis/retain-release.m13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/Analysis/retain-release.m b/test/Analysis/retain-release.m
index 87e09e9a83..ba492b7b19 100644
--- a/test/Analysis/retain-release.m
+++ b/test/Analysis/retain-release.m
@@ -300,6 +300,9 @@ extern CGColorSpaceRef CGColorSpaceCreateDeviceRGB(void);
+ (id)array;
@end
+// This is how NSMakeCollectable is declared in the OS X 10.8 headers.
+id NSMakeCollectable(CFTypeRef __attribute__((cf_consumed))) __attribute__((ns_returns_retained));
+
//===----------------------------------------------------------------------===//
// Test cases.
@@ -1842,3 +1845,13 @@ void rdar11400885(int y)
NSLog(@"Again: %@", printString); // expected-warning {{Reference-counted object is used after it is released}}
}
}
+
+id makeCollectableNonLeak() {
+ extern CFTypeRef CFCreateSomething();
+
+ CFTypeRef object = CFCreateSomething(); // +1
+ CFRetain(object); // +2
+ id objCObject = NSMakeCollectable(object); // +2
+ [objCObject release]; // +1
+ return [objCObject autorelease]; // +0
+}