[qfcc] Avoid (null) labels for dot graphs

I got tired of seeing it when looking at debug dumps of expressions.
This commit is contained in:
Bill Currie 2024-10-01 14:25:55 +09:00
parent fc4e8cb350
commit 491b612888
5 changed files with 10 additions and 5 deletions

View file

@ -195,7 +195,8 @@ dot_dump_dag (void *_dag, const char *filename)
dstring_t *dstr = dstring_newstr();
dasprintf (dstr, "digraph dag_%p {\n", dag);
dasprintf (dstr, " graph [label=\"%s\"];\n", quote_string (filename));
dasprintf (dstr, " graph [label=\"%s\"];\n",
filename ? quote_string (filename) : "");
dasprintf (dstr, " layout=dot;\n");
dasprintf (dstr, " clusterrank=local;\n");
dasprintf (dstr, " rankdir=TB;\n");

View file

@ -829,7 +829,8 @@ dump_dot_expr (const void *_e, const char *filename)
const expr_t *e = _e;
dasprintf (dstr, "digraph expr_%p {\n", e);
dasprintf (dstr, " graph [label=\"%s\"];\n", quote_string (filename));
dasprintf (dstr, " graph [label=\"%s\"];\n",
filename ? quote_string (filename) : "");
dasprintf (dstr, " layout=dot; rankdir=TB; compound=true;\n");
_print_expr (dstr, e, 0, ++id, nullptr);
dasprintf (dstr, "}\n");

View file

@ -376,7 +376,8 @@ print_flowgraph (flow_dot_t *method, flowgraph_t *graph, const char *filename)
dstring_t *dstr = dstring_newstr();
dasprintf (dstr, "digraph flowgraph_%s_%p {\n", method->type, graph);
dasprintf (dstr, " graph [label=\"%s\"];\n", quote_string (filename));
dasprintf (dstr, " graph [label=\"%s\"];\n",
filename ? quote_string (filename) : "");
dasprintf (dstr, " layout=dot;\n");
dasprintf (dstr, " clusterrank=local;\n");
dasprintf (dstr, " rankdir=TB;\n");

View file

@ -161,7 +161,8 @@ print_sblock (sblock_t *sblock, const char *filename)
dstring_t *dstr = dstring_newstr();
dasprintf (dstr, "digraph sblock_%p {\n", sblock);
dasprintf (dstr, " graph [label=\"%s\"];\n", quote_string (filename));
dasprintf (dstr, " graph [label=\"%s\"];\n",
filename ? quote_string (filename) : "");
dasprintf (dstr, " layout=dot; rankdir=TB;\n");
for (i = 0; sblock; sblock = sblock->next, i++)
flow_sblock (dstr, sblock, i);

View file

@ -265,7 +265,8 @@ dump_dot_type (void *_t, const char *filename)
const type_t *t = _t;
dasprintf (dstr, "digraph type_%p {\n", t);
dasprintf (dstr, " graph [label=\"%s\"];\n", quote_string (filename));
dasprintf (dstr, " graph [label=\"%s\"];\n",
filename ? quote_string (filename) : "");
dasprintf (dstr, " layout=dot; rankdir=TB; compound=true;\n");
dot_print_type (dstr, t, 0, seen);
dasprintf (dstr, "}\n");