Ted Kremenek | d71ed26 | 2008-04-10 22:16:52 +0000 | [diff] [blame] | 1 | // RUN: clang -checker-simple -verify %s |
Ted Kremenek | 2f54af4 | 2008-04-02 16:54:39 +0000 | [diff] [blame] | 2 | |
3 | void f1(int *p) { | ||||
4 | if (p) *p = 1; | ||||
5 | else *p = 0; // expected-warning{{ereference}} | ||||
6 | } | ||||
Ted Kremenek | b9ab690 | 2008-04-21 23:44:17 +0000 | [diff] [blame^] | 7 | |
8 | struct foo_struct { | ||||
9 | int x; | ||||
10 | }; | ||||
11 | |||||
12 | int f2(struct foo_struct* p) { | ||||
13 | |||||
14 | if (p) | ||||
15 | p->x = 1; | ||||
16 | |||||
17 | return p->x++; | ||||
18 | } |