]> granicus.if.org Git - clang/commitdiff
Add a test case for CFMakeCollectable.
authorTed Kremenek <kremenek@apple.com>
Wed, 5 Nov 2008 22:17:39 +0000 (22:17 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 5 Nov 2008 22:17:39 +0000 (22:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58772 91177308-0d34-0410-b5e6-96231b3b80d8

test/Analysis/CFDateGC.m

index 0f693ba7a05aad1b705eecfa9364ec549c8aac87..311371399a463bfb24ca707c138bd2bb758d53bf 100644 (file)
@@ -21,6 +21,7 @@ typedef struct _NSZone NSZone;
 static __inline__ __attribute__((always_inline)) id NSMakeCollectable(CFTypeRef cf) {}
 @protocol NSObject  - (BOOL)isEqual:(id)object; - (oneway void)release; @end
 extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone);
+CFTypeRef CFMakeCollectable(CFTypeRef cf);
 
 //===----------------------------------------------------------------------===//
 // Test cases.
@@ -37,3 +38,15 @@ CFAbsoluteTime f1() {
   return t;
 }
 
+CFAbsoluteTime f1b() {
+  CFAbsoluteTime t = CFAbsoluteTimeGetCurrent();
+  CFDateRef date = CFDateCreate(0, t);
+  CFRetain(date);
+  [(id) CFMakeCollectable(date) release];
+  CFDateGetAbsoluteTime(date); // no-warning
+  t = CFDateGetAbsoluteTime(date);  // no-warning
+  CFRelease(date); // no-warning
+  return t;
+}
+
+