#include "nonnull.h"
@class NSObject;
NONNULL_ATTR
int f1(int x); int f2(int *x) __attribute__ ((nonnull (1)));
int f3(int *x) __attribute__ ((nonnull (0))); int f4(int *x, int *y) __attribute__ ((nonnull (1,2)));
int f5(int *x, int *y) __attribute__ ((nonnull (2,1)));
int f6(NSObject *x) __attribute__ ((nonnull (1))); int f7(NSObject *x) __attribute__ ((nonnull));
extern void func1 (void (^block1)(), void (^block2)(), int) __attribute__((nonnull));
extern void func3 (void (^block1)(), int, void (^block2)(), int)
__attribute__((nonnull(1,3)));
extern void func4 (void (^block1)(), void (^block2)()) __attribute__((nonnull(1)))
__attribute__((nonnull(2)));
void func6(); void func7();
void
foo (int i1, int i2, int i3, void (^cp1)(), void (^cp2)(), void (^cp3)())
{
func1(cp1, cp2, i1);
func1(0, cp2, i1); func1(cp1, 0, i1); func1(cp1, cp2, 0);
func3(0, i2, cp3, i3); func3(cp3, i2, 0, i3);
func4(0, cp1); func4(cp1, 0);
func6((NSObject*) 0); func7((NSObject*) 0); }
void func5(int) NONNULL_ATTR;
struct dispatch_object_s {
int x;
};
typedef union {
long first;
struct dispatch_object_s *_do;
} dispatch_object_t __attribute__((transparent_union));
__attribute__((nonnull))
void _dispatch_queue_push_list(dispatch_object_t _head);
void func6(dispatch_object_t _head) { _dispatch_queue_push_list(0); _dispatch_queue_push_list(_head._do); }
#define NULL (void*)0
@interface NSObject
- (void)doSomethingWithNonNullPointer:(void *)ptr :(int)iarg : (void*)ptr1 __attribute__((nonnull(1, 3)));
+ (void)doSomethingClassyWithNonNullPointer:(void *)ptr __attribute__((nonnull(1)));
- (void*)returnsCNonNull __attribute__((returns_nonnull)); - (id)returnsObjCNonNull __attribute__((returns_nonnull)); - (int)returnsIntNonNull __attribute__((returns_nonnull)); @end
extern void DoSomethingNotNull(void *db) __attribute__((nonnull(1)));
@interface IMP
{
void * vp;
}
- (void*) testRetNull __attribute__((returns_nonnull));
@end
@implementation IMP
- (void) Meth {
NSObject *object;
[object doSomethingWithNonNullPointer:NULL:1:NULL]; [object doSomethingWithNonNullPointer:vp:1:NULL]; [NSObject doSomethingClassyWithNonNullPointer:NULL]; DoSomethingNotNull(NULL); [object doSomethingWithNonNullPointer:vp:1:vp];
}
- (void*) testRetNull {
return 0; }
@end
__attribute__((objc_root_class))
@interface TestNonNullParameters
- (void) doNotPassNullParameterNonPointerArg:(int)__attribute__((nonnull))x; - (void) doNotPassNullParameter:(id)__attribute__((nonnull))x;
- (void) doNotPassNullParameterArgIndex:(id)__attribute__((nonnull(1)))x; - (void) doNotPassNullOnMethod:(id)x __attribute__((nonnull(1)));
@end
void test(TestNonNullParameters *f) {
[f doNotPassNullParameter:0]; [f doNotPassNullParameterArgIndex:0]; [f doNotPassNullOnMethod:0]; }
void PR18795(int (^g)(const char *h, ...) __attribute__((nonnull(1))) __attribute__((nonnull))) {
g(0); }
void PR18795_helper() {
PR18795(0); }
void (^PR23117)(int *) = ^(int *p1) __attribute__((nonnull(1))) {};
typedef int *intptr;
#pragma clang assume_nonnull begin
intptr a, b;
intptr c, (*d)();
#pragma clang assume_nonnull end