[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Analysis / print-ranges.cpp
blob89a4249ebfaa55eecc92f1d82478125d4d366f22
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core,debug.ExprInspection -analyzer-config eagerly-assume=false -verify %s
2 // UNSUPPORTED z3
4 template <typename T>
5 void clang_analyzer_value(T x);
6 void clang_analyzer_value();
7 template <typename T1, typename T2>
8 void clang_analyzer_value(T1 x, T2 y);
10 void test1(char x) {
11 clang_analyzer_value(x); // expected-warning{{8s:{ [-128, 127] }}}
12 if (x > 42)
13 clang_analyzer_value(x); // expected-warning{{8s:{ [43, 127] }}}
14 if (x == 42)
15 clang_analyzer_value(x); // expected-warning{{8s:42}}
18 void test2(short x) {
19 clang_analyzer_value(x); // expected-warning{{16s:{ [-32768, 32767] }}}
20 if (x < 4200)
21 clang_analyzer_value(x); // expected-warning{{16s:{ [-32768, 4199] }}}
22 if (x == 4200)
23 clang_analyzer_value(x); // expected-warning{{16s:4200}}
26 void test3(unsigned long long x) {
27 clang_analyzer_value(x); // expected-warning{{64u:{ [0, 18446744073709551615] }}}
28 if (x != 42000000)
29 clang_analyzer_value(x); // expected-warning{{64u:{ [0, 41999999], [42000001, 18446744073709551615] }}}
30 if (x == 18446744073709551615ull)
31 clang_analyzer_value(x); // expected-warning{{64u:18446744073709551615}}
34 struct S {};
35 void test4(S s) {
36 clang_analyzer_value(s); // expected-warning{{n/a}}
39 void test5() {
40 clang_analyzer_value(); // expected-warning{{Missing argument}}
43 void test6(int x, int y) {
44 if (x == 42 && y == 24)
45 // Ignore 'y'.
46 clang_analyzer_value(x, y); // expected-warning{{32s:42}}