blob: df751d03e642afef6840526b7f0d6dfc2cf22613 [file] [log] [blame]
Jordan Roseb54cfa32013-02-01 19:50:01 +00001// 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 Zaks7ac344a2012-02-24 23:56:53 +00006#pragma clang system_header
7
8typedef unsigned int UInt32;
Anna Zaks06a77fc2012-02-28 01:54:22 +00009typedef unsigned short UInt16;
10
Anna Zaks7ac344a2012-02-24 23:56:53 +000011typedef signed long CFIndex;
12typedef signed char BOOL;
Artem Dergachev940c7702016-10-18 11:06:28 +000013#define YES ((BOOL)1)
14#define NO ((BOOL)0)
15
Anna Zaks7ac344a2012-02-24 23:56:53 +000016typedef unsigned long NSUInteger;
Anna Zaks06a77fc2012-02-28 01:54:22 +000017typedef unsigned short unichar;
18typedef UInt16 UniChar;
19
Anna Zaks40c74c62016-12-15 22:55:11 +000020#ifndef NULL
21#define __DARWIN_NULL ((void *)0)
22#define NULL __DARWIN_NULL
23#endif
24
Artem Dergachev940c7702016-10-18 11:06:28 +000025#define nil ((id)0)
26
Anna Zaks06a77fc2012-02-28 01:54:22 +000027enum {
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
Anna Zaks7ac344a2012-02-24 23:56:53 +000050@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 NSObject
55- (BOOL)isEqual:(id)object;
56- (id)retain;
Anna Zaks90ab9bf2012-03-30 05:48:16 +000057- (id)copy;
Anna Zaks7ac344a2012-02-24 23:56:53 +000058- (oneway void)release;
59- (id)autorelease;
60- (id)init;
Anna Zaks40c74c62016-12-15 22:55:11 +000061@property (readonly, copy) NSString *description;
Anna Zaks7ac344a2012-02-24 23:56:53 +000062@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
74extern 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;
Jordan Rose514f9352014-01-07 21:39:48 +000080@interface NSValue : NSObject <NSCopying, NSCoding>
81+ (NSValue *)valueWithPointer:(const void *)p;
82- (void)getValue:(void *)value;
83@end
84@interface NSNumber : NSValue - (char)charValue;
Anna Zaks7ac344a2012-02-24 23:56:53 +000085- (id)initWithInt:(int)value;
Artem Dergachev940c7702016-10-18 11:06:28 +000086- (BOOL)boolValue;
Anna Zaks7ac344a2012-02-24 23:56:53 +000087@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;
Anna Zaks06a77fc2012-02-28 01:54:22 +000096@end
Anna Zaks7ac344a2012-02-24 23:56:53 +000097
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;
Anna Zakse4b6d5e2012-06-22 22:08:09 +0000108+ (id)stringWithString:(NSString *)string;
Anna Zaks7ac344a2012-02-24 23:56:53 +0000109@end @class NSString, NSURL, NSError;
Anna Zakse4b6d5e2012-06-22 22:08:09 +0000110
111@interface NSMutableString : NSString
112- (void)appendFormat:(NSString *)format, ... __attribute__((format(__NSString__, 1, 2)));
113@end
114
Anna Zaks7ac344a2012-02-24 23:56:53 +0000115@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;
Anna Zaksa4bc5e12013-05-31 23:47:32 +0000120- (id)initWithBytes:(void *)bytes length:(NSUInteger) length;
Anna Zaks7ac344a2012-02-24 23:56:53 +0000121@end
Anna Zaks06a77fc2012-02-28 01:54:22 +0000122
Anna Zakse0c03ca2012-02-29 18:42:47 +0000123typedef struct {
124}
125CFDictionaryKeyCallBacks;
126extern const CFDictionaryKeyCallBacks kCFTypeDictionaryKeyCallBacks;
127typedef struct {
128}
129CFDictionaryValueCallBacks;
130extern const CFDictionaryValueCallBacks kCFTypeDictionaryValueCallBacks;
131typedef const struct __CFDictionary * CFDictionaryRef;
132typedef struct __CFDictionary * CFMutableDictionaryRef;
133extern CFMutableDictionaryRef CFDictionaryCreateMutable(CFAllocatorRef allocator, CFIndex capacity, const CFDictionaryKeyCallBacks *keyCallBacks, const CFDictionaryValueCallBacks *valueCallBacks);
134void CFDictionarySetValue(CFMutableDictionaryRef, const void *, const void *);
135
Anna Zaks06a77fc2012-02-28 01:54:22 +0000136
137extern void CFRelease(CFTypeRef cf);
138
139extern CFMutableStringRef CFStringCreateMutableWithExternalCharactersNoCopy(CFAllocatorRef alloc, UniChar *chars, CFIndex numChars, CFIndex capacity, CFAllocatorRef externalCharactersAllocator);
140extern CFStringRef CFStringCreateWithCStringNoCopy(CFAllocatorRef alloc, const char *cStr, CFStringEncoding encoding, CFAllocatorRef contentsDeallocator);
141extern void CFStringAppend(CFMutableStringRef theString, CFStringRef appendedString);
Anna Zaks228f9c72012-05-03 23:50:28 +0000142
143void SystemHeaderFunctionWithBlockParam(void *, void (^block)(void *), unsigned);
Anna Zaks42908c72012-06-19 05:10:32 +0000144
145@interface NSPointerArray : NSObject <NSFastEnumeration, NSCopying, NSCoding>
146- (void)addPointer:(void *)pointer;
147- (void)insertPointer:(void *)item atIndex:(NSUInteger)index;
148- (void)replacePointerAtIndex:(NSUInteger)index withPointer:(void *)item;
149- (void *)pointerAtIndex:(NSUInteger)index;
150@end
151