1*67e74705SXin Li __attribute__((objc_root_class)) 2*67e74705SXin Li @interface NSError 3*67e74705SXin Li @end 4*67e74705SXin Li 5*67e74705SXin Li __attribute__((objc_root_class)) 6*67e74705SXin Li @interface A 7*67e74705SXin Li @end 8*67e74705SXin Li 9*67e74705SXin Li struct X { }; 10*67e74705SXin Li 11*67e74705SXin Li void f1(int *x); // expected-warning{{pointer is missing a nullability type specifier}} 12*67e74705SXin Li 13*67e74705SXin Li typedef struct __attribute__((objc_bridge(NSError))) __CFError *CFErrorRef; 14*67e74705SXin Li typedef NSError *NSErrorPtr; 15*67e74705SXin Li typedef NSError **NSErrorPtrPtr; 16*67e74705SXin Li typedef CFErrorRef *CFErrorRefPtr; 17*67e74705SXin Li typedef int *int_ptr; 18*67e74705SXin Li typedef A *A_ptr; 19*67e74705SXin Li typedef int (^block_ptr)(int, int); 20*67e74705SXin Li 21*67e74705SXin Li #pragma clang assume_nonnull begin 22*67e74705SXin Li 23*67e74705SXin Li void f2(int *x); 24*67e74705SXin Li void f3(A* obj); 25*67e74705SXin Li void f4(int (^block)(int, int)); 26*67e74705SXin Li void f5(int_ptr x); 27*67e74705SXin Li void f6(A_ptr obj); 28*67e74705SXin Li void f7(int * _Nullable x); 29*67e74705SXin Li void f8(A * _Nullable obj); 30*67e74705SXin Li void f9(int X::* mem_ptr); 31*67e74705SXin Li void f10(int (X::*mem_func)(int, int)); 32*67e74705SXin Li void f11(int X::* _Nullable mem_ptr); 33*67e74705SXin Li void f12(int (X::* _Nullable mem_func)(int, int)); 34*67e74705SXin Li 35*67e74705SXin Li int_ptr f13(void); 36*67e74705SXin Li A *f14(void); 37*67e74705SXin Li 38*67e74705SXin Li int * _Null_unspecified f15(void); 39*67e74705SXin Li A * _Null_unspecified f16(void); 40*67e74705SXin Li void f17(CFErrorRef *error); // expected-note{{no known conversion from 'A * _Nonnull' to 'CFErrorRef _Nullable * _Nullable' (aka '__CFError **') for 1st argument}} 41*67e74705SXin Li void f18(A **); // expected-warning 2{{pointer is missing a nullability type specifier}} 42*67e74705SXin Li void f19(CFErrorRefPtr error); // expected-warning{{pointer is missing a nullability type specifier}} 43*67e74705SXin Li 44*67e74705SXin Li void g1(int (^)(int, int)); 45*67e74705SXin Li void g2(int (^ *bp)(int, int)); // expected-warning{{block pointer is missing a nullability type specifier}} 46*67e74705SXin Li // expected-warning@-1{{pointer is missing a nullability type specifier}} 47*67e74705SXin Li void g3(block_ptr *bp); // expected-warning{{block pointer is missing a nullability type specifier}} 48*67e74705SXin Li // expected-warning@-1{{pointer is missing a nullability type specifier}} 49*67e74705SXin Li void g4(int (*fp)(int, int)); 50*67e74705SXin Li void g5(int (**fp)(int, int)); // expected-warning 2{{pointer is missing a nullability type specifier}} 51*67e74705SXin Li 52*67e74705SXin Li @interface A(Pragmas1) 53*67e74705SXin Li + (instancetype)aWithA:(A *)a; 54*67e74705SXin Li - (A *)method1:(A_ptr)ptr; 55*67e74705SXin Li - (null_unspecified A *)method2; 56*67e74705SXin Li - (void)method3:(NSError **)error; // expected-note{{passing argument to parameter 'error' here}} 57*67e74705SXin Li - (void)method4:(NSErrorPtr *)error; // expected-note{{passing argument to parameter 'error' here}} 58*67e74705SXin Li - (void)method5:(NSErrorPtrPtr)error; 59*67e74705SXin Li // expected-warning@-1{{pointer is missing a nullability type specifier}} 60*67e74705SXin Li 61*67e74705SXin Li @property A *aProp; 62*67e74705SXin Li @property NSError **anError; // expected-warning 2{{pointer is missing a nullability type specifier}} 63*67e74705SXin Li @end 64*67e74705SXin Li 65*67e74705SXin Li int *global_int_ptr; 66*67e74705SXin Li 67*67e74705SXin Li // typedefs not inferred _Nonnull 68*67e74705SXin Li typedef int *int_ptr_2; 69*67e74705SXin Li 70*67e74705SXin Li typedef int * // expected-warning{{pointer is missing a nullability type specifier}} 71*67e74705SXin Li *int_ptr_ptr; 72*67e74705SXin Li f30(void)73*67e74705SXin Listatic inline void f30(void) { 74*67e74705SXin Li float *fp = global_int_ptr; // expected-error{{cannot initialize a variable of type 'float *' with an lvalue of type 'int * _Nonnull'}} 75*67e74705SXin Li 76*67e74705SXin Li int_ptr_2 ip2; 77*67e74705SXin Li float *fp2 = ip2; // expected-error{{cannot initialize a variable of type 'float *' with an lvalue of type 'int_ptr_2' (aka 'int *')}} 78*67e74705SXin Li 79*67e74705SXin Li int_ptr_ptr ipp; 80*67e74705SXin Li float *fp3 = ipp; // expected-error{{lvalue of type 'int_ptr_ptr' (aka 'int **')}} 81*67e74705SXin Li } 82*67e74705SXin Li 83*67e74705SXin Li @interface AA : A { 84*67e74705SXin Li @public 85*67e74705SXin Li id ivar1; 86*67e74705SXin Li _Nonnull id ivar2; 87*67e74705SXin Li } 88*67e74705SXin Li @end 89*67e74705SXin Li 90*67e74705SXin Li #pragma clang assume_nonnull end 91*67e74705SXin Li 92*67e74705SXin Li void f20(A *a); // expected-warning{{pointer is missing a nullability type specifier}} 93*67e74705SXin Li void f21(int_ptr x); // expected-warning{{pointer is missing a nullability type specifier}} 94*67e74705SXin Li void f22(A_ptr y); // expected-warning{{pointer is missing a nullability type specifier}} 95*67e74705SXin Li void f23(int_ptr _Nullable x); 96*67e74705SXin Li void f24(A_ptr _Nullable y); 97*67e74705SXin Li void f25(int_ptr_2 x); // expected-warning{{pointer is missing a nullability type specifier}} 98*67e74705SXin Li 99*67e74705SXin Li @interface A(OutsidePragmas1) 100*67e74705SXin Li + (instancetype)aWithInt:(int)value; // expected-warning{{pointer is missing a nullability type specifier}} 101*67e74705SXin Li @end 102