1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -triple x86_64-apple-darwin13 -Wno-shift-count-overflow -verify %s
3 void clang_analyzer_eval(int);
4 #define CHECK(expr) if (!(expr)) return; clang_analyzer_eval(expr)
6 void testPersistentConstraints(int x, int y) {
8 CHECK(x); // expected-warning{{TRUE}}
9 CHECK(x & 1); // expected-warning{{TRUE}}
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}}
16 int testConstantShifts_PR18073(int which) {
17 // FIXME: We should have a checker that actually specifically checks bitwise
18 // shifts against the width of the LHS's /static/ type, rather than just
19 // having BasicValueFactory return "undefined" when dealing with two constant
23 return 0ULL << 63; // no-warning
25 return 0ULL << 64; // expected-warning{{The result of the '<<' expression is undefined}}
27 return 0ULL << 65; // expected-warning{{The result of the '<<' expression is undefined}}