Alp Toker | bb17ff9 | 2013-10-28 23:47:09 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection %s -analyzer-output=text -verify |
Anna Zaks | d8eeac5 | 2013-04-15 22:38:07 +0000 | [diff] [blame] | 2 | |
| 3 | void clang_analyzer_eval(bool); |
| 4 | |
| 5 | // Test that the analyzer does not crash on GNU extension operator "?:". |
| 6 | void NoCrashTest(int x, int y) { |
| 7 | int w = x ?: y; |
| 8 | } |
| 9 | |
| 10 | void OperatorEvaluationTest(int y) { |
| 11 | int x = 1; |
| 12 | int w = x ?: y; // expected-note {{'?' condition is true}} |
| 13 | |
| 14 | // TODO: We are not precise when processing the "?:" operator in C++. |
| 15 | clang_analyzer_eval(w == 1); // expected-warning{{UNKNOWN}} |
| 16 | // expected-note@-1{{UNKNOWN}} |
| 17 | } |