[cfe-commits] r49885 - /cfe/trunk/test/Analysis-Apple/CFDate.m
Ted Kremenek
kremenek at apple.com
Thu Apr 17 19:00:02 PDT 2008
Author: kremenek
Date: Thu Apr 17 21:00:02 2008
New Revision: 49885
URL: http://llvm.org/viewvc/llvm-project?rev=49885&view=rev
Log:
Added test cases to test for reference count leaks.
Modified:
cfe/trunk/test/Analysis-Apple/CFDate.m
Modified: cfe/trunk/test/Analysis-Apple/CFDate.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis-Apple/CFDate.m?rev=49885&r1=49884&r2=49885&view=diff
==============================================================================
--- cfe/trunk/test/Analysis-Apple/CFDate.m (original)
+++ cfe/trunk/test/Analysis-Apple/CFDate.m Thu Apr 17 21:00:02 2008
@@ -64,3 +64,23 @@
return t;
}
+// Test a leak.
+
+CFAbsoluteTime f5(int x) {
+ CFAbsoluteTime t = CFAbsoluteTimeGetCurrent();
+ CFDateRef date = CFDateCreate(NULL, t);
+
+ if (x)
+ CFRelease(date);
+
+ return t; // expected-warning{{leak}}
+}
+
+// Test a leak involving the return.
+
+CFDateRef f6(int x) {
+ CFDateRef date = CFDateCreate(NULL, CFAbsoluteTimeGetCurrent());
+ CFRetain(date);
+ return date; // expected-warning{{leak}}
+}
+
More information about the cfe-commits
mailing list