diff options
author | Artem Dergachev <artem.dergachev@gmail.com> | 2019-07-02 02:17:53 +0000 |
---|---|---|
committer | Artem Dergachev <artem.dergachev@gmail.com> | 2019-07-02 02:17:53 +0000 |
commit | 2ca5355712fc6b7ad95f8ce9b8e2054b621cda9b (patch) | |
tree | 9616991ab03f0445de01975242c19df924179d1e /clang/utils/analyzer/exploded-graph-rewriter.py | |
parent | 0a77d9192ab75b8fcf218747d6bcd213dce1f4ce (diff) | |
download | bcm5719-llvm-2ca5355712fc6b7ad95f8ce9b8e2054b621cda9b.tar.gz bcm5719-llvm-2ca5355712fc6b7ad95f8ce9b8e2054b621cda9b.zip |
[analyzer] exploded-graph-rewriter: Improve program point dumps.
- Take advantage of the stmt_point_kind.
- Dump block IDs for BlockEntrance nodes.
- Don't dump huge compound statements on PurgeDeadSymbols nodes.
- Rename Edge to BlockEdge for consistency.
- Tweak colors.
Differential Revision: https://reviews.llvm.org/D64051
llvm-svn: 364881
Diffstat (limited to 'clang/utils/analyzer/exploded-graph-rewriter.py')
-rwxr-xr-x | clang/utils/analyzer/exploded-graph-rewriter.py | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/clang/utils/analyzer/exploded-graph-rewriter.py b/clang/utils/analyzer/exploded-graph-rewriter.py index 7278c708036..c5b95071233 100755 --- a/clang/utils/analyzer/exploded-graph-rewriter.py +++ b/clang/utils/analyzer/exploded-graph-rewriter.py @@ -59,6 +59,7 @@ class ProgramPoint(object): self.dst_id = json_pp['dst_id'] elif self.kind == 'Statement': self.stmt_kind = json_pp['stmt_kind'] + self.stmt_point_kind = json_pp['stmt_point_kind'] self.pointer = json_pp['pointer'] self.pretty = json_pp['pretty'] self.loc = SourceLocation(json_pp['location']) \ @@ -373,30 +374,48 @@ class DotDumpVisitor(object): elif p.kind in ['CallEnter', 'CallExitBegin', 'CallExitEnd']: color = 'blue' elif p.kind in ['Statement']: - color = 'cyan3' + color = 'cyan4' else: color = 'forestgreen' if p.kind == 'Statement': + # This avoids pretty-printing huge statements such as CompoundStmt. + # Such statements show up only at [Pre|Post]StmtPurgeDeadSymbols + skip_pretty = 'PurgeDeadSymbols' in p.stmt_point_kind + stmt_color = 'cyan3' if p.loc is not None: self._dump('<tr><td align="left" width="0">' '%s:<b>%s</b>:<b>%s</b>:</td>' '<td align="left" width="0"><font color="%s">' - '%s</font></td><td>%s</td></tr>' + '%s</font></td>' + '<td align="left"><font color="%s">%s</font></td>' + '<td>%s</td></tr>' % (p.loc.filename, p.loc.line, - p.loc.col, color, p.stmt_kind, p.pretty)) + p.loc.col, color, p.stmt_kind, + stmt_color, p.stmt_point_kind, + p.pretty if not skip_pretty else '')) else: self._dump('<tr><td align="left" width="0">' '<i>Invalid Source Location</i>:</td>' '<td align="left" width="0">' - '<font color="%s">%s</font></td><td>%s</td></tr>' - % (color, p.stmt_kind, p.pretty)) + '<font color="%s">%s</font></td>' + '<td align="left"><font color="%s">%s</font></td>' + '<td>%s</td></tr>' + % (color, p.stmt_kind, + stmt_color, p.stmt_point_kind, + p.pretty if not skip_pretty else '')) elif p.kind == 'Edge': self._dump('<tr><td width="0"></td>' '<td align="left" width="0">' '<font color="%s">%s</font></td><td align="left">' '[B%d] -\\> [B%d]</td></tr>' - % (color, p.kind, p.src_id, p.dst_id)) + % (color, 'BlockEdge', p.src_id, p.dst_id)) + elif p.kind == 'BlockEntrance': + self._dump('<tr><td width="0"></td>' + '<td align="left" width="0">' + '<font color="%s">%s</font></td>' + '<td align="left">[B%d]</td></tr>' + % (color, p.kind, p.block_id)) else: # TODO: Print more stuff for other kinds of points. self._dump('<tr><td width="0"></td>' @@ -406,7 +425,7 @@ class DotDumpVisitor(object): if p.tag is not None: self._dump('<tr><td width="0"></td>' - '<td colspan="2" align="left">' + '<td colspan="3" align="left">' '<b>Tag: </b> <font color="crimson">' '%s</font></td></tr>' % p.tag) |