summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNicolas Setton <setton@adacore.com>2006-05-19 12:31:50 +0000
committerOlivier Hainque <hainque@gcc.gnu.org>2006-05-19 12:31:50 +0000
commit721a8ac58bbc00df746ccdfd6529f2d5424b11f3 (patch)
tree3e100b52fe6535b867760b19644619e5846e3062 /gcc
parent6a1f86116204a1aaecbd1824cfd520ae248bb026 (diff)
downloadgcc-721a8ac58bbc00df746ccdfd6529f2d5424b11f3.tar.gz
langhooks.h (struct lang_hooks): Add dwarf_name language hook.
* 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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/ada/misc.c11
-rw-r--r--gcc/dwarf2out.c6
-rw-r--r--gcc/langhooks-def.h5
-rw-r--r--gcc/langhooks.c12
-rw-r--r--gcc/langhooks.h7
6 files changed, 44 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9fe0328e8b4..1e3bbf6dde6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/ada/misc.c b/gcc/ada/misc.c
index 3c4e8cba33d..2f68e42b4d9 100644
--- a/gcc/ada/misc.c
+++ b/gcc/ada/misc.c
@@ -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. */
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index accbd01f83a..3d0c89017e1 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -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. */
diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h
index 168220e31a1..eae7c928d4e 100644
--- a/gcc/langhooks-def.h
+++ b/gcc/langhooks-def.h
@@ -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, \
diff --git a/gcc/langhooks.c b/gcc/langhooks.c
index b2b9b4595b2..4c736d054be 100644
--- a/gcc/langhooks.c
+++ b/gcc/langhooks.c
@@ -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. */
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index eb6aaaff12e..e6148936829 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -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. */