Clang Project

clang_source_code/test/Analysis/Inputs/system-header-simulator-objc.h
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;
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 NULL
21#define __DARWIN_NULL ((void *)0)
22#define NULL __DARWIN_NULL
23#endif
24
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 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
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;
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;
94typedef 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)initWithBytes:(void *)bytes length:(NSUInteger) length;
121@end
122
123typedef 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
136
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);
142
143void SystemHeaderFunctionWithBlockParam(void *, void (^block)(void *), unsigned);
144
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
152