Debian Codegraph @

clang/test/Analysis/nil-receiver-undefined-larger-than-voidptr-ret-region.m

raw
1 // RUN: %clang_analyze_cc1 -triple i386-apple-darwin8 -analyzer-checker=core,alpha.core -verify -Wno-objc-root-class %s
2
3 // This test case shows that a nil instance variable can possibly be
4 // 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