summaryrefslogtreecommitdiffstats
path: root/test/Analysis/retain-release.m
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/retain-release.m')
-rw-r--r--test/Analysis/retain-release.m26
1 files changed, 17 insertions, 9 deletions
diff --git a/test/Analysis/retain-release.m b/test/Analysis/retain-release.m
index 5cc29b0..6782c90 100644
--- a/test/Analysis/retain-release.m
+++ b/test/Analysis/retain-release.m
@@ -1,5 +1,7 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=macosx.CFRetainRelease,cocoa.ClassRelease -analyzer-check-objc-mem -analyzer-store=basic -fblocks -verify %s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=macosx.CFRetainRelease,cocoa.ClassRelease -analyzer-check-objc-mem -analyzer-store=region -fblocks -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease -analyzer-store=basic -fblocks -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease -analyzer-store=region -fblocks -verify %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease -analyzer-store=basic -fblocks -verify -x objective-c++ %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core,osx.coreFoundation.CFRetainRelease,osx.cocoa.ClassRelease -analyzer-store=region -fblocks -verify -x objective-c++ %s
#if __has_feature(attribute_ns_returns_retained)
#define NS_RETURNS_RETAINED __attribute__((ns_returns_retained))
@@ -910,7 +912,7 @@ void IOServiceAddMatchingNotification_wrapper(IONotificationPortRef notifyPort,
// Test of handling objects whose references "escape" to containers.
//===----------------------------------------------------------------------===//
-void CFDictionaryAddValue();
+void CFDictionaryAddValue(CFMutableDictionaryRef, void *, void *);
// <rdar://problem/6539791>
void rdar_6539791(CFMutableDictionaryRef y, void* key, void* val_key) {
@@ -920,9 +922,9 @@ void rdar_6539791(CFMutableDictionaryRef y, void* key, void* val_key) {
signed z = 1;
CFNumberRef value = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &z);
if (value) {
- CFDictionaryAddValue(x, val_key, value); // no-warning
+ CFDictionaryAddValue(x, val_key, (void*)value); // no-warning
CFRelease(value);
- CFDictionaryAddValue(y, val_key, value); // no-warning
+ CFDictionaryAddValue(y, val_key, (void*)value); // no-warning
}
}
@@ -1013,8 +1015,8 @@ typedef struct _opaque_pthread_attr_t __darwin_pthread_attr_t;
typedef __darwin_pthread_t pthread_t;
typedef __darwin_pthread_attr_t pthread_attr_t;
-int pthread_create(pthread_t * restrict, const pthread_attr_t * restrict,
- void *(*)(void *), void * restrict);
+int pthread_create(pthread_t *, const pthread_attr_t *,
+ void *(*)(void *), void *);
void *rdar_7299394_start_routine(void *p) {
[((id) p) release];
@@ -1435,7 +1437,6 @@ extern const void *CFDictionaryGetValue(CFDictionaryRef theDict, const void *key
typedef struct __CFError * CFErrorRef;
extern const CFStringRef kCFErrorUnderlyingErrorKey;
extern CFDictionaryRef CFErrorCopyUserInfo(CFErrorRef err);
-
static void rdar_8724287(CFErrorRef error)
{
CFErrorRef error_to_dump;
@@ -1444,7 +1445,7 @@ static void rdar_8724287(CFErrorRef error)
while (error_to_dump != ((void*)0)) {
CFDictionaryRef info;
- info = CFErrorCopyUserInfo(error_to_dump); // expected-warning{{Potential leak of an object allocated on line 1447 and stored into 'info'}}
+ info = CFErrorCopyUserInfo(error_to_dump); // expected-warning{{Potential leak of an object allocated on line 1448 and stored into 'info'}}
if (info != ((void*)0)) {
}
@@ -1453,3 +1454,10 @@ static void rdar_8724287(CFErrorRef error)
}
}
+// <rdar://problem/9234108> - Make sure the model applies cf_consumed
+// correctly in argument positions besides the first.
+extern void *CFStringCreate(void);
+extern void rdar_9234108_helper(void *key, void * CF_CONSUMED value);
+void rdar_9234108() {
+ rdar_9234108_helper(0, CFStringCreate());
+}
OpenPOWER on IntegriCloud