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