[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Analysis / symbol-simplification-disequality-info.cpp
blob69238b583eb8467d1dfe704331db2edc2b9d1d90
1 // RUN: %clang_analyze_cc1 %s \
2 // RUN: -analyzer-checker=core \
3 // RUN: -analyzer-checker=debug.ExprInspection \
4 // RUN: 2>&1 | FileCheck %s
6 // In this test we check how the solver's symbol simplification mechanism
7 // simplifies the disequality info.
9 void clang_analyzer_printState();
11 void test(int a, int b, int c, int d) {
12 if (a + b + c == d)
13 return;
14 clang_analyzer_printState();
15 // CHECK: "disequality_info": [
16 // CHECK-NEXT: {
17 // CHECK-NEXT: "class": [ "((reg_$0<int a>) + (reg_$1<int b>)) + (reg_$2<int c>)" ],
18 // CHECK-NEXT: "disequal_to": [
19 // CHECK-NEXT: [ "reg_$3<int d>" ]]
20 // CHECK-NEXT: },
21 // CHECK-NEXT: {
22 // CHECK-NEXT: "class": [ "reg_$3<int d>" ],
23 // CHECK-NEXT: "disequal_to": [
24 // CHECK-NEXT: [ "((reg_$0<int a>) + (reg_$1<int b>)) + (reg_$2<int c>)" ]]
25 // CHECK-NEXT: }
26 // CHECK-NEXT: ],
29 // Simplification starts here.
30 if (b != 0)
31 return;
32 clang_analyzer_printState();
33 // CHECK: "disequality_info": [
34 // CHECK-NEXT: {
35 // CHECK-NEXT: "class": [ "(reg_$0<int a>) + (reg_$2<int c>)" ],
36 // CHECK-NEXT: "disequal_to": [
37 // CHECK-NEXT: [ "reg_$3<int d>" ]]
38 // CHECK-NEXT: },
39 // CHECK-NEXT: {
40 // CHECK-NEXT: "class": [ "reg_$3<int d>" ],
41 // CHECK-NEXT: "disequal_to": [
42 // CHECK-NEXT: [ "(reg_$0<int a>) + (reg_$2<int c>)" ]]
43 // CHECK-NEXT: }
44 // CHECK-NEXT: ],
46 if (c != 0)
47 return;
48 clang_analyzer_printState();
49 // CHECK: "disequality_info": [
50 // CHECK-NEXT: {
51 // CHECK-NEXT: "class": [ "reg_$0<int a>" ],
52 // CHECK-NEXT: "disequal_to": [
53 // CHECK-NEXT: [ "reg_$3<int d>" ]]
54 // CHECK-NEXT: },
55 // CHECK-NEXT: {
56 // CHECK-NEXT: "class": [ "reg_$3<int d>" ],
57 // CHECK-NEXT: "disequal_to": [
58 // CHECK-NEXT: [ "reg_$0<int a>" ]]
59 // CHECK-NEXT: }
60 // CHECK-NEXT: ],
62 // Keep the symbols and the constraints! alive.
63 (void)(a * b * c * d);
64 return;