1 // RUN: %clang_analyze_cc1 %s \
2 // RUN: -analyzer-checker=core,debug.ExprInspection \
3 // RUN: -analyzer-config eagerly-assume=false \
6 void clang_analyzer_eval(int);
7 void clang_analyzer_dump(int);
9 int test(int x
, int y
) {
11 clang_analyzer_dump(-x
); // expected-warning{{-reg_$0<int x>}}
12 clang_analyzer_dump(~x
); // expected-warning{{~reg_$0<int x>}}
14 clang_analyzer_dump(-z
); // expected-warning{{-((reg_$0<int x>) + (reg_$1<int y>))}}
15 clang_analyzer_dump(-(x
+ y
)); // expected-warning{{-((reg_$0<int x>) + (reg_$1<int y>))}}
16 clang_analyzer_dump(-x
+ y
); // expected-warning{{(-reg_$0<int x>) + (reg_$1<int y>)}}
19 clang_analyzer_eval(-x
== 0); // expected-warning{{TRUE}}
20 clang_analyzer_eval(-x
> 0); // expected-warning{{FALSE}}
21 clang_analyzer_eval(-x
< 0); // expected-warning{{FALSE}}
24 clang_analyzer_eval(~y
== 0); // expected-warning{{TRUE}}
25 clang_analyzer_eval(~y
> 0); // expected-warning{{FALSE}}
26 clang_analyzer_eval(~y
< 0); // expected-warning{{FALSE}}
32 void test_svalbuilder_simplification(int x
, int y
) {
35 clang_analyzer_eval(-(x
+ y
) == -3); // expected-warning{{TRUE}}
36 // FIXME Commutativity is not supported yet.
37 clang_analyzer_eval(-(y
+ x
) == -3); // expected-warning{{UNKNOWN}}
40 int test_fp(int flag
) {
45 return value
; // no-warning