aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-04-21 20:01:03 +0000
committerTed Kremenek <kremenek@apple.com>2009-04-21 20:01:03 +0000
commit09f1419dab422787353965fdfeb88de1398de0b4 (patch)
tree34a88c928932cbb01cb3c3b38e02bf0313788e1e
parent72e032004b0d2c2c298e8e4f7027f23a21c0cc7d (diff)
Added over-release test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69703 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/Analysis/NSString.m9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/Analysis/NSString.m b/test/Analysis/NSString.m
index 9de6853cdf..6e644d5fbc 100644
--- a/test/Analysis/NSString.m
+++ b/test/Analysis/NSString.m
@@ -19,6 +19,7 @@ typedef const struct __CFString * CFStringRef;
typedef const struct __CFAllocator * CFAllocatorRef;
extern const CFAllocatorRef kCFAllocatorDefault;
extern CFTypeRef CFRetain(CFTypeRef cf);
+void CFRelease(CFTypeRef cf);
typedef const struct __CFDictionary * CFDictionaryRef;
const void *CFDictionaryGetValue(CFDictionaryRef theDict, const void *key);
extern CFStringRef CFStringCreateWithFormat(CFAllocatorRef alloc, CFDictionaryRef formatOptions, CFStringRef format, ...);
@@ -156,13 +157,19 @@ NSString* f11(CFDictionaryRef dict, const char* key) {
}
// Test case for passing a tracked object by-reference to a function we
-// don't undersand.
+// don't understand.
void unknown_function_f12(NSString** s);
void f12() {
NSString *string = [[NSString alloc] init];
unknown_function_f12(&string); // no-warning
}
+// Test double release of CFString (PR 4014).
+void f13(void) {
+ CFStringRef ref = CFStringCreateWithFormat(kCFAllocatorDefault, ((void*)0), ((CFStringRef) __builtin___CFStringMakeConstantString ("" "%d" "")), 100);
+ CFRelease(ref);
+ CFRelease(ref); // expected-warning{{Reference-counted object is used after it is released}}
+}
@interface C1 : NSObject {}
- (NSString*) getShared;