This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Make debug_tree() print the length of a TREE_VEC
- From: Patrick Palka <patrick at parcs dot ath dot cx>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Patrick Palka <patrick at parcs dot ath dot cx>
- Date: Thu, 25 Jun 2015 12:22:30 -0400
- Subject: [PATCH] Make debug_tree() print the length of a TREE_VEC
- Authentication-results: sourceware.org; auth=none
When printing a TREE_VEC, this patch makes its length get printed
alongside its prefix, e.g.
<tree_vec 0x7ffff6a4d0a0 length 2
elt 0 ....>
Without a reference to its length, an all-NULL TREE_VEC otherwise looks like
an empty TREE_VEC, since NULL elts don't get printed. This makes
debugging such TREE_VECs pretty confusing.
Is this OK to commit?
gcc/ChangeLog:
* print-tree.c (print_node) [TREE_VEC]: Print its length.
---
gcc/print-tree.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/gcc/print-tree.c b/gcc/print-tree.c
index 94b4d7d..fe6b769 100644
--- a/gcc/print-tree.c
+++ b/gcc/print-tree.c
@@ -809,6 +809,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent)
case TREE_VEC:
len = TREE_VEC_LENGTH (node);
+ fprintf (file, " length %d", len);
for (i = 0; i < len; i++)
if (TREE_VEC_ELT (node, i))
{
--
2.4.4.410.g43ed522.dirty