brintos

brintos / llvm-project-archived public Read only

0
0
Text · 565 B · 08d588f Raw
33 lines · plain
1// RUN: %clang_analyze_cc1 -triple i386-apple-darwin8 -analyzer-checker=core,alpha.core -verify -Wno-objc-root-class %s2 3// This test case shows that a nil instance variable can possibly be4// initialized by a method.5@interface RDar68882896{7  id *x;8}9- (void) test:(id) y;10- (void) test2:(id) y;11- (void) invalidate;12@end13 14id *getVal(void);15 16@implementation RDar688828917- (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@end32 33