[AMDGPU][AsmParser][NFC] Get rid of custom default operand handlers.
[llvm-project.git] / clang / test / Analysis / expr-inspection.cpp
blob94db6e38b84194472ac72b040e6dce353676ffdf
1 // RUN: %clang_analyze_cc1 -x c++ -analyzer-checker=debug.ExprInspection \
2 // RUN: -analyzer-config support-symbolic-integer-casts=false \
3 // RUN: -verify %s
5 // RUN: %clang_analyze_cc1 -x c++ -analyzer-checker=debug.ExprInspection \
6 // RUN: -analyzer-config support-symbolic-integer-casts=true \
7 // RUN: -verify %s
9 // Self-tests for the debug.ExprInspection checker.
11 template <typename T>
12 void clang_analyzer_denote(T x, const char *str);
13 template <typename T>
14 void clang_analyzer_express(T x);
16 // Invalid declarations to test basic correctness checks.
17 void clang_analyzer_denote();
18 void clang_analyzer_denote(int x);
19 void clang_analyzer_express();
21 void foo(int x, unsigned y) {
22 clang_analyzer_denote(); // expected-warning{{clang_analyzer_denote() requires a symbol and a string literal}}
23 clang_analyzer_express(); // expected-warning{{Missing argument}}
25 clang_analyzer_denote(x); // expected-warning{{clang_analyzer_denote() requires a symbol and a string literal}}
26 clang_analyzer_express(x); // expected-warning{{Unable to express}}
28 clang_analyzer_denote(x, "$x");
29 clang_analyzer_express(-x); // expected-warning{{-$x}}
31 clang_analyzer_denote(y, "$y");
32 clang_analyzer_express(x + y); // expected-warning{{$x + $y}}
34 clang_analyzer_denote(1, "$z"); // expected-warning{{Not a symbol}}
35 clang_analyzer_express(1); // expected-warning{{Not a symbol}}
37 clang_analyzer_denote(x + 1, "$w");
38 clang_analyzer_express(x + 1); // expected-warning{{$w}}
39 clang_analyzer_express(y + 1); // expected-warning{{$y + 1U}}