Index: clang/test/Analysis/exploded-graph-rewriter/edge.dot
===================================================================
--- clang/test/Analysis/exploded-graph-rewriter/edge.dot
+++ clang/test/Analysis/exploded-graph-rewriter/edge.dot
@@ -1,4 +1,5 @@
-// RUN: %exploded_graph_rewriter %s | FileCheck %s
+// RUN: %exploded_graph_rewriter %s | FileCheck %s -check-prefix=LIGHT
+// RUN: %exploded_graph_rewriter --dark %s | FileCheck %s -check-prefixes=DARK
// FIXME: Substitution doesn't seem to work on Windows.
// UNSUPPORTED: system-windows
@@ -7,7 +8,8 @@
"{{ "node_id": 1, "pointer": "0x1",
"program_state": null, "program_points": []}\l}"];
-// CHECK: Node0x1 -> Node0x2;
+// LIGHT: Node0x1 -> Node0x2;
+// DARK: Node0x1 -> Node0x2 [color="white"];
Node0x1 -> Node0x2;
Node0x2 [shape=record,label=
Index: clang/test/Analysis/exploded-graph-rewriter/empty.dot
===================================================================
--- clang/test/Analysis/exploded-graph-rewriter/empty.dot
+++ clang/test/Analysis/exploded-graph-rewriter/empty.dot
@@ -1,4 +1,6 @@
// RUN: %exploded_graph_rewriter %s | FileCheck %s
+// RUN: %exploded_graph_rewriter --dark %s | FileCheck %s \
+// RUN: -check-prefixes=CHECK,DARK
// FIXME: Substitution doesn't seem to work on Windows.
// UNSUPPORTED: system-windows
@@ -8,5 +10,6 @@
}
// CHECK: digraph "ExplodedGraph" {
+// DARK-NEXT: bgcolor="black";
// CHECK-NEXT: label="";
// CHECK-NEXT: }
Index: clang/test/Analysis/exploded-graph-rewriter/environment.dot
===================================================================
--- clang/test/Analysis/exploded-graph-rewriter/environment.dot
+++ clang/test/Analysis/exploded-graph-rewriter/environment.dot
@@ -10,7 +10,7 @@
// CHECK-SAME: #0 Call
// CHECK-SAME:
// CHECK-SAME:
-// CHECK-SAME: foo (line 4)
+// CHECK-SAME: foo (line 4)
// CHECK-SAME: |
// CHECK-SAME:
// CHECK-SAME:
Index: clang/test/Analysis/exploded-graph-rewriter/node_labels.dot
===================================================================
--- /dev/null
+++ clang/test/Analysis/exploded-graph-rewriter/node_labels.dot
@@ -0,0 +1,22 @@
+// RUN: %exploded_graph_rewriter %s | FileCheck %s -check-prefixes=CHECK,LIGHT
+// RUN: %exploded_graph_rewriter %s --dark | FileCheck %s \
+// RUN: -check-prefixes CHECK,DARK
+
+// FIXME: Substitution doesn't seem to work on Windows.
+// UNSUPPORTED: system-windows
+
+// LIGHT: Node0x1 [shape=record,label=<
+// DARK: Node0x1 [shape=record,color="white",fontcolor="gray80",label=<
+// CHECK-SAME:
+// LIGHT-SAME:
+// DARK-SAME: |
+// CHECK-SAME: Node 1 (0x1) - State Unspecified
+// CHECK-SAME: |
+// CHECK-SAME:
+Node0x1 [shape=record,label=
+ "{
+ { "node_id": 1, "pointer": "0x1",
+ "program_state": null,
+ "program_points": []
+ }
+\l}"];
Index: clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp
===================================================================
--- clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp
+++ clang/test/Analysis/exploded-graph-rewriter/objects_under_construction.cpp
@@ -17,7 +17,7 @@
// CHECK-SAME:
// CHECK-SAME: #0 Call |
// CHECK-SAME:
- // CHECK-SAME: test
+ // CHECK-SAME: test
// CHECK-SAME: |
// CHECK-SAME:
// CHECK-SAME:
Index: clang/utils/analyzer/exploded-graph-rewriter.py
===================================================================
--- clang/utils/analyzer/exploded-graph-rewriter.py
+++ clang/utils/analyzer/exploded-graph-rewriter.py
@@ -334,9 +334,10 @@
# A visitor that dumps the ExplodedGraph into a DOT file with fancy HTML-based
# syntax highlighing.
class DotDumpVisitor(object):
- def __init__(self, do_diffs):
+ def __init__(self, do_diffs, dark_mode):
super(DotDumpVisitor, self).__init__()
self._do_diffs = do_diffs
+ self._dark_mode = dark_mode
@staticmethod
def _dump_raw(s):
@@ -363,6 +364,8 @@
def visit_begin_graph(self, graph):
self._graph = graph
self._dump_raw('digraph "ExplodedGraph" {\n')
+ if self._dark_mode:
+ self._dump_raw('bgcolor="black";\n')
self._dump_raw('label="";\n')
def visit_program_point(self, p):
@@ -372,7 +375,7 @@
'PostStmtPurgeDeadSymbols']:
color = 'red'
elif p.kind in ['CallEnter', 'CallExitBegin', 'CallExitEnd']:
- color = 'blue'
+ color = 'dodgerblue' if self._dark_mode else 'blue'
elif p.kind in ['Statement']:
color = 'cyan4'
else:
@@ -436,7 +439,7 @@
self._dump('
%s | '
'%s | '
''
- '%s '
+ '%s '
'%s |
'
% (self._diff_plus_minus(is_added),
lc.caption, lc.decl,
@@ -451,9 +454,11 @@
'%s | '
% (self._diff_plus_minus(is_added),
b.stmt_id,
- ''
- '(%s) | ' % b.kind
- if b.kind is not None else '',
+ ''
+ '%s | ' % (
+ 'lavender' if self._dark_mode else 'darkgreen',
+ ('(%s)' % b.kind) if b.kind is not None else ' '
+ ),
b.pretty, f.bindings[b]))
frames_updated = e.diff_frames(prev_e) if prev_e is not None else None
@@ -615,12 +620,16 @@
s, prev_s)
def visit_node(self, node):
- self._dump('%s [shape=record,label=<'
+ self._dump('%s [shape=record,'
% (node.node_name()))
+ if self._dark_mode:
+ self._dump('color="white",fontcolor="gray80",')
+ self._dump('label=<')
- self._dump('Node %d (%s) - '
+ self._dump('Node %d (%s) - '
'State %s | '
- % (node.node_id, node.ptr, node.state.state_id
+ % ("gray20" if self._dark_mode else "gray",
+ node.node_id, node.ptr, node.state.state_id
if node.state is not None else 'Unspecified'))
self._dump('')
if len(node.points) > 1:
@@ -645,7 +654,10 @@
self._dump_raw(' | |
>];\n')
def visit_edge(self, pred, succ):
- self._dump_raw('%s -> %s;\n' % (pred.node_name(), succ.node_name()))
+ self._dump_raw('%s -> %s%s;\n' % (
+ pred.node_name(), succ.node_name(),
+ ' [color="white"]' if self._dark_mode else ''
+ ))
def visit_end_of_graph(self):
self._dump_raw('}\n')
@@ -678,6 +690,9 @@
parser.add_argument('-d', '--diff', action='store_const', dest='diff',
const=True, default=False,
help='display differences between states')
+ parser.add_argument('--dark', action='store_const', dest='dark',
+ const=True, default=False,
+ help='dark mode')
args = parser.parse_args()
logging.basicConfig(level=args.loglevel)
@@ -688,7 +703,7 @@
graph.add_raw_line(raw_line)
explorer = Explorer()
- visitor = DotDumpVisitor(args.diff)
+ visitor = DotDumpVisitor(args.diff, args.dark)
explorer.explore(graph, visitor)