From: Ted Kremenek Date: Wed, 5 Nov 2008 22:17:39 +0000 (+0000) Subject: Add a test case for CFMakeCollectable. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2eff0f9e4fe5b7e130dae5edd51cbadad4b348e1;p=clang Add a test case for CFMakeCollectable. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58772 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Analysis/CFDateGC.m b/test/Analysis/CFDateGC.m index 0f693ba7a0..311371399a 100644 --- a/test/Analysis/CFDateGC.m +++ b/test/Analysis/CFDateGC.m @@ -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; +} + +