Jordan Rose | b54cfa3 | 2013-02-01 19:50:01 +0000 | [diff] [blame] | 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. |
Anna Zaks | 7ac344a | 2012-02-24 23:56:53 +0000 | [diff] [blame] | 6 | #pragma clang system_header |
| 7 | |
| 8 | typedef unsigned int UInt32; |
Anna Zaks | 06a77fc | 2012-02-28 01:54:22 +0000 | [diff] [blame] | 9 | typedef unsigned short UInt16; |
| 10 | |
Anna Zaks | 7ac344a | 2012-02-24 23:56:53 +0000 | [diff] [blame] | 11 | typedef signed long CFIndex; |
| 12 | typedef signed char BOOL; |
| 13 | typedef unsigned long NSUInteger; |
Anna Zaks | 06a77fc | 2012-02-28 01:54:22 +0000 | [diff] [blame] | 14 | typedef unsigned short unichar; |
| 15 | typedef UInt16 UniChar; |
| 16 | |
| 17 | enum { |
| 18 | NSASCIIStringEncoding = 1, |
| 19 | NSNEXTSTEPStringEncoding = 2, |
| 20 | NSJapaneseEUCStringEncoding = 3, |
| 21 | NSUTF8StringEncoding = 4, |
| 22 | NSISOLatin1StringEncoding = 5, |
| 23 | NSSymbolStringEncoding = 6, |
| 24 | NSNonLossyASCIIStringEncoding = 7, |
| 25 | }; |
| 26 | typedef const struct __CFString * CFStringRef; |
| 27 | typedef struct __CFString * CFMutableStringRef; |
| 28 | typedef NSUInteger NSStringEncoding; |
| 29 | typedef UInt32 CFStringEncoding; |
| 30 | |
| 31 | typedef const void * CFTypeRef; |
| 32 | |
| 33 | typedef const struct __CFAllocator * CFAllocatorRef; |
| 34 | extern const CFAllocatorRef kCFAllocatorDefault; |
| 35 | extern const CFAllocatorRef kCFAllocatorSystemDefault; |
| 36 | extern const CFAllocatorRef kCFAllocatorMalloc; |
| 37 | extern const CFAllocatorRef kCFAllocatorMallocZone; |
| 38 | extern const CFAllocatorRef kCFAllocatorNull; |
| 39 | |
Anna Zaks | 7ac344a | 2012-02-24 23:56:53 +0000 | [diff] [blame] | 40 | @class NSString, Protocol; |
| 41 | extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1, 2))); |
| 42 | typedef struct _NSZone NSZone; |
| 43 | @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; |
| 44 | @protocol NSObject |
| 45 | - (BOOL)isEqual:(id)object; |
| 46 | - (id)retain; |
Anna Zaks | 90ab9bf | 2012-03-30 05:48:16 +0000 | [diff] [blame] | 47 | - (id)copy; |
Anna Zaks | 7ac344a | 2012-02-24 23:56:53 +0000 | [diff] [blame] | 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 |
| 63 | extern id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone); |
| 64 | typedef struct { |
| 65 | } |
| 66 | NSFastEnumerationState; |
| 67 | @protocol NSFastEnumeration - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id *)stackbuf count:(NSUInteger)len; |
| 68 | @end @class NSString, NSDictionary; |
| 69 | @interface NSValue : NSObject <NSCopying, NSCoding> - (void)getValue:(void *)value; |
| 70 | @end @interface NSNumber : NSValue - (char)charValue; |
| 71 | - (id)initWithInt:(int)value; |
| 72 | @end @class NSString; |
| 73 | @interface NSArray : NSObject <NSCopying, NSMutableCopying, NSCoding, NSFastEnumeration> - (NSUInteger)count; |
| 74 | @end @interface NSArray (NSArrayCreation) + (id)array; |
| 75 | @end @interface NSAutoreleasePool : NSObject { |
| 76 | } |
| 77 | - (void)drain; |
| 78 | @end extern NSString * const NSBundleDidLoadNotification; |
| 79 | typedef double NSTimeInterval; |
| 80 | @interface NSDate : NSObject <NSCopying, NSCoding> - (NSTimeInterval)timeIntervalSinceReferenceDate; |
Anna Zaks | 06a77fc | 2012-02-28 01:54:22 +0000 | [diff] [blame] | 81 | @end |
Anna Zaks | 7ac344a | 2012-02-24 23:56:53 +0000 | [diff] [blame] | 82 | |
| 83 | @interface NSString : NSObject <NSCopying, NSMutableCopying, NSCoding> |
| 84 | - (NSUInteger)length; |
| 85 | - (NSString *)stringByAppendingString:(NSString *)aString; |
| 86 | - ( const char *)UTF8String; |
| 87 | - (id)initWithUTF8String:(const char *)nullTerminatedCString; |
| 88 | - (id)initWithCharactersNoCopy:(unichar *)characters length:(NSUInteger)length freeWhenDone:(BOOL)freeBuffer; |
| 89 | - (id)initWithCharacters:(const unichar *)characters length:(NSUInteger)length; |
| 90 | - (id)initWithBytes:(const void *)bytes length:(NSUInteger)len encoding:(NSStringEncoding)encoding; |
| 91 | - (id)initWithBytesNoCopy:(void *)bytes length:(NSUInteger)len encoding:(NSStringEncoding)encoding freeWhenDone:(BOOL)freeBuffer; |
| 92 | + (id)stringWithUTF8String:(const char *)nullTerminatedCString; |
Anna Zaks | e4b6d5e | 2012-06-22 22:08:09 +0000 | [diff] [blame] | 93 | + (id)stringWithString:(NSString *)string; |
Anna Zaks | 7ac344a | 2012-02-24 23:56:53 +0000 | [diff] [blame] | 94 | @end @class NSString, NSURL, NSError; |
Anna Zaks | e4b6d5e | 2012-06-22 22:08:09 +0000 | [diff] [blame] | 95 | |
| 96 | @interface NSMutableString : NSString |
| 97 | - (void)appendFormat:(NSString *)format, ... __attribute__((format(__NSString__, 1, 2))); |
| 98 | @end |
| 99 | |
Anna Zaks | 7ac344a | 2012-02-24 23:56:53 +0000 | [diff] [blame] | 100 | @interface NSData : NSObject <NSCopying, NSMutableCopying, NSCoding> - (NSUInteger)length; |
| 101 | + (id)dataWithBytesNoCopy:(void *)bytes length:(NSUInteger)length; |
| 102 | + (id)dataWithBytesNoCopy:(void *)bytes length:(NSUInteger)length freeWhenDone:(BOOL)b; |
| 103 | - (id)initWithBytesNoCopy:(void *)bytes length:(NSUInteger)length; |
| 104 | - (id)initWithBytesNoCopy:(void *)bytes length:(NSUInteger)length freeWhenDone:(BOOL)b; |
Anna Zaks | a4bc5e1 | 2013-05-31 23:47:32 +0000 | [diff] [blame^] | 105 | - (id)initWithBytes:(void *)bytes length:(NSUInteger) length; |
Anna Zaks | 7ac344a | 2012-02-24 23:56:53 +0000 | [diff] [blame] | 106 | @end |
Anna Zaks | 06a77fc | 2012-02-28 01:54:22 +0000 | [diff] [blame] | 107 | |
Anna Zaks | e0c03ca | 2012-02-29 18:42:47 +0000 | [diff] [blame] | 108 | typedef struct { |
| 109 | } |
| 110 | CFDictionaryKeyCallBacks; |
| 111 | extern const CFDictionaryKeyCallBacks kCFTypeDictionaryKeyCallBacks; |
| 112 | typedef struct { |
| 113 | } |
| 114 | CFDictionaryValueCallBacks; |
| 115 | extern const CFDictionaryValueCallBacks kCFTypeDictionaryValueCallBacks; |
| 116 | typedef const struct __CFDictionary * CFDictionaryRef; |
| 117 | typedef struct __CFDictionary * CFMutableDictionaryRef; |
| 118 | extern CFMutableDictionaryRef CFDictionaryCreateMutable(CFAllocatorRef allocator, CFIndex capacity, const CFDictionaryKeyCallBacks *keyCallBacks, const CFDictionaryValueCallBacks *valueCallBacks); |
| 119 | void CFDictionarySetValue(CFMutableDictionaryRef, const void *, const void *); |
| 120 | |
Anna Zaks | 06a77fc | 2012-02-28 01:54:22 +0000 | [diff] [blame] | 121 | |
| 122 | extern void CFRelease(CFTypeRef cf); |
| 123 | |
| 124 | extern CFMutableStringRef CFStringCreateMutableWithExternalCharactersNoCopy(CFAllocatorRef alloc, UniChar *chars, CFIndex numChars, CFIndex capacity, CFAllocatorRef externalCharactersAllocator); |
| 125 | extern CFStringRef CFStringCreateWithCStringNoCopy(CFAllocatorRef alloc, const char *cStr, CFStringEncoding encoding, CFAllocatorRef contentsDeallocator); |
| 126 | extern void CFStringAppend(CFMutableStringRef theString, CFStringRef appendedString); |
Anna Zaks | 228f9c7 | 2012-05-03 23:50:28 +0000 | [diff] [blame] | 127 | |
| 128 | void SystemHeaderFunctionWithBlockParam(void *, void (^block)(void *), unsigned); |
Anna Zaks | 42908c7 | 2012-06-19 05:10:32 +0000 | [diff] [blame] | 129 | |
| 130 | @interface NSPointerArray : NSObject <NSFastEnumeration, NSCopying, NSCoding> |
| 131 | - (void)addPointer:(void *)pointer; |
| 132 | - (void)insertPointer:(void *)item atIndex:(NSUInteger)index; |
| 133 | - (void)replacePointerAtIndex:(NSUInteger)index withPointer:(void *)item; |
| 134 | - (void *)pointerAtIndex:(NSUInteger)index; |
| 135 | @end |
| 136 | |