r375279 - [analyzer] exploded-graph-rewriter: Fix dump for state 0.

Artem Dergachev via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 18 13:15:33 PDT 2019


Author: dergachev
Date: Fri Oct 18 13:15:32 2019
New Revision: 375279

URL: http://llvm.org/viewvc/llvm-project?rev=375279&view=rev
Log:
[analyzer] exploded-graph-rewriter: Fix dump for state 0.

It shouldn't say "unspecified" when the state is specified to be empty.

Modified:
    cfe/trunk/test/Analysis/exploded-graph-rewriter/edge.dot
    cfe/trunk/test/Analysis/exploded-graph-rewriter/node_labels.dot
    cfe/trunk/test/Analysis/exploded-graph-rewriter/program_points.dot
    cfe/trunk/test/Analysis/exploded-graph-rewriter/trimmers.dot
    cfe/trunk/utils/analyzer/exploded-graph-rewriter.py

Modified: cfe/trunk/test/Analysis/exploded-graph-rewriter/edge.dot
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/exploded-graph-rewriter/edge.dot?rev=375279&r1=375278&r2=375279&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/exploded-graph-rewriter/edge.dot (original)
+++ cfe/trunk/test/Analysis/exploded-graph-rewriter/edge.dot Fri Oct 18 13:15:32 2019
@@ -5,7 +5,7 @@
 // UNSUPPORTED: system-windows
 
 Node0x1 [shape=record,label=
- "{{ "program_state": null, "program_points": [
+ "{{ "state_id": 0, "program_state": null, "program_points": [
     {
       "kind": "BlockEntrance", "block_id": 1,
       "terminator": null, "term_kind": null,
@@ -19,7 +19,7 @@ Node0x1 [shape=record,label=
 Node0x1 -> Node0x2;
 
 Node0x2 [shape=record,label=
- "{{ "program_state": null, "program_points": [
+ "{{ "state_id": 0, "program_state": null, "program_points": [
     {
       "kind": "BlockEntrance", "block_id": 1,
       "terminator": null, "term_kind": null,

Modified: cfe/trunk/test/Analysis/exploded-graph-rewriter/node_labels.dot
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/exploded-graph-rewriter/node_labels.dot?rev=375279&r1=375278&r2=375279&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/exploded-graph-rewriter/node_labels.dot (original)
+++ cfe/trunk/test/Analysis/exploded-graph-rewriter/node_labels.dot Fri Oct 18 13:15:32 2019
@@ -15,13 +15,12 @@
 // CHECK-SAME:   <tr>
 // LIGHT-SAME:     <td bgcolor="gray70">
 // DARK-SAME:      <td bgcolor="gray20">
-// CHECK-SAME:       <b>State Unspecified</b>
+// CHECK-SAME:       <b>State 0</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,
+    { "state_id": 0, "program_state": null,
       "program_points": [
         {
           "kind": "BlockEntrance", "block_id": 1,
@@ -48,7 +47,7 @@ Node0x1 [shape=record,label=
 // CHECK-SAME: </tr>
 Node0x2 [shape=record,label=
  "{
-    { "program_state": null,
+    { "state_id": 0, "program_state": null,
       "program_points": [
         {
           "kind": "BlockEntrance", "block_id": 1,

Modified: cfe/trunk/test/Analysis/exploded-graph-rewriter/program_points.dot
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/exploded-graph-rewriter/program_points.dot?rev=375279&r1=375278&r2=375279&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/exploded-graph-rewriter/program_points.dot (original)
+++ cfe/trunk/test/Analysis/exploded-graph-rewriter/program_points.dot Fri Oct 18 13:15:32 2019
@@ -29,7 +29,7 @@
 Node0x1 [shape=record,label=
  "{
     {
-      "program_state": null, "program_points": [
+      "state_id": 0, "program_state": null, "program_points": [
       {
         "kind": "Edge",
         "src_id": 0,
@@ -80,7 +80,7 @@ Node0x1 [shape=record,label=
 // CHECK-SAME: </table>
 Node0x3 [shape=record,label=
  "{
-    { "program_state": null, "program_points": [
+    { "state_id": 0, "program_state": null, "program_points": [
       {
         "kind": "Statement",
         "stmt_kind": "DeclRefExpr",
@@ -109,7 +109,7 @@ Node0x3 [shape=record,label=
 Node0x4 [shape=record,label=
  "{
     {
-      "program_state": null, "program_points": [
+      "state_id": 0, "program_state": null, "program_points": [
       {
         "kind": "Statement",
         "stmt_kind": "CompoundStmt",
@@ -157,7 +157,7 @@ Node0x4 [shape=record,label=
 // CHECK-SAME: </table>
 Node0x5 [shape=record,label=
  "{
-    { "program_state": null, "program_points": [
+    { "state_id": 0, "program_state": null, "program_points": [
       {
         "kind": "Statement",
         "stmt_kind": "ImplicitCastExpr",

Modified: cfe/trunk/test/Analysis/exploded-graph-rewriter/trimmers.dot
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/exploded-graph-rewriter/trimmers.dot?rev=375279&r1=375278&r2=375279&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/exploded-graph-rewriter/trimmers.dot (original)
+++ cfe/trunk/test/Analysis/exploded-graph-rewriter/trimmers.dot Fri Oct 18 13:15:32 2019
@@ -17,7 +17,7 @@
 // UNSUPPORTED: system-windows
 
 Node0x1 [shape=record,label=
- "{{ "program_state": null, "program_points": [
+ "{{ "state_id": 0, "program_state": null, "program_points": [
        {
          "kind": "BlockEntrance", "block_id": 1,
          "terminator": null, "term_kind": null,
@@ -27,7 +27,7 @@ Node0x1 [shape=record,label=
      ]}\l}"];
 
 Node0x2 [shape=record,label=
- "{{ "program_state": null, "program_points": [
+ "{{ "state_id": 0, "program_state": null, "program_points": [
        {
          "kind": "BlockEntrance", "block_id": 1,
          "terminator": null, "term_kind": null,
@@ -37,7 +37,7 @@ Node0x2 [shape=record,label=
      ]}\l}"];
 
 Node0x3 [shape=record,label=
- "{{ "program_state": null, "program_points": [
+ "{{ "state_id": 0, "program_state": null, "program_points": [
        {
          "kind": "BlockEntrance", "block_id": 1,
          "terminator": null, "term_kind": null,
@@ -47,7 +47,7 @@ Node0x3 [shape=record,label=
      ]}\l}"];
 
 Node0x4 [shape=record,label=
- "{{ "program_state": null, "program_points": [
+ "{{ "state_id": 0, "program_state": null, "program_points": [
        {
          "kind": "BlockEntrance", "block_id": 1,
          "terminator": null, "term_kind": null,

Modified: cfe/trunk/utils/analyzer/exploded-graph-rewriter.py
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/analyzer/exploded-graph-rewriter.py?rev=375279&r1=375278&r2=375279&view=diff
==============================================================================
--- cfe/trunk/utils/analyzer/exploded-graph-rewriter.py (original)
+++ cfe/trunk/utils/analyzer/exploded-graph-rewriter.py Fri Oct 18 13:15:32 2019
@@ -273,6 +273,16 @@ class ProgramState(object):
         super(ProgramState, self).__init__()
         logging.debug('Adding ProgramState ' + str(state_id))
 
+        if json_ps is None:
+            json_ps = {
+                'store': None,
+                'environment': None,
+                'constraints': None,
+                'dynamic_types': None,
+                'constructing_objects': None,
+                'checker_messages': None
+            }
+
         self.state_id = state_id
 
         self.store = Store(json_ps['store']) \
@@ -316,8 +326,8 @@ class ExplodedNode(object):
         self.points = [ProgramPoint(p) for p in json_node['program_points']]
         self.node_id = self.points[-1].node_id
         self.state = ProgramState(json_node['state_id'],
-                                  json_node['program_state']) \
-            if json_node['program_state'] is not None else None
+                                  json_node['program_state']
+            if json_node['program_state'] is not None else None);
 
         assert self.node_name() == node_id
 




More information about the cfe-commits mailing list