system-header-simulator-objc.h revision 8c888b10fdd2846885e8582b131fa076ce1b77b1
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>  - (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;
79typedef double NSTimeInterval;
80@interface NSDate : NSObject <NSCopying, NSCoding>  - (NSTimeInterval)timeIntervalSinceReferenceDate;
81@end
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;
93+ (id)stringWithString:(NSString *)string;
94@end        @class NSString, NSURL, NSError;
95
96@interface NSMutableString : NSString
97- (void)appendFormat:(NSString *)format, ... __attribute__((format(__NSString__, 1, 2)));
98@end
99
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;
105@end
106
107typedef struct {
108}
109CFDictionaryKeyCallBacks;
110extern const CFDictionaryKeyCallBacks kCFTypeDictionaryKeyCallBacks;
111typedef struct {
112}
113CFDictionaryValueCallBacks;
114extern const CFDictionaryValueCallBacks kCFTypeDictionaryValueCallBacks;
115typedef const struct __CFDictionary * CFDictionaryRef;
116typedef struct __CFDictionary * CFMutableDictionaryRef;
117extern CFMutableDictionaryRef CFDictionaryCreateMutable(CFAllocatorRef allocator, CFIndex capacity, const CFDictionaryKeyCallBacks *keyCallBacks, const CFDictionaryValueCallBacks *valueCallBacks);
118void CFDictionarySetValue(CFMutableDictionaryRef, const void *, const void *);
119
120
121extern void CFRelease(CFTypeRef cf);
122
123extern CFMutableStringRef CFStringCreateMutableWithExternalCharactersNoCopy(CFAllocatorRef alloc, UniChar *chars, CFIndex numChars, CFIndex capacity, CFAllocatorRef externalCharactersAllocator);
124extern CFStringRef CFStringCreateWithCStringNoCopy(CFAllocatorRef alloc, const char *cStr, CFStringEncoding encoding, CFAllocatorRef contentsDeallocator);
125extern void CFStringAppend(CFMutableStringRef theString, CFStringRef appendedString);
126
127void SystemHeaderFunctionWithBlockParam(void *, void (^block)(void *), unsigned);
128
129@interface NSPointerArray : NSObject <NSFastEnumeration, NSCopying, NSCoding>
130- (void)addPointer:(void *)pointer;
131- (void)insertPointer:(void *)item atIndex:(NSUInteger)index;
132- (void)replacePointerAtIndex:(NSUInteger)index withPointer:(void *)item;
133- (void *)pointerAtIndex:(NSUInteger)index;
134@end
135
136