Skip to content

Commit d93b810

Browse files
committed
[analyzer] exploded-graph-rewriter: Fix dump for state 0.
It shouldn't say "unspecified" when the state is specified to be empty. llvm-svn: 375279
1 parent 7a17f19 commit d93b810

File tree

5 files changed

+25
-16
lines changed

5 files changed

+25
-16
lines changed

clang/test/Analysis/exploded-graph-rewriter/edge.dot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// UNSUPPORTED: system-windows
66

77
Node0x1 [shape=record,label=
8-
"{{ "program_state": null, "program_points": [
8+
"{{ "state_id": 0, "program_state": null, "program_points": [
99
{
1010
"kind": "BlockEntrance", "block_id": 1,
1111
"terminator": null, "term_kind": null,
@@ -19,7 +19,7 @@ Node0x1 [shape=record,label=
1919
Node0x1 -> Node0x2;
2020

2121
Node0x2 [shape=record,label=
22-
"{{ "program_state": null, "program_points": [
22+
"{{ "state_id": 0, "program_state": null, "program_points": [
2323
{
2424
"kind": "BlockEntrance", "block_id": 1,
2525
"terminator": null, "term_kind": null,

clang/test/Analysis/exploded-graph-rewriter/node_labels.dot

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@
1515
// CHECK-SAME: <tr>
1616
// LIGHT-SAME: <td bgcolor="gray70">
1717
// DARK-SAME: <td bgcolor="gray20">
18-
// CHECK-SAME: <b>State Unspecified</b>
18+
// CHECK-SAME: <b>State 0</b>
1919
// CHECK-SAME: </td>
2020
// CHECK-SAME: </tr>
2121
Node0x1 [shape=record,label=
2222
"{
23-
{ "node_id": 1, "pointer": "0x1", "has_report": false, "is_sink": false,
24-
"program_state": null,
23+
{ "state_id": 0, "program_state": null,
2524
"program_points": [
2625
{
2726
"kind": "BlockEntrance", "block_id": 1,
@@ -48,7 +47,7 @@ Node0x1 [shape=record,label=
4847
// CHECK-SAME: </tr>
4948
Node0x2 [shape=record,label=
5049
"{
51-
{ "program_state": null,
50+
{ "state_id": 0, "program_state": null,
5251
"program_points": [
5352
{
5453
"kind": "BlockEntrance", "block_id": 1,

clang/test/Analysis/exploded-graph-rewriter/program_points.dot

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
Node0x1 [shape=record,label=
3030
"{
3131
{
32-
"program_state": null, "program_points": [
32+
"state_id": 0, "program_state": null, "program_points": [
3333
{
3434
"kind": "Edge",
3535
"src_id": 0,
@@ -80,7 +80,7 @@ Node0x1 [shape=record,label=
8080
// CHECK-SAME: </table>
8181
Node0x3 [shape=record,label=
8282
"{
83-
{ "program_state": null, "program_points": [
83+
{ "state_id": 0, "program_state": null, "program_points": [
8484
{
8585
"kind": "Statement",
8686
"stmt_kind": "DeclRefExpr",
@@ -109,7 +109,7 @@ Node0x3 [shape=record,label=
109109
Node0x4 [shape=record,label=
110110
"{
111111
{
112-
"program_state": null, "program_points": [
112+
"state_id": 0, "program_state": null, "program_points": [
113113
{
114114
"kind": "Statement",
115115
"stmt_kind": "CompoundStmt",
@@ -157,7 +157,7 @@ Node0x4 [shape=record,label=
157157
// CHECK-SAME: </table>
158158
Node0x5 [shape=record,label=
159159
"{
160-
{ "program_state": null, "program_points": [
160+
{ "state_id": 0, "program_state": null, "program_points": [
161161
{
162162
"kind": "Statement",
163163
"stmt_kind": "ImplicitCastExpr",

clang/test/Analysis/exploded-graph-rewriter/trimmers.dot

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// UNSUPPORTED: system-windows
1818

1919
Node0x1 [shape=record,label=
20-
"{{ "program_state": null, "program_points": [
20+
"{{ "state_id": 0, "program_state": null, "program_points": [
2121
{
2222
"kind": "BlockEntrance", "block_id": 1,
2323
"terminator": null, "term_kind": null,
@@ -27,7 +27,7 @@ Node0x1 [shape=record,label=
2727
]}\l}"];
2828

2929
Node0x2 [shape=record,label=
30-
"{{ "program_state": null, "program_points": [
30+
"{{ "state_id": 0, "program_state": null, "program_points": [
3131
{
3232
"kind": "BlockEntrance", "block_id": 1,
3333
"terminator": null, "term_kind": null,
@@ -37,7 +37,7 @@ Node0x2 [shape=record,label=
3737
]}\l}"];
3838

3939
Node0x3 [shape=record,label=
40-
"{{ "program_state": null, "program_points": [
40+
"{{ "state_id": 0, "program_state": null, "program_points": [
4141
{
4242
"kind": "BlockEntrance", "block_id": 1,
4343
"terminator": null, "term_kind": null,
@@ -47,7 +47,7 @@ Node0x3 [shape=record,label=
4747
]}\l}"];
4848

4949
Node0x4 [shape=record,label=
50-
"{{ "program_state": null, "program_points": [
50+
"{{ "state_id": 0, "program_state": null, "program_points": [
5151
{
5252
"kind": "BlockEntrance", "block_id": 1,
5353
"terminator": null, "term_kind": null,

clang/utils/analyzer/exploded-graph-rewriter.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,16 @@ def __init__(self, state_id, json_ps):
273273
super(ProgramState, self).__init__()
274274
logging.debug('Adding ProgramState ' + str(state_id))
275275

276+
if json_ps is None:
277+
json_ps = {
278+
'store': None,
279+
'environment': None,
280+
'constraints': None,
281+
'dynamic_types': None,
282+
'constructing_objects': None,
283+
'checker_messages': None
284+
}
285+
276286
self.state_id = state_id
277287

278288
self.store = Store(json_ps['store']) \
@@ -316,8 +326,8 @@ def construct(self, node_id, json_node):
316326
self.points = [ProgramPoint(p) for p in json_node['program_points']]
317327
self.node_id = self.points[-1].node_id
318328
self.state = ProgramState(json_node['state_id'],
319-
json_node['program_state']) \
320-
if json_node['program_state'] is not None else None
329+
json_node['program_state']
330+
if json_node['program_state'] is not None else None);
321331

322332
assert self.node_name() == node_id
323333

0 commit comments

Comments
 (0)