Add a test case for CFMakeCollectable.

llvm-svn: 58772
This commit is contained in:
Ted Kremenek 2008-11-05 22:17:39 +00:00
parent ab4782510b
commit eb39732d53
1 changed files with 13 additions and 0 deletions

View 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;
}