[cfe-commits] r64960 - /cfe/trunk/test/Analysis/retain-release-gc-only.m
Ted Kremenek
kremenek at apple.com
Wed Feb 18 14:11:23 PST 2009
Author: kremenek
Date: Wed Feb 18 16:11:23 2009
New Revision: 64960
URL: http://llvm.org/viewvc/llvm-project?rev=64960&view=rev
Log:
Add a few more GC-only test cases for the retain/release checker.
Modified:
cfe/trunk/test/Analysis/retain-release-gc-only.m
Modified: cfe/trunk/test/Analysis/retain-release-gc-only.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/retain-release-gc-only.m?rev=64960&r1=64959&r2=64960&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/retain-release-gc-only.m (original)
+++ cfe/trunk/test/Analysis/retain-release-gc-only.m Wed Feb 18 16:11:23 2009
@@ -13,6 +13,7 @@
extern const CFAllocatorRef kCFAllocatorDefault;
extern CFTypeRef CFRetain(CFTypeRef cf);
extern void CFRelease(CFTypeRef cf);
+CFTypeRef CFMakeCollectable(CFTypeRef cf);
typedef struct {
}
CFArrayCallBacks;
@@ -75,7 +76,20 @@
//===----------------------------------------------------------------------===//
void f1() {
- CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks);
+ CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // no-warning
id x = [(id) A autorelease];
- CFRelease((CFMutableArrayRef) x); // no-warning
+ CFRelease((CFMutableArrayRef) x);
+}
+
+void f2() {
+ CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // expected-warning{{leak}}
+ id x = [(id) A retain];
+ [x release];
+ [x release];
+}
+
+void f3() {
+ CFMutableArrayRef A = CFArrayCreateMutable(0, 10, &kCFTypeArrayCallBacks); // expected-warning{{leak}}
+ CFMakeCollectable(A);
+ CFRetain(A);
}
More information about the cfe-commits
mailing list