| 1 | // RUN: %clang_analyze_cc1 -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 | |
| 18 |