summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/tree-pretty-print.c40
2 files changed, 41 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 1f8cb377ca4..b186ffa57fd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2009-06-17 Richard Henderson <rth@redhat.com>
+
+ * tree-pretty-print.c (maybe_dump_asm_name): New.
+ (dump_decl_name): Use it.
+ (PRINT_FUNCTION_NAME): Merge into...
+ (dump_function_name): ... here. Use maybe_dump_asm_name.
+
2009-06-17 Cary Coutant <ccoutant@google.com>
* dbxout.c (dbxout_source_line): Add is_stmt parameter.
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index 0599e3c4897..cd8033a1523 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -50,11 +50,6 @@ static void do_niy (pretty_printer *, const_tree);
#define NIY do_niy(buffer,node)
-#define PRINT_FUNCTION_NAME(NODE) pp_printf \
- (buffer, "%s", TREE_CODE (NODE) == NOP_EXPR ? \
- lang_hooks.decl_printable_name (TREE_OPERAND (NODE, 0), 1) : \
- lang_hooks.decl_printable_name (NODE, 1))
-
static pretty_printer buffer;
static int initialized = 0;
@@ -160,6 +155,32 @@ print_generic_expr (FILE *file, tree t, int flags)
dump_generic_node (&buffer, t, 0, flags, false);
}
+/* Dump the assembly name of a decl node if it's sufficiently different
+ from the decl name. */
+
+static void
+maybe_dump_asm_name (pretty_printer *buffer, tree node, int flags)
+{
+ tree n, a;
+
+ if (flags & TDF_SLIM)
+ return;
+ if (DECL_NAME (node) == NULL || !DECL_ASSEMBLER_NAME_SET_P (node))
+ return;
+
+ n = DECL_NAME (node);
+ a = DECL_ASSEMBLER_NAME (node);
+ if (n == a)
+ return;
+ if (strncmp (IDENTIFIER_POINTER (n), "__builtin_", 10) == 0)
+ return;
+
+ pp_space (buffer);
+ pp_character (buffer, '[');
+ pp_tree_identifier (buffer, a);
+ pp_character (buffer, ']');
+}
+
/* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
in FLAGS. */
@@ -182,6 +203,8 @@ dump_decl_name (pretty_printer *buffer, tree node, int flags)
pp_printf (buffer, "%c.%u", c, DECL_UID (t));
}
}
+
+ maybe_dump_asm_name (buffer, node, flags);
}
/* Like the above, but used for pretty printing function calls. */
@@ -190,7 +213,12 @@ static void
dump_function_name (pretty_printer *buffer, tree node)
{
if (DECL_NAME (node))
- PRINT_FUNCTION_NAME (node);
+ {
+ if (TREE_CODE (node) == NOP_EXPR)
+ node = TREE_OPERAND (node, 0);
+ pp_string (buffer, lang_hooks.decl_printable_name (node, 1));
+ maybe_dump_asm_name (buffer, node, 0);
+ }
else
dump_decl_name (buffer, node, 0);
}