Commit a1d7ffe3 by Jason Merrill

x

From-SVN: r13652
parent 6e47932d
...@@ -65,15 +65,12 @@ declare_function_name () ...@@ -65,15 +65,12 @@ declare_function_name ()
} }
else 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). */ /* Allow functions to be nameless (such as artificial ones). */
if (DECL_NAME (current_function_decl)) if (DECL_NAME (current_function_decl))
name = IDENTIFIER_POINTER (DECL_NAME (current_function_decl)); name = IDENTIFIER_POINTER (DECL_NAME (current_function_decl));
else else
name = ""; 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); declare_hidden_char_array ("__FUNCTION__", name);
......
...@@ -4443,6 +4443,18 @@ output_call_frame_info () ...@@ -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. */ /* Add a new entry to .debug_pubnames if appropriate. */
static void static void
add_pubname (decl, die) add_pubname (decl, die)
...@@ -4462,7 +4474,8 @@ add_pubname (decl, die) ...@@ -4462,7 +4474,8 @@ add_pubname (decl, die)
} }
p = &pubname_table[pubname_table_in_use++]; p = &pubname_table[pubname_table_in_use++];
p->die = die; 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 /* Output the public names table used to speed up access to externally
...@@ -4616,7 +4629,12 @@ output_aranges () ...@@ -4616,7 +4629,12 @@ output_aranges ()
if (a->die_tag == DW_TAG_subprogram) if (a->die_tag == DW_TAG_subprogram)
ASM_OUTPUT_DWARF_ADDR (asm_out_file, get_AT_low_pc (a)); ASM_OUTPUT_DWARF_ADDR (asm_out_file, get_AT_low_pc (a));
else 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) if (flag_verbose_asm)
{ {
fprintf (asm_out_file, "\t%s Address", ASM_COMMENT_START); fprintf (asm_out_file, "\t%s Address", ASM_COMMENT_START);
...@@ -6352,15 +6370,15 @@ add_name_and_src_coords_attributes (die, decl) ...@@ -6352,15 +6370,15 @@ add_name_and_src_coords_attributes (die, decl)
register tree decl; register tree decl;
{ {
register tree decl_name; 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)) 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); 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)));
} }
} }
......
...@@ -955,9 +955,8 @@ final_start_function (first, file, optimize) ...@@ -955,9 +955,8 @@ final_start_function (first, file, optimize)
of the function name. */ of the function name. */
if (profile_block_flag) if (profile_block_flag)
{ {
char *junk = "function";
bb_func_label_num = 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);
} }
} }
......
...@@ -4902,8 +4902,6 @@ init_function_start (subr, filename, line) ...@@ -4902,8 +4902,6 @@ init_function_start (subr, filename, line)
char *filename; char *filename;
int line; int line;
{ {
char *junk;
if (output_bytecode) if (output_bytecode)
{ {
this_function_decl = subr; this_function_decl = subr;
...@@ -4951,7 +4949,7 @@ init_function_start (subr, filename, line) ...@@ -4951,7 +4949,7 @@ init_function_start (subr, filename, line)
init_const_rtx_hash_table (); 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. */ /* Nonzero if this is a nested function that uses a static chain. */
......
...@@ -292,9 +292,15 @@ int sorrycount = 0; ...@@ -292,9 +292,15 @@ int sorrycount = 0;
/* Flag to output bytecode instead of native assembler */ /* Flag to output bytecode instead of native assembler */
int output_bytecode = 0; 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. */ /* Pointer to function to compute rtl for a language-specific tree code. */
...@@ -1031,9 +1037,9 @@ fatal_insn_not_found (insn) ...@@ -1031,9 +1037,9 @@ fatal_insn_not_found (insn)
/* This is the default decl_printable_name function. */ /* This is the default decl_printable_name function. */
static char * static char *
decl_name (decl, kind) decl_name (decl, verbosity)
tree decl; tree decl;
char **kind; int verbosity;
{ {
return IDENTIFIER_POINTER (DECL_NAME (decl)); return IDENTIFIER_POINTER (DECL_NAME (decl));
} }
...@@ -1057,11 +1063,10 @@ announce_function (decl) ...@@ -1057,11 +1063,10 @@ announce_function (decl)
{ {
if (! quiet_flag) if (! quiet_flag)
{ {
char *junk;
if (rtl_dump_and_exit) if (rtl_dump_and_exit)
fprintf (stderr, "%s ", IDENTIFIER_POINTER (DECL_NAME (decl))); fprintf (stderr, "%s ", IDENTIFIER_POINTER (DECL_NAME (decl)));
else else
fprintf (stderr, " %s", (*decl_printable_name) (decl, &junk)); fprintf (stderr, " %s", (*decl_printable_name) (decl, 2));
fflush (stderr); fflush (stderr);
need_error_newline = 1; need_error_newline = 1;
last_error_function = current_function_decl; last_error_function = current_function_decl;
...@@ -1089,7 +1094,7 @@ default_print_error_function (file) ...@@ -1089,7 +1094,7 @@ default_print_error_function (file)
fprintf (stderr, "At top level:\n"); fprintf (stderr, "At top level:\n");
else 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); fprintf (stderr, "In %s `%s':\n", kind, name);
} }
...@@ -1187,7 +1192,7 @@ v_message_with_decl (decl, prefix, s, ap) ...@@ -1187,7 +1192,7 @@ v_message_with_decl (decl, prefix, s, ap)
char *s; char *s;
va_list ap; va_list ap;
{ {
char *n, *p, *junk; char *n, *p;
fprintf (stderr, "%s:%d: ", fprintf (stderr, "%s:%d: ",
DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl)); DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
...@@ -1223,7 +1228,7 @@ v_message_with_decl (decl, prefix, s, ap) ...@@ -1223,7 +1228,7 @@ v_message_with_decl (decl, prefix, s, ap)
if (*p == '%') /* Print the name. */ if (*p == '%') /* Print the name. */
{ {
char *n = (DECL_NAME (decl) char *n = (DECL_NAME (decl)
? (*decl_printable_name) (decl, &junk) ? (*decl_printable_name) (decl, 2)
: "((anonymous))"); : "((anonymous))");
fputs (n, stderr); fputs (n, stderr);
while (*p) while (*p)
......
...@@ -1639,9 +1639,15 @@ extern int current_function_calls_longjmp; ...@@ -1639,9 +1639,15 @@ extern int current_function_calls_longjmp;
extern int all_types_permanent; extern int all_types_permanent;
/* 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.
extern char *(*decl_printable_name) (); 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 /* Pointer to function to finish handling an incomplete decl at the
end of compilation. */ end of compilation. */
......
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