mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-02-17 01:11:45 +00:00
Avoid double-printing dag nodes.
This commit is contained in:
parent
7b2e426545
commit
d9354255a3
2 changed files with 7 additions and 0 deletions
|
@ -45,6 +45,7 @@ typedef struct daglabel_s {
|
|||
|
||||
typedef struct dagnode_s {
|
||||
struct dagnode_s *next;
|
||||
int print_count; ///< used to avoid double printing nodes
|
||||
daglabel_t *label; ///< ident/const if leaf node, or operator
|
||||
/// \name child nodes
|
||||
/// All three child nodes will be null if this node is a leaf
|
||||
|
|
|
@ -48,9 +48,14 @@
|
|||
#include "symtab.h"
|
||||
#include "type.h"
|
||||
|
||||
static int print_count;
|
||||
|
||||
static void
|
||||
print_node (dstring_t *dstr, dagnode_t *node)
|
||||
{
|
||||
if (node->print_count == print_count)
|
||||
return;
|
||||
node->print_count = print_count;
|
||||
if (!node->a && (node->b || node->c)) {
|
||||
dasprintf (dstr, " \"dag_%p\" [label=\"bad node\"];\n", node);
|
||||
return;
|
||||
|
@ -94,6 +99,7 @@ print_dag (dagnode_t *dag, const char *filename)
|
|||
{
|
||||
dstring_t *dstr = dstring_newstr();
|
||||
|
||||
print_count++;
|
||||
dasprintf (dstr, "digraph dag_%p {\n", dag);
|
||||
dasprintf (dstr, " layout=dot; rankdir=TB;\n");
|
||||
print_node (dstr, dag);
|
||||
|
|
Loading…
Reference in a new issue