blob: bf282eca27d4eac035d5f1f4174da647bee5c9fc [file] [log] [blame]
Jordan Rosebf7f77a2012-09-25 19:03:09 +00001// RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -verify %s
2
3void clang_analyzer_eval(int);
4#define CHECK(expr) if (!(expr)) return; clang_analyzer_eval(expr)
5
6void testPersistentConstraints(int x, int y) {
7 // Sanity check
8 CHECK(x); // expected-warning{{TRUE}}
9 CHECK(x & 1); // expected-warning{{TRUE}}
10
11 // False positives due to SValBuilder giving up on certain kinds of exprs.
12 CHECK(1 - x); // expected-warning{{UNKNOWN}}
13 CHECK(x & y); // expected-warning{{UNKNOWN}}
14}