aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/c-common.c5
-rw-r--r--gcc/dwarf2out.c34
-rw-r--r--gcc/final.c3
-rw-r--r--gcc/function.c4
-rw-r--r--gcc/toplev.c23
-rw-r--r--gcc/tree.h12
6 files changed, 52 insertions, 29 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 1e2f6c5..d921661 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -65,15 +65,12 @@ declare_function_name ()
}
else
{
- char *kind = "function";
- if (TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE)
- kind = "method";
/* Allow functions to be nameless (such as artificial ones). */
if (DECL_NAME (current_function_decl))
name = IDENTIFIER_POINTER (DECL_NAME (current_function_decl));
else
name = "";
- printable_name = (*decl_printable_name) (current_function_decl, &kind);
+ printable_name = (*decl_printable_name) (current_function_decl, 2);
}
declare_hidden_char_array ("__FUNCTION__", name);
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 811977c..6d79f54 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -4443,6 +4443,18 @@ output_call_frame_info ()
}
}
+/* The DWARF2 pubname for a nested thingy looks like "A::f". The output
+ of decl_printable_name for C++ looks like "A::f(int)". Let's drop the
+ argument list, and maybe the scope. */
+
+static char*
+dwarf2_name (decl, scope)
+ tree decl;
+ int scope;
+{
+ return (*decl_printable_name) (decl, scope ? 1 : 0);
+}
+
/* Add a new entry to .debug_pubnames if appropriate. */
static void
add_pubname (decl, die)
@@ -4462,7 +4474,8 @@ add_pubname (decl, die)
}
p = &pubname_table[pubname_table_in_use++];
p->die = die;
- p->name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl));
+
+ p->name = xstrdup (dwarf2_name (decl, 1));
}
/* Output the public names table used to speed up access to externally
@@ -4616,7 +4629,12 @@ output_aranges ()
if (a->die_tag == DW_TAG_subprogram)
ASM_OUTPUT_DWARF_ADDR (asm_out_file, get_AT_low_pc (a));
else
- ASM_OUTPUT_DWARF_ADDR (asm_out_file, get_AT_string (a, DW_AT_name));
+ {
+ char *name = get_AT_string (a, DW_AT_MIPS_linkage_name);
+ if (! name)
+ name = get_AT_string (a, DW_AT_name);
+ ASM_OUTPUT_DWARF_ADDR (asm_out_file, name);
+ }
if (flag_verbose_asm)
{
fprintf (asm_out_file, "\t%s Address", ASM_COMMENT_START);
@@ -6352,15 +6370,15 @@ add_name_and_src_coords_attributes (die, decl)
register tree decl;
{
register tree decl_name;
- if (TREE_CODE (decl) == FUNCTION_DECL || TREE_CODE (decl) == VAR_DECL)
- decl_name = DECL_ASSEMBLER_NAME (decl);
- else
- decl_name = DECL_NAME (decl);
-
+ decl_name = DECL_NAME (decl);
if (decl_name && IDENTIFIER_POINTER (decl_name))
{
- add_name_attribute (die, IDENTIFIER_POINTER (decl_name));
+ add_name_attribute (die, dwarf2_name (decl, 0));
add_src_coords_attributes (die, decl);
+ if ((TREE_CODE (decl) == FUNCTION_DECL || TREE_CODE (decl) == VAR_DECL)
+ && DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl))
+ add_AT_string (die, DW_AT_MIPS_linkage_name,
+ IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
}
}
diff --git a/gcc/final.c b/gcc/final.c
index cc5bedf..5129611 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -955,9 +955,8 @@ final_start_function (first, file, optimize)
of the function name. */
if (profile_block_flag)
{
- char *junk = "function";
bb_func_label_num =
- add_bb_string ((*decl_printable_name) (current_function_decl, &junk), FALSE);
+ add_bb_string ((*decl_printable_name) (current_function_decl, 2), FALSE);
}
}
diff --git a/gcc/function.c b/gcc/function.c
index 468558b..e38c614 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -4902,8 +4902,6 @@ init_function_start (subr, filename, line)
char *filename;
int line;
{
- char *junk;
-
if (output_bytecode)
{
this_function_decl = subr;
@@ -4951,7 +4949,7 @@ init_function_start (subr, filename, line)
init_const_rtx_hash_table ();
- current_function_name = (*decl_printable_name) (subr, &junk);
+ current_function_name = (*decl_printable_name) (subr, 2);
/* Nonzero if this is a nested function that uses a static chain. */
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 1a2212d..f536d83 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -292,9 +292,15 @@ int sorrycount = 0;
/* Flag to output bytecode instead of native assembler */
int output_bytecode = 0;
-/* Pointer to function to compute the name to use to print a declaration. */
+/* Pointer to function to compute the name to use to print a declaration.
+ DECL is the declaration in question.
+ VERBOSITY determines what information will be printed:
+ 0: DECL_NAME, demangled as necessary.
+ 1: and scope information.
+ 2: and any other information that might be interesting, such as function
+ parameter types in C++. */
-char *(*decl_printable_name) ();
+char *(*decl_printable_name) (/* tree decl, int verbosity */);
/* Pointer to function to compute rtl for a language-specific tree code. */
@@ -1031,9 +1037,9 @@ fatal_insn_not_found (insn)
/* This is the default decl_printable_name function. */
static char *
-decl_name (decl, kind)
+decl_name (decl, verbosity)
tree decl;
- char **kind;
+ int verbosity;
{
return IDENTIFIER_POINTER (DECL_NAME (decl));
}
@@ -1057,11 +1063,10 @@ announce_function (decl)
{
if (! quiet_flag)
{
- char *junk;
if (rtl_dump_and_exit)
fprintf (stderr, "%s ", IDENTIFIER_POINTER (DECL_NAME (decl)));
else
- fprintf (stderr, " %s", (*decl_printable_name) (decl, &junk));
+ fprintf (stderr, " %s", (*decl_printable_name) (decl, 2));
fflush (stderr);
need_error_newline = 1;
last_error_function = current_function_decl;
@@ -1089,7 +1094,7 @@ default_print_error_function (file)
fprintf (stderr, "At top level:\n");
else
{
- char *name = (*decl_printable_name) (current_function_decl, &kind);
+ char *name = (*decl_printable_name) (current_function_decl, 2);
fprintf (stderr, "In %s `%s':\n", kind, name);
}
@@ -1187,7 +1192,7 @@ v_message_with_decl (decl, prefix, s, ap)
char *s;
va_list ap;
{
- char *n, *p, *junk;
+ char *n, *p;
fprintf (stderr, "%s:%d: ",
DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
@@ -1223,7 +1228,7 @@ v_message_with_decl (decl, prefix, s, ap)
if (*p == '%') /* Print the name. */
{
char *n = (DECL_NAME (decl)
- ? (*decl_printable_name) (decl, &junk)
+ ? (*decl_printable_name) (decl, 2)
: "((anonymous))");
fputs (n, stderr);
while (*p)
diff --git a/gcc/tree.h b/gcc/tree.h
index dc2714e4..ec1ce34 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1639,9 +1639,15 @@ extern int current_function_calls_longjmp;
extern int all_types_permanent;
-/* Pointer to function to compute the name to use to print a declaration. */
-
-extern char *(*decl_printable_name) ();
+/* Pointer to function to compute the name to use to print a declaration.
+ DECL is the declaration in question.
+ VERBOSITY determines what information will be printed:
+ 0: DECL_NAME, demangled as necessary.
+ 1: and scope information.
+ 2: and any other information that might be interesting, such as function
+ parameter types in C++. */
+
+extern char *(*decl_printable_name) (/* tree decl, int verbosity */);
/* Pointer to function to finish handling an incomplete decl at the
end of compilation. */