Home | History | Annotate | Download | only in Analysis
      1 // RUN: %clang_cc1 -triple i386-apple-darwin8 -analyze -analyzer-checker=core,alpha.core -analyzer-constraints=range -analyzer-store=region -verify -Wno-objc-root-class %s
      2 
      3 // <rdar://problem/6888289> - This test case shows that a nil instance
      4 // variable can possibly be initialized by a method.
      5 @interface RDar6888289
      6 {
      7   id *x;
      8 }
      9 - (void) test:(id) y;
     10 - (void) test2:(id) y;
     11 - (void) invalidate;
     12 @end
     13 
     14 id *getVal(void);
     15 
     16 @implementation RDar6888289
     17 - (void) test:(id)y {
     18   if (!x)
     19     [self invalidate];
     20   *x = y;
     21 }
     22 - (void) test2:(id)y {
     23   if (!x) {}
     24   *x = y; // expected-warning {{null}}
     25 }
     26 
     27 - (void) invalidate {
     28   x = getVal();
     29 }
     30 
     31 @end
     32 
     33