1// Like the compiler, the static analyzer treats some functions differently if 2// they come from a system header -- for example, it is assumed that system 3// functions do not arbitrarily free() their parameters, and that some bugs 4// found in system headers cannot be fixed by the user and should be 5// suppressed. 6#pragma clang system_header 7 8typedef unsigned int UInt32; 9typedef unsigned short UInt16; 10 11typedef signed long CFIndex; 12typedef signed char BOOL; 13typedef unsigned long NSUInteger; 14typedef unsigned short unichar; 15typedef UInt16 UniChar; 16 17enum { 18 NSASCIIStringEncoding = 1, 19 NSNEXTSTEPStringEncoding = 2, 20 NSJapaneseEUCStringEncoding = 3, 21 NSUTF8StringEncoding = 4, 22 NSISOLatin1StringEncoding = 5, 23 NSSymbolStringEncoding = 6, 24 NSNonLossyASCIIStringEncoding = 7, 25}; 26typedef const struct __CFString * CFStringRef; 27typedef struct __CFString * CFMutableStringRef; 28typedef NSUInteger NSStringEncoding; 29typedef UInt32 CFStringEncoding; 30 31typedef const void * CFTypeRef; 32 33typedef const struct __CFAllocator * CFAllocatorRef; 34extern const CFAllocatorRef kCFAllocatorDefault; 35extern const CFAllocatorRef kCFAllocatorSystemDefault; 36extern const CFAllocatorRef kCFAllocatorMalloc; 37extern const CFAllocatorRef kCFAllocatorMallocZone; 38extern const CFAllocatorRef kCFAllocatorNull; 39 40@class NSString, Protocol; 41extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1, 2))); 42typedef struct _NSZone NSZone; 43@class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; 44@protocol NSObject 45- (BOOL)isEqual:(id)object; 46- (id)retain; 47- (id)copy; 48- (oneway void)release; 49- (id)autorelease; 50- (id)init; 51@end @protocol NSCopying - (id)copyWithZone:(NSZone *)zone; 52@end @protocol NSMutableCopying - (id)mutableCopyWithZone:(NSZone *)zone; 53@end @protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; 54@end 55@interface NSObject <NSObject> {} 56+ (id)allocWithZone:(NSZone *)zone; 57+ (id)alloc; 58- (void)dealloc; 59@end 60@interface NSObject (NSCoderMethods) 61- (id)awakeAfterUsingCoder:(NSCoder *)aDecoder; 62@end 63extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone); 64typedef struct { 65} 66NSFastEnumerationState; 67@protocol NSFastEnumeration - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len; 68@end @class NSString, NSDictionary; 69@interface NSValue : NSObject <NSCopying, NSCoding> 70+ (NSValue *)valueWithPointer:(const void *)p; 71- (void)getValue:(void *)value; 72@end 73@interface NSNumber : NSValue - (char)charValue; 74- (id)initWithInt:(int)value; 75@end @class NSString; 76@interface NSArray : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration> - (NSUInteger)count; 77@end @interface NSArray (NSArrayCreation) + (id)array; 78@end @interface NSAutoreleasePool : NSObject { 79} 80- (void)drain; 81@end extern NSString * const NSBundleDidLoadNotification; 82typedef double NSTimeInterval; 83@interface NSDate : NSObject <NSCopying, NSCoding> - (NSTimeInterval)timeIntervalSinceReferenceDate; 84@end 85 86@interface NSString : NSObject <NSCopying, NSMutableCopying, NSCoding> 87- (NSUInteger)length; 88- (NSString *)stringByAppendingString:(NSString *)aString; 89- ( const char *)UTF8String; 90- (id)initWithUTF8String:(const char *)nullTerminatedCString; 91- (id)initWithCharactersNoCopy:(unichar *)characters length:(NSUInteger)length freeWhenDone:(BOOL)freeBuffer; 92- (id)initWithCharacters:(const unichar *)characters length:(NSUInteger)length; 93- (id)initWithBytes:(const void *)bytes length:(NSUInteger)len encoding:(NSStringEncoding)encoding; 94- (id)initWithBytesNoCopy:(void *)bytes length:(NSUInteger)len encoding:(NSStringEncoding)encoding freeWhenDone:(BOOL)freeBuffer; 95+ (id)stringWithUTF8String:(const char *)nullTerminatedCString; 96+ (id)stringWithString:(NSString *)string; 97@end @class NSString, NSURL, NSError; 98 99@interface NSMutableString : NSString 100- (void)appendFormat:(NSString *)format, ... __attribute__((format(__NSString__, 1, 2))); 101@end 102 103@interface NSData : NSObject <NSCopying, NSMutableCopying, NSCoding> - (NSUInteger)length; 104+ (id)dataWithBytesNoCopy:(void *)bytes length:(NSUInteger)length; 105+ (id)dataWithBytesNoCopy:(void *)bytes length:(NSUInteger)length freeWhenDone:(BOOL)b; 106- (id)initWithBytesNoCopy:(void *)bytes length:(NSUInteger)length; 107- (id)initWithBytesNoCopy:(void *)bytes length:(NSUInteger)length freeWhenDone:(BOOL)b; 108- (id)initWithBytes:(void *)bytes length:(NSUInteger) length; 109@end 110 111typedef struct { 112} 113CFDictionaryKeyCallBacks; 114extern const CFDictionaryKeyCallBacks kCFTypeDictionaryKeyCallBacks; 115typedef struct { 116} 117CFDictionaryValueCallBacks; 118extern const CFDictionaryValueCallBacks kCFTypeDictionaryValueCallBacks; 119typedef const struct __CFDictionary * CFDictionaryRef; 120typedef struct __CFDictionary * CFMutableDictionaryRef; 121extern CFMutableDictionaryRef CFDictionaryCreateMutable(CFAllocatorRef allocator, CFIndex capacity, const CFDictionaryKeyCallBacks *keyCallBacks, const CFDictionaryValueCallBacks *valueCallBacks); 122void CFDictionarySetValue(CFMutableDictionaryRef, const void *, const void *); 123 124 125extern void CFRelease(CFTypeRef cf); 126 127extern CFMutableStringRef CFStringCreateMutableWithExternalCharactersNoCopy(CFAllocatorRef alloc, UniChar *chars, CFIndex numChars, CFIndex capacity, CFAllocatorRef externalCharactersAllocator); 128extern CFStringRef CFStringCreateWithCStringNoCopy(CFAllocatorRef alloc, const char *cStr, CFStringEncoding encoding, CFAllocatorRef contentsDeallocator); 129extern void CFStringAppend(CFMutableStringRef theString, CFStringRef appendedString); 130 131void SystemHeaderFunctionWithBlockParam(void *, void (^block)(void *), unsigned); 132 133@interface NSPointerArray : NSObject <NSFastEnumeration, NSCopying, NSCoding> 134- (void)addPointer:(void *)pointer; 135- (void)insertPointer:(void *)item atIndex:(NSUInteger)index; 136- (void)replacePointerAtIndex:(NSUInteger)index withPointer:(void *)item; 137- (void *)pointerAtIndex:(NSUInteger)index; 138@end 139 140