[AMDGPU][AsmParser][NFC] Get rid of custom default operand handlers.
[llvm-project.git] / clang / test / Analysis / bool-increment.cpp
blob93002d3b61ec3c1e099e956547a66afddc6636b1
1 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.ExprInspection -verify -std=c++98 -Wno-deprecated %s
2 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.ExprInspection -verify -std=c++11 -Wno-deprecated %s
3 // RUN: %clang_analyze_cc1 -analyzer-checker=debug.ExprInspection -verify -std=c++14 -Wno-deprecated %s
5 extern void clang_analyzer_eval(bool);
7 void test_bool_value() {
9 bool b = true;
10 clang_analyzer_eval(b == 1); // expected-warning{{TRUE}}
14 bool b = false;
15 clang_analyzer_eval(b == 0); // expected-warning{{TRUE}}
19 bool b = -10;
20 clang_analyzer_eval(b == 1); // expected-warning{{TRUE}}
24 bool b = 10;
25 clang_analyzer_eval(b == 1); // expected-warning{{TRUE}}
29 bool b = 10;
30 b++;
31 clang_analyzer_eval(b == 1); // expected-warning{{TRUE}}
35 bool b = 0;
36 b++;
37 clang_analyzer_eval(b == 1); // expected-warning{{TRUE}}
41 void test_bool_increment() {
43 bool b = true;
44 b++;
45 clang_analyzer_eval(b); // expected-warning{{TRUE}}
49 bool b = false;
50 b++;
51 clang_analyzer_eval(b); // expected-warning{{TRUE}}
55 bool b = true;
56 ++b;
57 clang_analyzer_eval(b); // expected-warning{{TRUE}}
61 bool b = false;
62 ++b;
63 clang_analyzer_eval(b); // expected-warning{{TRUE}}
67 bool b = 0;
68 ++b;
69 clang_analyzer_eval(b); // expected-warning{{TRUE}}
73 bool b = 10;
74 ++b;
75 ++b;
76 clang_analyzer_eval(b); // expected-warning{{TRUE}}
80 bool b = -10;
81 ++b;
82 clang_analyzer_eval(b); // expected-warning{{TRUE}}