blob: 708e407c928124f103103999568c6b00f41909e4 [file] [log] [blame]
John McCall8f0e8d22011-06-15 23:25:17 +00001#if __has_feature(objc_arr)
2#define NS_AUTOMATED_REFCOUNT_UNAVAILABLE __attribute__((unavailable("not available in automatic reference counting mode")))
3#else
4#define NS_AUTOMATED_REFCOUNT_UNAVAILABLE
5#endif
6
Argyrios Kyrtzidise0ac7452011-11-04 15:58:08 +00007#define NS_RETURNS_RETAINED __attribute__((ns_returns_retained))
Argyrios Kyrtzidis4532b552011-09-14 18:17:09 +00008#define CF_CONSUMED __attribute__((cf_consumed))
9
Argyrios Kyrtzidise0ac7452011-11-04 15:58:08 +000010#define NS_INLINE static __inline__ __attribute__((always_inline))
Argyrios Kyrtzidis18fd0c62011-07-27 05:28:18 +000011#define nil ((void*) 0)
12
John McCall8f0e8d22011-06-15 23:25:17 +000013typedef int BOOL;
14typedef unsigned NSUInteger;
15typedef int int32_t;
16typedef unsigned char uint8_t;
17typedef int32_t UChar32;
18typedef unsigned char UChar;
19
Argyrios Kyrtzidis18fd0c62011-07-27 05:28:18 +000020typedef struct _NSZone NSZone;
21
22typedef const void * CFTypeRef;
23CFTypeRef CFRetain(CFTypeRef cf);
Argyrios Kyrtzidise0ac7452011-11-04 15:58:08 +000024id CFBridgingRelease(CFTypeRef CF_CONSUMED X);
25
26NS_INLINE NS_RETURNS_RETAINED id NSMakeCollectable(CFTypeRef CF_CONSUMED cf) NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
Argyrios Kyrtzidis18fd0c62011-07-27 05:28:18 +000027
John McCall8f0e8d22011-06-15 23:25:17 +000028@protocol NSObject
29- (BOOL)isEqual:(id)object;
Argyrios Kyrtzidis18fd0c62011-07-27 05:28:18 +000030- (NSZone *)zone NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
John McCall8f0e8d22011-06-15 23:25:17 +000031- (id)retain NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
32- (NSUInteger)retainCount NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
33- (oneway void)release NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
34- (id)autorelease NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
John McCall8f0e8d22011-06-15 23:25:17 +000035@end
36
37@interface NSObject <NSObject> {}
38- (id)init;
39
40+ (id)new;
John McCall8f0e8d22011-06-15 23:25:17 +000041+ (id)alloc;
42- (void)dealloc;
43
44- (void)finalize;
45
46- (id)copy;
47- (id)mutableCopy;
John McCall8f0e8d22011-06-15 23:25:17 +000048@end
49
John McCall8f0e8d22011-06-15 23:25:17 +000050NS_AUTOMATED_REFCOUNT_UNAVAILABLE
51@interface NSAutoreleasePool : NSObject {
52@private
53 void *_token;
54 void *_reserved3;
55 void *_reserved2;
56 void *_reserved;
57}
58
59+ (void)addObject:(id)anObject;
60
61- (void)addObject:(id)anObject;
62
63- (void)drain;
64
65@end
66
67typedef const void* objc_objectptr_t;
68extern __attribute__((ns_returns_retained)) id objc_retainedObject(objc_objectptr_t __attribute__((cf_consumed)) pointer);
69extern __attribute__((ns_returns_not_retained)) id objc_unretainedObject(objc_objectptr_t pointer);
70extern objc_objectptr_t objc_unretainedPointer(id object);
Argyrios Kyrtzidis1b8fbd32012-05-23 21:50:04 +000071
72#define dispatch_retain(object) ({ dispatch_object_t _o = (object); _dispatch_object_validate(_o); (void)[_o retain]; })
73#define dispatch_release(object) ({ dispatch_object_t _o = (object); _dispatch_object_validate(_o); [_o release]; })
74#define xpc_retain(object) ({ xpc_object_t _o = (object); _xpc_object_validate(_o); [_o retain]; })
75#define xpc_release(object) ({ xpc_object_t _o = (object); _xpc_object_validate(_o); [_o release]; })
76
77typedef id dispatch_object_t;
78typedef id xpc_object_t;
79
80void _dispatch_object_validate(dispatch_object_t object);
81void _xpc_object_validate(xpc_object_t object);