xref: /llvm-project/clang/test/Analysis/dump_egraph.c (revision 5ce7050f701c6907cc2522fc43d39a8cbcc119d2)
1 // RUN: %clang_analyze_cc1 -analyzer-checker=core \
2 // RUN:  -analyzer-dump-egraph=%t.dot %s
3 // RUN: cat %t.dot | FileCheck %s
4 
5 // RUN: %clang_analyze_cc1 -analyzer-checker=core \
6 // RUN:  -analyzer-dump-egraph=%t.dot \
7 // RUN:  -trim-egraph %s
8 // RUN: cat %t.dot | FileCheck %s
9 
10 int getJ(void);
11 
foo(void)12 int foo(void) {
13   int *x = 0, *y = 0;
14   char c = '\x13';
15 
16   return *x + *y;
17 }
18 
19 // CHECK: \"program_points\": [\l
20 // CHECK-SAME: \{ \"kind\": \"Edge\", \"src_id\": 2, \"dst_id\": 1,
21 // CHECK-SAME:    \"terminator\": null, \"term_kind\": null, \"tag\": null,
22 // CHECK-SAME:    \"node_id\": 1, \"is_sink\": 0, \"has_report\": 0
23 // CHECK-SAME: \},
24 // CHECK-SAME: \{ \"kind\": \"BlockEntrance\", \"block_id\": 1, \"tag\": null,
25 // CHECK-SAME:    \"node_id\": 2, \"is_sink\": 0, \"has_report\": 0
26 // CHECK-SAME: \},
27 // CHECK-SAME: \{ \"kind\": \"Statement\", \"stmt_kind\": \"IntegerLiteral\",
28 // CHECK-SAME:    \"stmt_id\": {{[0-9]*}}, \"pointer\": \"0x{{[0-9a-f]*}}\",
29 // CHECK-SAME:    \"pretty\": \"0\", \"location\": \{
30 // CHECK-SAME:        \"line\": 13, \"column\": 12, \"file\":
31 // CHECK-SAME:    \}, \"stmt_point_kind\": \"PreStmtPurgeDeadSymbols\",
32 // CHECK-SAME:    \"tag\": \"ExprEngine : Clean Node\", \"node_id\": 3,
33 // CHECK-SAME:    \"is_sink\": 0, \"has_report\": 0
34 // CHECK-SAME: \},
35 // CHECK-SAME: \{ \"kind\": \"Statement\", \"stmt_kind\": \"IntegerLiteral\",
36 // CHECK-SAME:    \"stmt_id\": {{[0-9]*}}, \"pointer\": \"0x{{[0-9a-f]*}}\",
37 // CHECK-SAME:    \"pretty\": \"0\", \"location\": \{
38 // CHECK-SAME:        \"line\": 13, \"column\": 12, \"file\":
39 // CHECK-SAME:    \}, \"stmt_point_kind\": \"PostStmt\", \"tag\": null,
40 // CHECK-SAME:    \"node_id\": 4, \"is_sink\": 0, \"has_report\": 0
41 // CHECK-SAME: \}
42 // CHECK-SAME: ]
43 
44 // CHECK: \"pretty\": \"*x\", \"location\": \{ \"line\": 16, \"column\": 10, \"file\": \"{{(.+)}}dump_egraph.c\" \}
45 
46 // CHECK: \"pretty\": \"'\\\\x13'\"
47 
48 // CHECK: \"has_report\": 1
49 
50 // CHECK-NOT: \"program_state\": null
51