Jordan Rose | aea020f | 2013-01-26 01:28:23 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-config suppress-null-return-paths=false -verify %s |
| 2 | // RUN: %clang_cc1 -analyze -analyzer-checker=core -verify -DSUPPRESSED=1 %s |
| 3 | |
| 4 | #ifdef SUPPRESSED |
| 5 | // expected-no-diagnostics |
| 6 | #endif |
| 7 | |
| 8 | namespace rdar12676053 { |
| 9 | // Delta-reduced from a preprocessed file. |
| 10 | template<class T> |
| 11 | class RefCount { |
| 12 | T *ref; |
| 13 | public: |
| 14 | T *operator->() const { |
| 15 | return ref ? ref : 0; |
| 16 | } |
| 17 | }; |
| 18 | |
| 19 | class string {}; |
| 20 | |
| 21 | class ParserInputState { |
| 22 | public: |
| 23 | string filename; |
| 24 | }; |
| 25 | |
| 26 | class Parser { |
| 27 | void setFilename(const string& f) { |
| 28 | inputState->filename = f; |
| 29 | #ifndef SUPPRESSED |
| 30 | // expected-warning@-2 {{Called C++ object pointer is null}} |
| 31 | #endif |
| 32 | } |
| 33 | protected: |
| 34 | RefCount<ParserInputState> inputState; |
| 35 | }; |
| 36 | } |