1 // RUN: %clang_cc1 -analyze -analyzer-checker=core,debug.ExprInspection -analyzer-ipa=inlining -analyzer-store region -verify %s
2 
3 void clang_analyzer_eval(bool);
4 
5 
6 struct A {
7   int x;
8   A(int a) { x = a; }
9   int getx() const { return x; }
10 };
11 
12 void testNullObject(A *a) {
13   clang_analyzer_eval(a); // expected-warning{{UNKNOWN}}
14   (void)a->getx(); // assume we know what we're doing
15   clang_analyzer_eval(a); // expected-warning{{TRUE}}
16 }
17 
18 
19 // FIXME: These require constructor inlining to be enabled.
20 
21 void f1() {
22   A x(3);
23   // should be TRUE
24   clang_analyzer_eval(x.getx() == 3); // expected-warning{{UNKNOWN}}
25 }
26 
27 void f2() {
28   const A &x = A(3);
29   // should be TRUE
30   clang_analyzer_eval(x.getx() == 3); // expected-warning{{UNKNOWN}}
31 }
32 
33 void f3() {
34   const A &x = (A)3;
35   // should be TRUE
36   clang_analyzer_eval(x.getx() == 3); // expected-warning{{UNKNOWN}}
37 }
38