Home | History | Annotate | Download | only in Analysis
      1 // RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -verify %s
      2 
      3 void clang_analyzer_eval(int);
      4 #define CHECK(expr) if (!(expr)) return; clang_analyzer_eval(expr)
      5 
      6 void 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 }