[PATCH] D62638: [analyzer][WIP] A Python script to prettify the ExplodedGraph dumps.

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 29 18:21:50 PDT 2019


NoQ created this revision.
NoQ added reviewers: dcoughlin, xazax.hun, a_sidorin, rnkovacs, Szelethus, baloghadamsoftware, Charusso, george.karpenkov.
Herald added subscribers: cfe-commits, dkrupp, donat.nagy, mikhail.ramalho, a.sidorin, szepet.
Herald added a project: clang.

That's my attempt on D62553 <https://reviews.llvm.org/D62553> that i (just) promised.

Here's roughly how it looks:

F8965939: Screen Shot 2019-05-29 at 6.12.07 PM.png <https://reviews.llvm.org/F8965939>

Full dump of some random test file:

F8965929: graph.svg <https://reviews.llvm.org/F8965929>

The rough idea behind this script is that it deserializes JSON dumps into familiar python objects. Serializing them back into a pretty graph dump is only one of the possible use-cases; we can manipulate the deserialized graph by, say, hiding nodes that we aren't interested in.

This initial commit only supports Environment and Store and silently drops unsupported information; i'll hopefully follow up with more this week, most importantly ranges. As of today it's only a dot-to-dot converter, so @Charusso's SVG cleanup is not supported yet. Diffs are not supported yet; tomorrow i'll think a bit more how exactly do i want to implement them.

I wrote some tests but i'm not really sure they're worth it. I guess some corner-cases would be nice to document this way.

@Charusso, could you see if you can:

- Bring back stable IDs for nodes into JSON (not only pointers). They're very useful for debugging.
- See if your trick for reducing SVG size with text joining is even applicable to the dumps that i produce.
- Understand my code here :)


Repository:
  rC Clang

https://reviews.llvm.org/D62638

Files:
  clang/test/Analysis/exploded-graph-rewriter/edge.dot
  clang/test/Analysis/exploded-graph-rewriter/empty.dot
  clang/test/Analysis/exploded-graph-rewriter/environment.dot
  clang/test/Analysis/exploded-graph-rewriter/lit.local.cfg
  clang/test/Analysis/exploded-graph-rewriter/program_points.dot
  clang/test/Analysis/exploded-graph-rewriter/store.dot
  clang/utils/analyzer/exploded-graph-rewriter.py

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62638.202086.patch
Type: text/x-patch
Size: 20917 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190530/d0a73d0a/attachment-0001.bin>


More information about the cfe-commits mailing list