Anna Zaks | 841f168 | 2013-04-03 19:28:19 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -analyze -analyzer-checker=core -verify -Wno-null-dereference %s |
2 | |||||
3 | @interface Foo | ||||
4 | - (int &)ref; | ||||
5 | @end | ||||
6 | |||||
7 | Foo *getFoo() { return 0; } | ||||
8 | |||||
9 | void testNullPointerSuppression() { | ||||
10 | getFoo().ref = 1; | ||||
11 | } | ||||
12 | |||||
13 | void testPositiveNullReference() { | ||||
14 | Foo *x = 0; | ||||
15 | x.ref = 1; // expected-warning {{The receiver of message 'ref' is nil, which results in forming a null reference}} | ||||
16 | } | ||||
17 |