Anna Zaks | 5fc1d0c | 2012-09-17 19:13:56 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -analyze -analyzer-checker=core -verify -Wno-objc-root-class %s |
Andy Gibbs | 8e8fb3b | 2012-10-19 12:44:48 +0000 | [diff] [blame] | 2 | // expected-no-diagnostics |
Anna Zaks | 5fc1d0c | 2012-09-17 19:13:56 +0000 | [diff] [blame] | 3 | |
| 4 | // Test reasoning about static locals in ObjCMethods. |
| 5 | int *getValidPtr(); |
| 6 | @interface Radar11275803 |
| 7 | - (int) useStaticInMethod; |
| 8 | @end |
| 9 | @implementation Radar11275803 |
| 10 | |
| 11 | - (int) useStaticInMethod |
| 12 | { |
| 13 | static int *explInit = 0; |
| 14 | static int implInit; |
| 15 | if (!implInit) |
| 16 | explInit = getValidPtr(); |
| 17 | return *explInit; //no-warning |
| 18 | } |
| 19 | @end |