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 8 typedef unsigned int UInt32; 9 typedef unsigned short UInt16; 10 11 typedef signed long CFIndex; 12 typedef signed char BOOL; 13 #define YES ((BOOL)1) 14 #define NO ((BOOL)0) 15 16 typedef unsigned long NSUInteger; 17 typedef unsigned short unichar; 18 typedef UInt16 UniChar; 19 20 #ifndef NULL 21 #define __DARWIN_NULL ((void *)0) 22 #define NULL __DARWIN_NULL 23 #endif 24 25 #define nil ((id)0) 26 27 enum { 28 NSASCIIStringEncoding = 1, 29 NSNEXTSTEPStringEncoding = 2, 30 NSJapaneseEUCStringEncoding = 3, 31 NSUTF8StringEncoding = 4, 32 NSISOLatin1StringEncoding = 5, 33 NSSymbolStringEncoding = 6, 34 NSNonLossyASCIIStringEncoding = 7, 35 }; 36 typedef const struct __CFString * CFStringRef; 37 typedef struct __CFString * CFMutableStringRef; 38 typedef NSUInteger NSStringEncoding; 39 typedef UInt32 CFStringEncoding; 40 41 typedef const void * CFTypeRef; 42 43 typedef const struct __CFAllocator * CFAllocatorRef; 44 extern const CFAllocatorRef kCFAllocatorDefault; 45 extern const CFAllocatorRef kCFAllocatorSystemDefault; 46 extern const CFAllocatorRef kCFAllocatorMalloc; 47 extern const CFAllocatorRef kCFAllocatorMallocZone; 48 extern const CFAllocatorRef kCFAllocatorNull; 49 50 @class NSString, Protocol; 51 extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1, 2))); 52 typedef struct _NSZone NSZone; 53 @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; 54 @protocol NSObject 55 - (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 @end 66 @interface NSObject <NSObject> {} 67 + (id)allocWithZone:(NSZone *)zone; 68 + (id)alloc; 69 - (void)dealloc; 70 @end 71 @interface NSObject (NSCoderMethods) 72 - (id)awakeAfterUsingCoder:(NSCoder *)aDecoder; 73 @end 74 extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone); 75 typedef struct { 76 } 77 NSFastEnumerationState; 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 @end 84 @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; 94 typedef double NSTimeInterval; 95 @interface NSDate : NSObject <NSCopying, NSCoding> - (NSTimeInterval)timeIntervalSinceReferenceDate; 96 @end 97 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 : NSString 112 - (void)appendFormat:(NSString *)format, ... __attribute__((format(__NSString__, 1, 2))); 113 @end 114 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 *)bytes 121 length:(NSUInteger)length 122 deallocator:(void (^)(void *bytes, NSUInteger length))deallocator; 123 - (id)initWithBytes:(void *)bytes length:(NSUInteger)length; 124 @end 125 126 typedef struct { 127 } 128 CFDictionaryKeyCallBacks; 129 extern const CFDictionaryKeyCallBacks kCFTypeDictionaryKeyCallBacks; 130 typedef struct { 131 } 132 CFDictionaryValueCallBacks; 133 extern const CFDictionaryValueCallBacks kCFTypeDictionaryValueCallBacks; 134 typedef const struct __CFDictionary * CFDictionaryRef; 135 typedef struct __CFDictionary * CFMutableDictionaryRef; 136 extern CFMutableDictionaryRef CFDictionaryCreateMutable(CFAllocatorRef allocator, CFIndex capacity, const CFDictionaryKeyCallBacks *keyCallBacks, const CFDictionaryValueCallBacks *valueCallBacks); 137 void CFDictionarySetValue(CFMutableDictionaryRef, const void *, const void *); 138 139 140 extern void CFRelease(CFTypeRef cf); 141 142 extern CFMutableStringRef CFStringCreateMutableWithExternalCharactersNoCopy(CFAllocatorRef alloc, UniChar *chars, CFIndex numChars, CFIndex capacity, CFAllocatorRef externalCharactersAllocator); 143 extern CFStringRef CFStringCreateWithCStringNoCopy(CFAllocatorRef alloc, const char *cStr, CFStringEncoding encoding, CFAllocatorRef contentsDeallocator); 144 extern void CFStringAppend(CFMutableStringRef theString, CFStringRef appendedString); 145 146 void 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 @end 154 155