26 lines · plain
1// RUN: %clang_analyze_cc1 -verify -Wno-objc-root-class %s \2// RUN: -analyzer-checker=core,osx.cocoa.RetainCount3 4#define NULL 05#define CF_RETURNS_RETAINED __attribute__((cf_returns_retained))6#define CF_CONSUMED __attribute__((cf_consumed))7 8void clang_analyzer_eval(int);9 10typedef const void *CFTypeRef;11 12extern CFTypeRef CFCreate(void) CF_RETURNS_RETAINED;13extern CFTypeRef CFRetain(CFTypeRef cf);14extern void CFRelease(CFTypeRef cf);15 16void bar(CFTypeRef *v) {}17 18void test1(void) {19 CFTypeRef *values = (CFTypeRef[]){20 CFCreate(), // no-warning21 CFCreate(), // expected-warning{{leak}}22 CFCreate()}; // no-warning23 CFRelease(values[0]);24 CFRelease(values[2]);25}26