1 // RUN: %clang_analyze_cc1 -std=c++14 -verify=no-retain-count %s \
2 // RUN: -analyzer-checker=core,osx \
3 // RUN: -analyzer-disable-checker osx.cocoa.RetainCount
5 // RUN: %clang_analyze_cc1 -std=c++14 -verify=no-os-object %s \
6 // RUN: -analyzer-checker=core,osx \
7 // RUN: -analyzer-disable-checker osx.OSObjectRetainCount
9 #include "os_object_base.h"
11 typedef const void * CFTypeRef
;
12 extern CFTypeRef
CFRetain(CFTypeRef cf
);
13 extern void CFRelease(CFTypeRef cf
);
15 #define CF_RETURNS_RETAINED __attribute__((cf_returns_retained))
16 extern CFTypeRef
CFCreate() CF_RETURNS_RETAINED
;
18 using size_t = decltype(sizeof(int));
20 void cf_overrelease() {
21 CFTypeRef cf
= CFCreate();
23 CFRelease(cf
); // no-os-object-warning{{Reference-counted object is used after it is released}}
26 void osobject_overrelease() {
27 OSObject
*o
= new OSObject
;
29 o
->release(); // no-retain-count-warning{{Reference-counted object is used after it is released}}