Clang Project

clang_source_code/test/Analysis/Inputs/system-header-simulator-for-nullability.h
1#pragma clang system_header
2
3#define nil 0
4#define BOOL int
5
6#define NS_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin")
7#define NS_ASSUME_NONNULL_END   _Pragma("clang assume_nonnull end")
8
9NS_ASSUME_NONNULL_BEGIN
10
11typedef struct _NSZone NSZone;
12typedef unsigned long NSUInteger;
13@class NSCoder, NSEnumerator;
14
15@protocol NSObject
16+ (instancetype)alloc;
17- (instancetype)init;
18- (instancetype)autorelease;
19@end
20
21@protocol NSCopying
22- (id)copyWithZone:(nullable NSZone *)zone;
23@end
24
25@protocol NSMutableCopying
26- (id)mutableCopyWithZone:(nullable NSZone *)zone;
27@end
28
29@protocol NSCoding
30- (void)encodeWithCoder:(NSCoder *)aCoder;
31@end
32
33@protocol NSSecureCoding <NSCoding>
34@required
35+ (BOOL)supportsSecureCoding;
36@end
37
38typedef struct {
39  unsigned long state;
40  id *itemsPtr;
41  unsigned long *mutationsPtr;
42  unsigned long extra[5];
43} NSFastEnumerationState;
44
45__attribute__((objc_root_class))
46@interface
47NSObject<NSObject>
48@end
49
50@interface NSString : NSObject<NSCopying>
51- (BOOL)isEqualToString : (NSString *)aString;
52- (NSString *)stringByAppendingString:(NSString *)aString;
53- (nullable NSString *)nullableStringByAppendingString:(NSString *)aString;
54+ (NSString * _Nonnull) generateString;
55+ (NSString *) generateImplicitlyNonnullString;
56+ (NSString * _Nullable) generatePossiblyNullString;
57@end
58
59void NSSystemFunctionTakingNonnull(NSString *s);
60
61@interface NSSystemClass : NSObject
62- (void) takesNonnull:(NSString *)s;
63@end
64
65NSString* _Nullable getPossiblyNullString();
66NSString* _Nonnull  getString();
67
68@protocol MyProtocol
69- (NSString * _Nonnull) getString;
70@end
71
72NS_ASSUME_NONNULL_END
73
74@interface NSDictionary : NSObject <NSCopying, NSMutableCopying, NSSecureCoding>
75
76- (NSUInteger)count;
77- (id)objectForKey:(id)aKey;
78- (NSEnumerator *)keyEnumerator;
79- (id)objectForKeyedSubscript:(id)aKey;
80
81@end
82
83@interface NSDictionary (NSDictionaryCreation)
84
85+ (id)dictionary;
86+ (id)dictionaryWithObject:(id)object forKey:(id <NSCopying>)key;
87+ (instancetype)dictionaryWithObjects:(const id [])objects forKeys:(const id <NSCopying> [])keys count:(NSUInteger)cnt;
88
89@end
90
91@interface NSMutableDictionary : NSDictionary
92
93- (void)removeObjectForKey:(id)aKey;
94- (void)setObject:(id)anObject forKey:(id <NSCopying>)aKey;
95
96@end
97
98@interface NSMutableDictionary (NSExtendedMutableDictionary)
99
100- (void)addEntriesFromDictionary:(NSDictionary *)otherDictionary;
101- (void)removeAllObjects;
102- (void)setDictionary:(NSDictionary *)otherDictionary;
103- (void)setObject:(id)obj forKeyedSubscript:(id <NSCopying>)key __attribute__((availability(macosx,introduced=10.8)));
104
105@end
106