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 __typeof(sizeof(int)) size_t;
9void *malloc(size_t);
10void *calloc(size_t, size_t);
11void free(void *);
12
13
14#if __OBJC__
15
16#import "system-header-simulator-objc.h"
17
18@interface Wrapper : NSData
19- (id)initWithBytesNoCopy:(void *)bytes length:(NSUInteger)len;
20@end
21
22@implementation Wrapper
23- (id)initWithBytesNoCopy:(void *)bytes length:(NSUInteger)len {
24  return [self initWithBytesNoCopy:bytes length:len freeWhenDone:1]; // no-warning
25}
26@end
27
28@interface CustomData : NSData
29+ (id)somethingNoCopy:(char *)bytes;
30+ (id)somethingNoCopy:(void *)bytes length:(NSUInteger)length freeWhenDone:(BOOL)freeBuffer;
31+ (id)something:(char *)bytes freeWhenDone:(BOOL)freeBuffer;
32@end
33
34#endif
35