[PATCH] D63684: [analyzer] exploded-graph-rewriter: NFC: Extract some code into functions.
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 21 20:15:13 PDT 2019
NoQ created this revision.
NoQ added a reviewer: Charusso.
Herald added subscribers: cfe-commits, dkrupp, donat.nagy, Szelethus, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun.
Herald added a project: clang.
Even though this code is not duplicated yet, follow-up patches will demonstrate that it's a nicer way to structure this code.
Repository:
rC Clang
https://reviews.llvm.org/D63684
Files:
clang/utils/analyzer/exploded-graph-rewriter.py
Index: clang/utils/analyzer/exploded-graph-rewriter.py
===================================================================
--- clang/utils/analyzer/exploded-graph-rewriter.py
+++ clang/utils/analyzer/exploded-graph-rewriter.py
@@ -410,6 +410,24 @@
self._dump('</table>')
+ def visit_environment_in_state(self, s, prev_s=None):
+ self._dump('<tr><td align="left">'
+ '<b>Environment: </b>')
+ if s.environment is None:
+ self._dump('<i> Nothing!</i>')
+ else:
+ if prev_s is not None and prev_s.environment is not None:
+ if s.environment.is_different(prev_s.environment):
+ self._dump('</td></tr><tr><td align="left">')
+ self.visit_environment(s.environment, prev_s.environment)
+ else:
+ self._dump('<i> No changes!</i>')
+ else:
+ self._dump('</td></tr><tr><td align="left">')
+ self.visit_environment(s.environment)
+
+ self._dump('</td></tr>')
+
def visit_store(self, s, prev_s=None):
self._dump('<table border="0">')
@@ -448,8 +466,7 @@
self._dump('</table>')
- def visit_state(self, s, prev_s):
- # == Store ==
+ def visit_store_in_state(self, s, prev_s=None):
self._dump('<tr><td align="left"><b>Store: </b>')
if s.store is None:
self._dump('<i> Nothing!</i>')
@@ -465,23 +482,9 @@
self.visit_store(s.store)
self._dump('</td></tr><hr />')
- # == Environment ==
- self._dump('<tr><td align="left">'
- '<b>Environment: </b>')
- if s.environment is None:
- self._dump('<i> Nothing!</i>')
- else:
- if prev_s is not None and prev_s.environment is not None:
- if s.environment.is_different(prev_s.environment):
- self._dump('</td></tr><tr><td align="left">')
- self.visit_environment(s.environment, prev_s.environment)
- else:
- self._dump('<i> No changes!</i>')
- else:
- self._dump('</td></tr><tr><td align="left">')
- self.visit_environment(s.environment)
-
- self._dump('</td></tr>')
+ def visit_state(self, s, prev_s):
+ self.visit_store_in_state(s, prev_s)
+ self.visit_environment_in_state(s, prev_s)
def visit_node(self, node):
self._dump('%s [shape=record,label=<<table border="0">'
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63684.206112.patch
Type: text/x-patch
Size: 2544 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190622/df197123/attachment.bin>
More information about the cfe-commits
mailing list