Home | History | Annotate | Download | only in Analysis
      1 // RUN: %clang_cc1 -analyze -analyzer-checker=core -verify %s
      2 
      3 @interface MyObject
      4 - (void)takePointer:(void *)ptr __attribute__((nonnull(1)));
      5 @end
      6 
      7 void testNonNullMethod(int *p, MyObject *obj) {
      8   if (p)
      9     return;
     10   [obj takePointer:p]; // expected-warning{{nonnull}}
     11 }
     12 
     13 
     14 @interface Subclass : MyObject
     15 // [[nonnull]] is an inherited attribute.
     16 - (void)takePointer:(void *)ptr;
     17 @end
     18 
     19 void testSubclass(int *p, Subclass *obj) {
     20   if (p)
     21     return;
     22   [obj takePointer:p]; // expected-warning{{nonnull}}
     23 }
     24