1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,osx -fblocks -verify -Wno-objc-root-class %s
2 typedef const void *CFTypeRef;
3 enum { kCFNumberSInt8Type = 1, kCFNumberSInt16Type = 2,
4 kCFNumberSInt32Type = 3, kCFNumberSInt64Type = 4,
5 kCFNumberFloat32Type = 5, kCFNumberFloat64Type = 6,
6 kCFNumberCharType = 7, kCFNumberShortType = 8,
7 kCFNumberIntType = 9, kCFNumberLongType = 10,
8 kCFNumberLongLongType = 11, kCFNumberFloatType = 12,
9 kCFNumberDoubleType = 13, kCFNumberCFIndexType = 14,
10 kCFNumberNSIntegerType = 15, kCFNumberCGFloatType = 16,
11 kCFNumberMaxType = 16 };
12 typedef const struct __CFAllocator * CFAllocatorRef;
13 typedef signed long CFIndex;
14 typedef CFIndex CFNumberType;
15 typedef const struct __CFNumber * CFNumberRef;
16 extern CFNumberRef CFNumberCreate(CFAllocatorRef allocator, CFNumberType theType, const void *valuePtr);
18 void foo(CFAllocatorRef allocator) {
21 CFTypeRef* values = (CFTypeRef[]){
22 CFNumberCreate(allocator, kCFNumberSInt32Type, &width), //expected-warning{{Potential leak of an object of type 'CFNumberRef'}}
23 CFNumberCreate(allocator, kCFNumberSInt32Type, &height), //expected-warning{{Potential leak of an object of type 'CFNumberRef'}}