Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Analysis / Inputs / system-header-simulator-for-malloc.h
blobe76455655e9e2e920bd8a14b23a095d12b308fe3
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
8 typedef __typeof(sizeof(int)) size_t;
9 void *malloc(size_t);
10 void *calloc(size_t, size_t);
11 void free(void *);
14 #if __OBJC__
16 #import "system-header-simulator-objc.h"
18 @interface Wrapper : NSData
19 - (id)initWithBytesNoCopy:(void *)bytes length:(NSUInteger)len;
20 @end
22 @implementation Wrapper
23 - (id)initWithBytesNoCopy:(void *)bytes length:(NSUInteger)len {
24 return [self initWithBytesNoCopy:bytes length:len freeWhenDone:1]; // no-warning
26 @end
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
34 #endif