diff options
author | Artem Dergachev <artem.dergachev@gmail.com> | 2019-10-17 23:10:09 +0000 |
---|---|---|
committer | Artem Dergachev <artem.dergachev@gmail.com> | 2019-10-17 23:10:09 +0000 |
commit | d0e3ed0b01ba7e55081e5b2593460b7b1486fd24 (patch) | |
tree | 38ef8ff2978259425fb6fc6a9cf218778cd7c4a0 /test | |
parent | 40a1cfa0b13160d82f688daa7fbab9f249679617 (diff) | |
download | clang-d0e3ed0b01ba7e55081e5b2593460b7b1486fd24.tar.gz |
[analyzer] Assign truly stable identifiers to exploded nodes.
ExplodedGraph nodes will now have a numeric identifier stored in them
which will keep track of the order in which the nodes were created
and it will be fully deterministic both accross runs and across machines.
This is extremely useful for debugging as it allows reliably setting
conditional breakpoints by node IDs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@375186 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
14 files changed, 259 insertions, 118 deletions
diff --git a/test/Analysis/dump_egraph.c b/test/Analysis/dump_egraph.c index 99463da3e7..4ad04002c4 100644 --- a/test/Analysis/dump_egraph.c +++ b/test/Analysis/dump_egraph.c @@ -18,7 +18,7 @@ int foo() { return *x + *y; } -// CHECK: \"program_points\": [\l \{ \"kind\": \"Edge\", \"src_id\": 2, \"dst_id\": 1, \"terminator\": null, \"term_kind\": null, \"tag\": null \}\l ],\l \"program_state\": null +// CHECK: \"program_points\": [\l \{ \"kind\": \"Edge\", \"src_id\": 2, \"dst_id\": 1, \"terminator\": null, \"term_kind\": null, \"tag\": null, \"node_id\": 1, \"is_sink\":0, \"has_report\": 0 \}\l ],\l \"program_state\": null // CHECK: \"program_points\": [\l \{ \"kind\": \"BlockEntrance\", \"block_id\": 1 @@ -27,4 +27,4 @@ int foo() { // CHECK: \"pretty\": \"'\\\\x13'\" -// CHECK: \"has_report\": true +// CHECK: \"has_report\": 1 diff --git a/test/Analysis/exploded-graph-rewriter/checker_messages.dot b/test/Analysis/exploded-graph-rewriter/checker_messages.dot index 84185db5af..2d054a8d48 100644 --- a/test/Analysis/exploded-graph-rewriter/checker_messages.dot +++ b/test/Analysis/exploded-graph-rewriter/checker_messages.dot @@ -14,7 +14,14 @@ Node0x1 [shape=record,label= "has_report": false, "is_sink": false, "state_id": 2, - "program_points": [], + "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 1, + "has_report": 0, "is_sink": 0 + } + ], "program_state": { "store": null, "constraints": null, diff --git a/test/Analysis/exploded-graph-rewriter/checker_messages_diff.dot b/test/Analysis/exploded-graph-rewriter/checker_messages_diff.dot index 2f0bcbd4e5..898f79600b 100644 --- a/test/Analysis/exploded-graph-rewriter/checker_messages_diff.dot +++ b/test/Analysis/exploded-graph-rewriter/checker_messages_diff.dot @@ -5,12 +5,15 @@ Node0x1 [shape=record,label= "{ - { "node_id": 1, - "pointer": "0x1", - "has_report": false, - "is_sink": false, - "state_id": 2, - "program_points": [], + { "state_id": 2, + "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 1, + "has_report": 0, "is_sink": 0 + } + ], "program_state": { "environment": null, "store": null, @@ -59,12 +62,16 @@ Node0x1 -> Node0x4; // CHECK-SAME: </tr> Node0x4 [shape=record,label= "{ - { "node_id": 4, - "pointer": "0x4", - "has_report": false, - "is_sink": false, + { "state_id": 5, - "program_points": [], + "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 1, + "has_report": 0, "is_sink": 0 + } + ], "program_state": { "environment": null, "store": null, @@ -88,12 +95,15 @@ Node0x4 -> Node0x6; Node0x6 [shape=record,label= "{ - { "node_id": 6, - "pointer": "0x6", - "has_report": false, - "is_sink": false, - "state_id": 7, - "program_points": [], + { "state_id": 7, + "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 1, + "has_report": 0, "is_sink": 0 + } + ], "program_state": null } \l}"]; diff --git a/test/Analysis/exploded-graph-rewriter/constraints.dot b/test/Analysis/exploded-graph-rewriter/constraints.dot index 075df98ce9..f5ebcf1a60 100644 --- a/test/Analysis/exploded-graph-rewriter/constraints.dot +++ b/test/Analysis/exploded-graph-rewriter/constraints.dot @@ -12,12 +12,16 @@ // CHECK-SAME: </table></td></tr> Node0x1 [shape=record,label= "{ - { "node_id": 1, - "pointer": "0x1", - "has_report": false, - "is_sink": false, + { "state_id": 2, - "program_points": [], + "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 1, + "has_report": 0, "is_sink": 0 + } + ], "program_state": { "store": null, "environment": null, diff --git a/test/Analysis/exploded-graph-rewriter/constraints_diff.dot b/test/Analysis/exploded-graph-rewriter/constraints_diff.dot index 00b2f1456f..53a87aa667 100644 --- a/test/Analysis/exploded-graph-rewriter/constraints_diff.dot +++ b/test/Analysis/exploded-graph-rewriter/constraints_diff.dot @@ -5,12 +5,16 @@ Node0x1 [shape=record,label= "{ - { "node_id": 1, - "pointer": "0x1", - "has_report": false, - "is_sink": false, + { "state_id": 2, - "program_points": [], + "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 1, + "has_report": 0, "is_sink": 0 + } + ], "program_state": { "store": null, "environment": null, @@ -39,12 +43,16 @@ Node0x1 -> Node0x3; // CHECK-SAME: </tr> Node0x3 [shape=record,label= "{ - { "node_id": 3, - "pointer": "0x3", - "has_report": false, - "is_sink": false, + { "state_id": 4, - "program_points": [], + "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 1, + "has_report": 0, "is_sink": 0 + } + ], "program_state": { "store": null, "environment": null, @@ -62,12 +70,16 @@ Node0x3 -> Node0x5; Node0x5 [shape=record,label= "{ - { "node_id": 5, - "pointer": "0x5", - "has_report": false, - "is_sink": false, + { "state_id": 6, - "program_points": [], + "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 1, + "has_report": 0, "is_sink": 0 + } + ], "program_state": { "store": null, "environment": null, diff --git a/test/Analysis/exploded-graph-rewriter/edge.dot b/test/Analysis/exploded-graph-rewriter/edge.dot index 15e55612b8..3923f1f8ee 100644 --- a/test/Analysis/exploded-graph-rewriter/edge.dot +++ b/test/Analysis/exploded-graph-rewriter/edge.dot @@ -5,13 +5,25 @@ // UNSUPPORTED: system-windows Node0x1 [shape=record,label= - "{{ "node_id": 1, "pointer": "0x1", "has_report": false, "is_sink": false, - "program_state": null, "program_points": []}\l}"]; + "{{ "program_state": null, "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 1, + "has_report": 0, "is_sink": 0 + } + ]}\l}"]; // LIGHT: Node0x1 -> Node0x2; // DARK: Node0x1 -> Node0x2 [color="white"]; Node0x1 -> Node0x2; Node0x2 [shape=record,label= - "{{ "node_id": 2, "pointer": "0x2", "has_report": false, "is_sink": false, - "program_state": null, "program_points": []}\l}"]; + "{{ "program_state": null, "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 1, + "has_report": 0, "is_sink": 0 + } + ]}\l}"]; diff --git a/test/Analysis/exploded-graph-rewriter/environment.dot b/test/Analysis/exploded-graph-rewriter/environment.dot index 399484a7ee..733aae3036 100644 --- a/test/Analysis/exploded-graph-rewriter/environment.dot +++ b/test/Analysis/exploded-graph-rewriter/environment.dot @@ -11,7 +11,7 @@ // CHECK-SAME: </td> // CHECK-SAME: <td align="left" colspan="2"> // CHECK-SAME: <font color="gray60">foo </font> -// CHECK-SAME: (environment.cpp:<b>4</b>:<b>6</b> +// CHECK-SAME: (environment.cpp:<b>4</b>:<b>6</b> // CHECK-SAME: <font color="royalblue1"> // CHECK-SAME: (<i>spelling at </i> environment.h:<b>7</b>:<b>8</b>) // CHECK-SAME: </font>) @@ -36,7 +36,14 @@ Node0x1 [shape=record,label= "has_report": false, "is_sink": false, "state_id": 2, - "program_points": [], + "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 1, + "has_report": 0, "is_sink": 0 + } + ], "program_state": { "store": null, "constraints": null, diff --git a/test/Analysis/exploded-graph-rewriter/environment_diff.dot b/test/Analysis/exploded-graph-rewriter/environment_diff.dot index 475247bb98..05e8d4eef5 100644 --- a/test/Analysis/exploded-graph-rewriter/environment_diff.dot +++ b/test/Analysis/exploded-graph-rewriter/environment_diff.dot @@ -6,12 +6,16 @@ // No diffs on the first node, nothing to check. Node0x1 [shape=record,label= "{ - { "node_id": 1, - "pointer": "0x1", - "has_report": false, - "is_sink": false, + { "state_id": 2, - "program_points": [], + "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 1, + "has_report": 0, "is_sink": 0 + } + ], "program_state": { "store": null, "constraints": null, @@ -57,12 +61,16 @@ Node0x1 -> Node0x6; // CHECK-SAME: </tr> Node0x6 [shape=record,label= "{ - { "node_id": 6, - "pointer": "0x6", - "has_report": false, - "is_sink": false, + { "state_id": 7, - "program_points": [], + "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 1, + "has_report": 0, "is_sink": 0 + } + ], "program_state": { "store": null, "constraints": null, @@ -102,12 +110,16 @@ Node0x6 -> Node0x9; // CHECK-SAME: </tr> Node0x9 [shape=record,label= "{ - { "node_id": 9, - "pointer": "0x9", - "has_report": false, - "is_sink": false, + { "state_id": 7, - "program_points": [], + "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 1, + "has_report": 0, "is_sink": 0 + } + ], "program_state": { "store": null, "constraints": null, diff --git a/test/Analysis/exploded-graph-rewriter/node_labels.dot b/test/Analysis/exploded-graph-rewriter/node_labels.dot index a434cd2307..a3d7420fed 100644 --- a/test/Analysis/exploded-graph-rewriter/node_labels.dot +++ b/test/Analysis/exploded-graph-rewriter/node_labels.dot @@ -15,30 +15,47 @@ // CHECK-SAME: <tr> // LIGHT-SAME: <td bgcolor="gray70"> // DARK-SAME: <td bgcolor="gray20"> -// CHECK-SAME: <b>Node 1 (0x1) - State Unspecified</b> +// CHECK-SAME: <b>State Unspecified</b> // CHECK-SAME: </td> // CHECK-SAME: </tr> Node0x1 [shape=record,label= "{ { "node_id": 1, "pointer": "0x1", "has_report": false, "is_sink": false, "program_state": null, - "program_points": [] + "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 1, + "has_report": 0, "is_sink": 0 + } + ] } \l}"]; // CHECK: Node0x2 [ -// CHECK-SAME: <tr><td> -// COLOR-SAME: <font color="red"><b>Bug Report Attached</b></font> -// GRAY-SAME: <b>Bug Report Attached</b> -// CHECK-SAME: </td></tr> -// CHECK-SAME: <tr><td> -// COLOR-SAME: <font color="cornflowerblue"><b>Sink Node</b></font> -// GRAY-SAME: <b>Sink Node</b> -// CHECK-SAME: </td></tr> +// CHECK-SAME: <tr> +// CHECK-SAME: <td colspan="3" align="left"> +// COLOR-SAME: <font color="red"><b>Bug Report Attached</b></font> +// GRAY-SAME: <b>Bug Report Attached</b> +// CHECK-SAME: </td> +// CHECK-SAME: </tr> +// CHECK-SAME: <tr> +// CHECK-SAME: <td colspan="3" align="left"> +// COLOR-SAME: <font color="cornflowerblue"><b>Sink Node</b></font> +// GRAY-SAME: <b>Sink Node</b> +// CHECK-SAME: </td> +// CHECK-SAME: </tr> Node0x2 [shape=record,label= "{ - { "node_id": 2, "pointer": "0x2", "has_report": true, "is_sink": true, - "program_state": null, - "program_points": [] + { "program_state": null, + "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 2, + "has_report": 1, "is_sink": 1 + } + ] } \l}"]; diff --git a/test/Analysis/exploded-graph-rewriter/program_points.dot b/test/Analysis/exploded-graph-rewriter/program_points.dot index c27c230ebf..c9492757c3 100644 --- a/test/Analysis/exploded-graph-rewriter/program_points.dot +++ b/test/Analysis/exploded-graph-rewriter/program_points.dot @@ -28,7 +28,7 @@ // CHECK-SAME: </table> Node0x1 [shape=record,label= "{ - { "node_id": 1, "pointer": "0x1", "has_report": false, "is_sink": false, + { "program_state": null, "program_points": [ { "kind": "Edge", @@ -36,14 +36,20 @@ Node0x1 [shape=record,label= "dst_id": 1, "terminator": null, "term_kind": null, - "tag": null + "tag": null, + "node_id": 1, + "has_report": 0, + "is_sink": 0 }, { "kind": "BlockEntrance", "block_id": 1, "terminator": null, "term_kind": null, - "tag": null + "tag": null, + "node_id": 2, + "has_report": 0, + "is_sink": 0 } ]} \l}"]; @@ -72,10 +78,9 @@ Node0x1 [shape=record,label= // CHECK-SAME: </td> // CHECK-SAME: </tr> // CHECK-SAME: </table> -Node0x2 [shape=record,label= +Node0x3 [shape=record,label= "{ - { "node_id": 2, "pointer": "0x2", "has_report": false, "is_sink": false, - "program_state": null, "program_points": [ + { "program_state": null, "program_points": [ { "kind": "Statement", "stmt_kind": "DeclRefExpr", @@ -88,7 +93,11 @@ Node0x2 [shape=record,label= "line": 4, "column": 5 }, - "tag": "ExprEngine : Clean Node" + "tag": "ExprEngine : Clean Node", + "node_id": 3, + "pointer": "0x3", + "has_report": 0, + "is_sink": 0 } ]} \l}"]; @@ -97,9 +106,9 @@ Node0x2 [shape=record,label= // CHECK-NEXT: <b>Program point:</b> // CHECK-SAME: <td align="left">\{ ... \}</td> -Node0x3 [shape=record,label= +Node0x4 [shape=record,label= "{ - { "node_id": 3, "pointer": "0x3", "has_report": false, "is_sink": false, + { "program_state": null, "program_points": [ { "kind": "Statement", @@ -112,7 +121,10 @@ Node0x3 [shape=record,label= "line": 7, "column": 8 }, - "tag": "ExprEngine : Clean Node" + "tag": "ExprEngine : Clean Node", + "node_id": 4, + "has_report": 0, + "is_sink": 0 } ]} \l}"]; @@ -143,10 +155,9 @@ Node0x3 [shape=record,label= // CHECK-SAME: </td> // CHECK-SAME: </tr> // CHECK-SAME: </table> -Node0x4 [shape=record,label= +Node0x5 [shape=record,label= "{ - { "node_id": 4, "pointer": "0x4", "has_report": false, "is_sink": false, - "program_state": null, "program_points": [ + { "program_state": null, "program_points": [ { "kind": "Statement", "stmt_kind": "ImplicitCastExpr", @@ -160,7 +171,10 @@ Node0x4 [shape=record,label= "line": 8, "column": 9 }, - "tag": "ExprEngine : Clean Node" + "tag": "ExprEngine : Clean Node", + "node_id": 5, + "has_report": 0, + "is_sink": 0 } ]} \l}"]; diff --git a/test/Analysis/exploded-graph-rewriter/store.dot b/test/Analysis/exploded-graph-rewriter/store.dot index 7267dd43e8..c92901cbd7 100644 --- a/test/Analysis/exploded-graph-rewriter/store.dot +++ b/test/Analysis/exploded-graph-rewriter/store.dot @@ -23,12 +23,15 @@ // CHECK-SAME: </table> Node0x1 [shape=record,label= "{ - { "node_id": 1, - "pointer": "0x1", - "has_report": false, - "is_sink": false, - "state_id": 2, - "program_points": [], + { "state_id": 2, + "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 1, + "has_report": 0, "is_sink": 0 + } + ], "program_state": { "environment": null, "constraints": null, diff --git a/test/Analysis/exploded-graph-rewriter/store_diff.dot b/test/Analysis/exploded-graph-rewriter/store_diff.dot index 94d1d8d9f1..8dd5fb44cd 100644 --- a/test/Analysis/exploded-graph-rewriter/store_diff.dot +++ b/test/Analysis/exploded-graph-rewriter/store_diff.dot @@ -10,7 +10,14 @@ Node0x1 [shape=record,label= "has_report": false, "is_sink": false, "state_id": 2, - "program_points": [], + "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 1, + "has_report": 0, "is_sink": 0 + } + ], "program_state": { "environment": null, "constraints": null, @@ -55,12 +62,16 @@ Node0x1 -> Node0x4; // CHECK-SAME: </tr> Node0x4 [shape=record,label= "{ - { "node_id": 4, - "pointer": "0x4", - "has_report": false, - "is_sink": false, + { "state_id": 5, - "program_points": [], + "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 1, + "has_report": 0, "is_sink": 0 + } + ], "program_state": { "environment": null, "constraints": null, @@ -91,12 +102,16 @@ Node0x4 -> Node0x6; Node0x6 [shape=record,label= "{ - { "node_id": 6, - "pointer": "0x6", - "has_report": false, - "is_sink": false, + { "state_id": 7, - "program_points": [], + "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 1, + "has_report": 0, "is_sink": 0 + } + ], "program_state": null } \l}"]; diff --git a/test/Analysis/exploded-graph-rewriter/topology.dot b/test/Analysis/exploded-graph-rewriter/topology.dot index fa1b10f68b..b85115ebea 100644 --- a/test/Analysis/exploded-graph-rewriter/topology.dot +++ b/test/Analysis/exploded-graph-rewriter/topology.dot @@ -12,12 +12,16 @@ // TOPOLOGY-NOT: Checker State Node0x1 [shape=record,label= "{ - { "node_id": 1, - "pointer": "0x1", - "has_report": false, - "is_sink": false, + { "state_id": 2, - "program_points": [], + "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 1, + "has_report": 0, "is_sink": 0 + } + ], "program_state": { "environment": null, "constraints": null, diff --git a/test/Analysis/exploded-graph-rewriter/trimmers.dot b/test/Analysis/exploded-graph-rewriter/trimmers.dot index 8bdef649e0..2c441e02c7 100644 --- a/test/Analysis/exploded-graph-rewriter/trimmers.dot +++ b/test/Analysis/exploded-graph-rewriter/trimmers.dot @@ -17,20 +17,44 @@ // UNSUPPORTED: system-windows Node0x1 [shape=record,label= - "{{ "node_id": 1, "pointer": "0x1", "has_report": false, "is_sink": false, - "program_state": null, "program_points": []}\l}"]; + "{{ "program_state": null, "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 1, + "has_report": 0, "is_sink": 0 + } + ]}\l}"]; Node0x2 [shape=record,label= - "{{ "node_id": 2, "pointer": "0x2", "has_report": false, "is_sink": false, - "program_state": null, "program_points": []}\l}"]; + "{{ "program_state": null, "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 2, + "has_report": 0, "is_sink": 0 + } + ]}\l}"]; Node0x3 [shape=record,label= - "{{ "node_id": 3, "pointer": "0x3", "has_report": false, "is_sink": false, - "program_state": null, "program_points": []}\l}"]; + "{{ "program_state": null, "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 3, + "has_report": 0, "is_sink": 0 + } + ]}\l}"]; Node0x4 [shape=record,label= - "{{ "node_id": 4, "pointer": "0x4", "has_report": false, "is_sink": false, - "program_state": null, "program_points": []}\l}"]; + "{{ "program_state": null, "program_points": [ + { + "kind": "BlockEntrance", "block_id": 1, + "terminator": null, "term_kind": null, + "tag": null, "node_id": 4, + "has_report": 0, "is_sink": 0 + } + ]}\l}"]; Node0x1 -> Node0x2; Node0x1 -> Node0x3; |