xref: /aosp_15_r20/external/clang/test/Analysis/CFContainers-invalid.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -analyze -analyzer-checker=osx.coreFoundation.containers.PointerSizedValues -triple x86_64-apple-darwin -verify %s
2*67e74705SXin Li // expected-no-diagnostics
3*67e74705SXin Li 
4*67e74705SXin Li typedef const struct __CFAllocator * CFAllocatorRef;
5*67e74705SXin Li typedef const struct __CFArray * CFArrayRef;
6*67e74705SXin Li typedef const struct __CFDictionary * CFDictionaryRef;
7*67e74705SXin Li typedef const struct __CFSet * CFSetRef;
8*67e74705SXin Li 
9*67e74705SXin Li extern const CFAllocatorRef kCFAllocatorDefault;
10*67e74705SXin Li 
11*67e74705SXin Li // Unexpected declarations for these:
12*67e74705SXin Li CFArrayRef CFArrayCreate(CFAllocatorRef);
13*67e74705SXin Li CFDictionaryRef CFDictionaryCreate(CFAllocatorRef);
14*67e74705SXin Li CFSetRef CFSetCreate(CFAllocatorRef);
15*67e74705SXin Li 
testNoCrash()16*67e74705SXin Li void testNoCrash() {
17*67e74705SXin Li   (void)CFArrayCreate(kCFAllocatorDefault);
18*67e74705SXin Li   (void)CFDictionaryCreate(kCFAllocatorDefault);
19*67e74705SXin Li   (void)CFSetCreate(kCFAllocatorDefault);
20*67e74705SXin Li }
21