x
authorJason Merrill <merrill@gnu.org>
Sun, 16 Feb 1997 10:05:43 +0000 (10:05 +0000)
committerJason Merrill <merrill@gnu.org>
Sun, 16 Feb 1997 10:05:43 +0000 (10:05 +0000)
From-SVN: r13652

gcc/c-common.c
gcc/dwarf2out.c
gcc/final.c
gcc/function.c
gcc/toplev.c
gcc/tree.h

index 1e2f6c5c0bb7c4cf814b89e7a18abea0234c8622..d921661578e55a8b5bfeabbfe3b03b005ae026ed 100644 (file)
@@ -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);
index 811977c15f770c7e83b9709917d1430a7b59b4de..6d79f54fcf96f4be42a13276cefef76a5f88f75d 100644 (file)
@@ -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)));
     }
 }
 
index cc5bedf185103c0fb8ef86a4947230fe3484d37d..51296117972f1f4be5d4aad3ed260a59435c1326 100644 (file)
@@ -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);
     }
 }
 
index 468558bc2167aeabbccca3b61b24b7a27681ccb0..e38c614a60ddd05d821fa5210d57fbce0b5f7488 100644 (file)
@@ -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.  */
 
index 1a2212d07f2258ceaab07789759e432210bece7e..f536d839fdf44e88893463ac6e22206f221e62e1 100644 (file)
@@ -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)
index dc2714e4bd4267bb321975b3b45a625bd415efdd..ec1ce349a45f8a2d418b9fb1777bd71a77aa3bdf 100644 (file)
@@ -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.  */