langhooks.h (struct lang_hooks): Add dwarf_name language hook.
authorNicolas Setton <setton@adacore.com>
Fri, 19 May 2006 12:31:50 +0000 (12:31 +0000)
committerOlivier Hainque <hainque@gcc.gnu.org>
Fri, 19 May 2006 12:31:50 +0000 (12:31 +0000)
* langhooks.h (struct lang_hooks): Add dwarf_name language hook.
* langhooks.c (lhd_dwarf_name): New function.
* langhooks-def.h (lhd_dwarf_name): Declare.
(LANG_HOOKS_DWARF_NAME): New macro, defaults to lhd_dwarf_name.
* dwarf2out.c (dwarf2_name): Use the dwarf_name language hook.
* ada/misc.c (gnat_dwarf_name): New function.
(LANG_HOOKS_DWARF_NAME): Define to gnat_dwarf_name.

From-SVN: r113905

gcc/ChangeLog
gcc/ada/misc.c
gcc/dwarf2out.c
gcc/langhooks-def.h
gcc/langhooks.c
gcc/langhooks.h

index 9fe0328e8b49a20b9845cf21f2c56d12905f08d9..1e3bbf6dde6505aada20c3608b69982a2c83c780 100644 (file)
@@ -1,3 +1,13 @@
+2006-05-19  Nicolas Setton  <setton@adacore.com>
+
+       * langhooks.h (struct lang_hooks): Add dwarf_name language hook.
+       * langhooks.c (lhd_dwarf_name): New function.
+       * langhooks-def.h (lhd_dwarf_name): Declare.
+       (LANG_HOOKS_DWARF_NAME): New macro, defaults to lhd_dwarf_name.
+       * dwarf2out.c (dwarf2_name): Use the dwarf_name language hook.
+       * ada/misc.c (gnat_dwarf_name): New function.
+       (LANG_HOOKS_DWARF_NAME): Define to gnat_dwarf_name.
+       
 2006-05-19  Richard Sandiford  <richard@codesourcery.com>
 
        * libgcc2.c (MIN_UNITS_PER_WORD): Move default definition from
index 3c4e8cba33d2de169fe0b5e307abe74cb789965d..2f68e42b4d9136739a9dec3ff1f76f8aef66336f 100644 (file)
@@ -94,6 +94,7 @@ static HOST_WIDE_INT gnat_get_alias_set       (tree);
 static void gnat_print_decl            (FILE *, tree, int);
 static void gnat_print_type            (FILE *, tree, int);
 static const char *gnat_printable_name (tree, int);
+static const char *gnat_dwarf_name     (tree, int);
 static tree gnat_eh_runtime_type       (tree);
 static int gnat_eh_type_covers         (tree, tree);
 static void gnat_parse_file            (int);
@@ -144,6 +145,8 @@ static tree gnat_type_max_size              (tree);
 #define LANG_HOOKS_TYPE_MAX_SIZE       gnat_type_max_size
 #undef  LANG_HOOKS_DECL_PRINTABLE_NAME
 #define LANG_HOOKS_DECL_PRINTABLE_NAME gnat_printable_name
+#undef  LANG_HOOKS_DWARF_NAME
+#define LANG_HOOKS_DWARF_NAME          gnat_dwarf_name
 #undef  LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
 #define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION gnat_expand_body
 #undef  LANG_HOOKS_GIMPLIFY_EXPR
@@ -596,6 +599,14 @@ gnat_printable_name (tree decl, int verbosity)
   return (const char *) ada_name;
 }
 
+static const char *
+gnat_dwarf_name (tree t, int verbosity ATTRIBUTE_UNUSED)
+{
+  gcc_assert (DECL_P (t));
+
+  return (const char *) IDENTIFIER_POINTER (DECL_NAME (t));
+}
+
 /* Expands GNAT-specific GCC tree nodes.  The only ones we support
    here are  and NULL_EXPR.  */
 
index accbd01f83a4d2aac758b93834db96622d6dd95a..3d0c89017e1e83698cfeb0b39240c6175fdd1131 100644 (file)
@@ -7232,14 +7232,12 @@ output_comp_unit (dw_die_ref die, int output_if_empty)
     }
 }
 
-/* The DWARF2 pubname for a nested thingy looks like "A::f".  The
-   output of lang_hooks.decl_printable_name for C++ looks like
-   "A::f(int)".  Let's drop the argument list, and maybe the scope.  */
+/* Return the DWARF2/3 pubname associated with a decl.  */
 
 static const char *
 dwarf2_name (tree decl, int scope)
 {
-  return lang_hooks.decl_printable_name (decl, scope ? 1 : 0);
+  return lang_hooks.dwarf_name (decl, scope ? 1 : 0);
 }
 
 /* Add a new entry to .debug_pubnames if appropriate.  */
index 168220e31a1a8d1253ef5e35789fdade76677f41..eae7c928d4e01cc3b26c637e57f422aa9b92cc51 100644 (file)
@@ -1,5 +1,5 @@
 /* Default macros to initialize the lang_hooks data structure.
-   Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
    Contributed by Alexandre Oliva  <aoliva@redhat.com>
 
 This file is part of GCC.
@@ -53,6 +53,7 @@ extern int lhd_safe_from_p (rtx, tree);
 extern tree lhd_staticp (tree);
 extern void lhd_print_tree_nothing (FILE *, tree, int);
 extern const char *lhd_decl_printable_name (tree, int);
+extern const char *lhd_dwarf_name (tree, int);
 extern int lhd_types_compatible_p (tree, tree);
 extern rtx lhd_expand_expr (tree, rtx, enum machine_mode, int, rtx *);
 extern int lhd_expand_decl (tree);
@@ -124,6 +125,7 @@ extern void lhd_omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *,
 #define LANG_HOOKS_PRINT_IDENTIFIER    lhd_print_tree_nothing
 #define LANG_HOOKS_PRINT_ERROR_FUNCTION lhd_print_error_function
 #define LANG_HOOKS_DECL_PRINTABLE_NAME lhd_decl_printable_name
+#define LANG_HOOKS_DWARF_NAME          lhd_dwarf_name
 #define LANG_HOOKS_GET_CALLEE_FNDECL   lhd_return_null_tree
 #define LANG_HOOKS_EXPR_SIZE           lhd_expr_size
 #define LANG_HOOKS_TREE_SIZE           lhd_tree_size
@@ -309,6 +311,7 @@ extern tree lhd_make_node (enum tree_code);
   LANG_HOOKS_PRINT_TYPE, \
   LANG_HOOKS_PRINT_IDENTIFIER, \
   LANG_HOOKS_DECL_PRINTABLE_NAME, \
+  LANG_HOOKS_DWARF_NAME, \
   LANG_HOOKS_TYPES_COMPATIBLE_P, \
   LANG_HOOKS_GET_CALLEE_FNDECL, \
   LANG_HOOKS_PRINT_ERROR_FUNCTION, \
index b2b9b4595b21fa22374366f70a90c9a52d30fa70..4c736d054be10121edc1a793da9310bc2c485440 100644 (file)
@@ -1,5 +1,5 @@
 /* Default language-specific hooks.
-   Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
    Contributed by Alexandre Oliva  <aoliva@redhat.com>
 
 This file is part of GCC.
@@ -264,6 +264,16 @@ lhd_decl_printable_name (tree decl, int ARG_UNUSED (verbosity))
   return IDENTIFIER_POINTER (DECL_NAME (decl));
 }
 
+/* This is the default dwarf_name function.  */
+
+const char *
+lhd_dwarf_name (tree t, int verbosity)
+{
+  gcc_assert (DECL_P (t));
+
+  return lang_hooks.decl_printable_name (t, verbosity);
+}
+
 /* This compares two types for equivalence ("compatible" in C-based languages).
    This routine should only return 1 if it is sure.  It should not be used
    in contexts where erroneously returning 0 causes problems.  */
index eb6aaaff12ed332b13b127931f023662e212207a..e6148936829c2d0c75e29cc054414000ad897efd 100644 (file)
@@ -1,5 +1,5 @@
 /* The lang_hooks data structure.
-   Copyright 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
+   Copyright 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -382,6 +382,11 @@ struct lang_hooks
      types in C++.  */
   const char *(*decl_printable_name) (tree decl, int verbosity);
 
+  /* Computes the dwarf-2/3 name for a tree.  VERBOSITY determines what
+     information will be printed: 0: DECL_NAME, demangled as
+     necessary.  1: and scope information.  */
+  const char *(*dwarf_name) (tree, int verbosity);
+
   /* This compares two types for equivalence ("compatible" in C-based languages).
      This routine should only return 1 if it is sure.  It should not be used
      in contexts where erroneously returning 0 causes problems.  */