Commit 8197ac2f by Martin Sebor Committed by Martin Sebor

print-tree.c (print_node): Print location using the established format %s:%i%i.


gcc/ChangeLog:

	* print-tree.c (print_node): Print location using the established
	format %s:%i%i.
	Replace spaces with colons.
	(debug_raw, debug): Ditto.

From-SVN: r251030
parent 0a8923fa
2017-08-10 Martin Sebor <msebor@redhat.com> 2017-08-10 Martin Sebor <msebor@redhat.com>
* print-tree.c (print_node): Print location using the established
format %s:%i%i.
Replace spaces with colons.
(debug_raw, debug): Ditto.
2017-08-10 Martin Sebor <msebor@redhat.com>
PR c++/81586 PR c++/81586
* pretty-print.c (pp_format): Correct the handling of %s precision. * pretty-print.c (pp_format): Correct the handling of %s precision.
......
...@@ -444,13 +444,13 @@ print_node (FILE *file, const char *prefix, tree node, int indent, ...@@ -444,13 +444,13 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
xloc = expand_location (DECL_SOURCE_LOCATION (node)); xloc = expand_location (DECL_SOURCE_LOCATION (node));
fprintf (file, " file %s line %d col %d", xloc.file, xloc.line, fprintf (file, " %s:%d:%d", xloc.file, xloc.line,
xloc.column); xloc.column);
if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON)) if (CODE_CONTAINS_STRUCT (code, TS_DECL_COMMON))
{ {
print_node (file, "size", DECL_SIZE (node), indent + 4); print_node (file, "size", DECL_SIZE (node), indent + 4);
print_node (file, "unit size", DECL_SIZE_UNIT (node), indent + 4); print_node (file, "unit-size", DECL_SIZE_UNIT (node), indent + 4);
if (code != FUNCTION_DECL || DECL_BUILT_IN (node)) if (code != FUNCTION_DECL || DECL_BUILT_IN (node))
indent_to (file, indent + 3); indent_to (file, indent + 3);
...@@ -458,7 +458,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent, ...@@ -458,7 +458,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
if (DECL_USER_ALIGN (node)) if (DECL_USER_ALIGN (node))
fprintf (file, " user"); fprintf (file, " user");
fprintf (file, " align %d", DECL_ALIGN (node)); fprintf (file, " align:%d", DECL_ALIGN (node));
if (code == FIELD_DECL) if (code == FIELD_DECL)
fprintf (file, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED, fprintf (file, " offset_align " HOST_WIDE_INT_PRINT_UNSIGNED,
DECL_OFFSET_ALIGN (node)); DECL_OFFSET_ALIGN (node));
...@@ -466,9 +466,9 @@ print_node (FILE *file, const char *prefix, tree node, int indent, ...@@ -466,9 +466,9 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
if (code == FUNCTION_DECL && DECL_BUILT_IN (node)) if (code == FUNCTION_DECL && DECL_BUILT_IN (node))
{ {
if (DECL_BUILT_IN_CLASS (node) == BUILT_IN_MD) if (DECL_BUILT_IN_CLASS (node) == BUILT_IN_MD)
fprintf (file, " built-in BUILT_IN_MD %d", DECL_FUNCTION_CODE (node)); fprintf (file, " built-in: BUILT_IN_MD:%d", DECL_FUNCTION_CODE (node));
else else
fprintf (file, " built-in %s:%s", fprintf (file, " built-in: %s:%s",
built_in_class_names[(int) DECL_BUILT_IN_CLASS (node)], built_in_class_names[(int) DECL_BUILT_IN_CLASS (node)],
built_in_names[(int) DECL_FUNCTION_CODE (node)]); built_in_names[(int) DECL_FUNCTION_CODE (node)]);
} }
...@@ -476,7 +476,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent, ...@@ -476,7 +476,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
if (code == FIELD_DECL) if (code == FIELD_DECL)
{ {
print_node (file, "offset", DECL_FIELD_OFFSET (node), indent + 4); print_node (file, "offset", DECL_FIELD_OFFSET (node), indent + 4);
print_node (file, "bit offset", DECL_FIELD_BIT_OFFSET (node), print_node (file, "bit-offset", DECL_FIELD_BIT_OFFSET (node),
indent + 4); indent + 4);
if (DECL_BIT_FIELD_TYPE (node)) if (DECL_BIT_FIELD_TYPE (node))
print_node (file, "bit_field_type", DECL_BIT_FIELD_TYPE (node), print_node (file, "bit_field_type", DECL_BIT_FIELD_TYPE (node),
...@@ -597,27 +597,27 @@ print_node (FILE *file, const char *prefix, tree node, int indent, ...@@ -597,27 +597,27 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
fprintf (file, " %s", GET_MODE_NAME (mode)); fprintf (file, " %s", GET_MODE_NAME (mode));
print_node (file, "size", TYPE_SIZE (node), indent + 4); print_node (file, "size", TYPE_SIZE (node), indent + 4);
print_node (file, "unit size", TYPE_SIZE_UNIT (node), indent + 4); print_node (file, "unit-size", TYPE_SIZE_UNIT (node), indent + 4);
indent_to (file, indent + 3); indent_to (file, indent + 3);
if (TYPE_USER_ALIGN (node)) if (TYPE_USER_ALIGN (node))
fprintf (file, " user"); fprintf (file, " user");
fprintf (file, " align %d symtab %d alias set " HOST_WIDE_INT_PRINT_DEC, fprintf (file, " align:%d symtab:%d alias-set " HOST_WIDE_INT_PRINT_DEC,
TYPE_ALIGN (node), TYPE_SYMTAB_ADDRESS (node), TYPE_ALIGN (node), TYPE_SYMTAB_ADDRESS (node),
(HOST_WIDE_INT) TYPE_ALIAS_SET (node)); (HOST_WIDE_INT) TYPE_ALIAS_SET (node));
if (TYPE_STRUCTURAL_EQUALITY_P (node)) if (TYPE_STRUCTURAL_EQUALITY_P (node))
fprintf (file, " structural equality"); fprintf (file, " structural-equality");
else else
dump_addr (file, " canonical type ", TYPE_CANONICAL (node)); dump_addr (file, " canonical-type ", TYPE_CANONICAL (node));
print_node (file, "attributes", TYPE_ATTRIBUTES (node), indent + 4); print_node (file, "attributes", TYPE_ATTRIBUTES (node), indent + 4);
if (INTEGRAL_TYPE_P (node) || code == REAL_TYPE if (INTEGRAL_TYPE_P (node) || code == REAL_TYPE
|| code == FIXED_POINT_TYPE) || code == FIXED_POINT_TYPE)
{ {
fprintf (file, " precision %d", TYPE_PRECISION (node)); fprintf (file, " precision:%d", TYPE_PRECISION (node));
print_node_brief (file, "min", TYPE_MIN_VALUE (node), indent + 4); print_node_brief (file, "min", TYPE_MIN_VALUE (node), indent + 4);
print_node_brief (file, "max", TYPE_MAX_VALUE (node), indent + 4); print_node_brief (file, "max", TYPE_MAX_VALUE (node), indent + 4);
} }
...@@ -627,7 +627,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent, ...@@ -627,7 +627,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
else if (code == ARRAY_TYPE) else if (code == ARRAY_TYPE)
print_node (file, "domain", TYPE_DOMAIN (node), indent + 4); print_node (file, "domain", TYPE_DOMAIN (node), indent + 4);
else if (code == VECTOR_TYPE) else if (code == VECTOR_TYPE)
fprintf (file, " nunits %d", (int) TYPE_VECTOR_SUBPARTS (node)); fprintf (file, " nunits:%d", (int) TYPE_VECTOR_SUBPARTS (node));
else if (code == RECORD_TYPE else if (code == RECORD_TYPE
|| code == UNION_TYPE || code == UNION_TYPE
|| code == QUAL_UNION_TYPE) || code == QUAL_UNION_TYPE)
...@@ -686,7 +686,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent, ...@@ -686,7 +686,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
/* Buffer big enough to format a 32-bit UINT_MAX into, plus /* Buffer big enough to format a 32-bit UINT_MAX into, plus
the text. */ the text. */
char temp[15]; char temp[15];
sprintf (temp, "arg %u", i); sprintf (temp, "arg:%u", i);
print_node (file, temp, arg, indent + 4); print_node (file, temp, arg, indent + 4);
i++; i++;
} }
...@@ -701,7 +701,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent, ...@@ -701,7 +701,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
the text. */ the text. */
char temp[15]; char temp[15];
sprintf (temp, "arg %d", i); sprintf (temp, "arg:%d", i);
print_node (file, temp, TREE_OPERAND (node, i), indent + 4); print_node (file, temp, TREE_OPERAND (node, i), indent + 4);
} }
} }
...@@ -771,9 +771,9 @@ print_node (FILE *file, const char *prefix, tree node, int indent, ...@@ -771,9 +771,9 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
break; break;
j--; j--;
if (i == j) if (i == j)
sprintf (buf, "elt%u: ", i); sprintf (buf, "elt:%u: ", i);
else else
sprintf (buf, "elt%u...elt%u: ", i, j); sprintf (buf, "elt:%u...%u: ", i, j);
print_node (file, buf, VECTOR_CST_ELT (node, i), indent + 4); print_node (file, buf, VECTOR_CST_ELT (node, i), indent + 4);
i = j; i = j;
} }
...@@ -814,14 +814,14 @@ print_node (FILE *file, const char *prefix, tree node, int indent, ...@@ -814,14 +814,14 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
case TREE_VEC: case TREE_VEC:
len = TREE_VEC_LENGTH (node); len = TREE_VEC_LENGTH (node);
fprintf (file, " length %d", len); fprintf (file, " length:%d", len);
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
if (TREE_VEC_ELT (node, i)) if (TREE_VEC_ELT (node, i))
{ {
/* Buffer big enough to format a 32-bit UINT_MAX into, plus /* Buffer big enough to format a 32-bit UINT_MAX into, plus
the text. */ the text. */
char temp[15]; char temp[15];
sprintf (temp, "elt %d", i); sprintf (temp, "elt:%d", i);
print_node (file, temp, TREE_VEC_ELT (node, i), indent + 4); print_node (file, temp, TREE_VEC_ELT (node, i), indent + 4);
} }
break; break;
...@@ -831,7 +831,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent, ...@@ -831,7 +831,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
unsigned HOST_WIDE_INT cnt; unsigned HOST_WIDE_INT cnt;
tree index, value; tree index, value;
len = CONSTRUCTOR_NELTS (node); len = CONSTRUCTOR_NELTS (node);
fprintf (file, " lngt %d", len); fprintf (file, " length:%d", len);
FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node), FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (node),
cnt, index, value) cnt, index, value)
{ {
...@@ -885,7 +885,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent, ...@@ -885,7 +885,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
} }
indent_to (file, indent + 4); indent_to (file, indent + 4);
fprintf (file, "version %u", SSA_NAME_VERSION (node)); fprintf (file, "version:%u", SSA_NAME_VERSION (node));
if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node)) if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (node))
fprintf (file, " in-abnormal-phi"); fprintf (file, " in-abnormal-phi");
if (SSA_NAME_IN_FREE_LIST (node)) if (SSA_NAME_IN_FREE_LIST (node))
...@@ -907,7 +907,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent, ...@@ -907,7 +907,7 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (node)]; i++) for (i = 0; i < omp_clause_num_ops[OMP_CLAUSE_CODE (node)]; i++)
{ {
indent_to (file, indent + 4); indent_to (file, indent + 4);
fprintf (file, "op %d:", i); fprintf (file, "op-%d:", i);
print_node_brief (file, "", OMP_CLAUSE_OPERAND (node, i), 0); print_node_brief (file, "", OMP_CLAUSE_OPERAND (node, i), 0);
} }
} }
...@@ -921,19 +921,19 @@ print_node (FILE *file, const char *prefix, tree node, int indent, ...@@ -921,19 +921,19 @@ print_node (FILE *file, const char *prefix, tree node, int indent,
cl_target_option_print (file, indent + 4, TREE_TARGET_OPTION (node)); cl_target_option_print (file, indent + 4, TREE_TARGET_OPTION (node));
break; break;
case IMPORTED_DECL: case IMPORTED_DECL:
fprintf (file, " imported declaration"); fprintf (file, " imported-declaration");
print_node_brief (file, "associated declaration", print_node_brief (file, "associated-declaration",
IMPORTED_DECL_ASSOCIATED_DECL (node), IMPORTED_DECL_ASSOCIATED_DECL (node),
indent + 4); indent + 4);
break; break;
case TREE_BINFO: case TREE_BINFO:
fprintf (file, " bases %d", fprintf (file, " bases:%d",
vec_safe_length (BINFO_BASE_BINFOS (node))); vec_safe_length (BINFO_BASE_BINFOS (node)));
print_node_brief (file, "offset", BINFO_OFFSET (node), indent + 4); print_node_brief (file, "offset", BINFO_OFFSET (node), indent + 4);
print_node_brief (file, "virtuals", BINFO_VIRTUALS (node), print_node_brief (file, "virtuals", BINFO_VIRTUALS (node),
indent + 4); indent + 4);
print_node_brief (file, "inheritance chain", print_node_brief (file, "inheritance-chain",
BINFO_INHERITANCE_CHAIN (node), BINFO_INHERITANCE_CHAIN (node),
indent + 4); indent + 4);
break; break;
...@@ -1086,7 +1086,7 @@ debug_raw (vec<tree, va_gc> &ref) ...@@ -1086,7 +1086,7 @@ debug_raw (vec<tree, va_gc> &ref)
FOR_EACH_VEC_ELT (ref, ix, elt) FOR_EACH_VEC_ELT (ref, ix, elt)
{ {
fprintf (stderr, "elt %d ", ix); fprintf (stderr, "elt:%d ", ix);
debug_raw (elt); debug_raw (elt);
} }
} }
...@@ -1103,7 +1103,7 @@ debug (vec<tree, va_gc> &ref) ...@@ -1103,7 +1103,7 @@ debug (vec<tree, va_gc> &ref)
FOR_EACH_VEC_ELT (ref, ix, elt) FOR_EACH_VEC_ELT (ref, ix, elt)
{ {
fprintf (stderr, "elt %d ", ix); fprintf (stderr, "elt:%d ", ix);
debug (elt); debug (elt);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment