[clang][NFC] simplify the unset check in `ParseLabeledStatement` (#117430)
[llvm-project.git] / clang / test / Analysis / retain-release-compound-literal.m
blob9f49ea37825f87ebe46d524db548115854d5461c
1 // RUN: %clang_analyze_cc1 -verify -Wno-objc-root-class %s \
2 // RUN:   -analyzer-checker=core,osx.cocoa.RetainCount
4 #define NULL 0
5 #define CF_RETURNS_RETAINED __attribute__((cf_returns_retained))
6 #define CF_CONSUMED __attribute__((cf_consumed))
8 void clang_analyzer_eval(int);
10 typedef const void *CFTypeRef;
12 extern CFTypeRef CFCreate(void) CF_RETURNS_RETAINED;
13 extern CFTypeRef CFRetain(CFTypeRef cf);
14 extern void CFRelease(CFTypeRef cf);
16 void bar(CFTypeRef *v) {}
18 void test1(void) {
19   CFTypeRef *values = (CFTypeRef[]){
20       CFCreate(),  // no-warning
21       CFCreate(),  // expected-warning{{leak}}
22       CFCreate()}; // no-warning
23   CFRelease(values[0]);
24   CFRelease(values[2]);