Commit 721a8ac5 by Nicolas Setton Committed by Olivier Hainque

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
parent 6a1f8611
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
......
......@@ -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. */
......
......@@ -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. */
......
/* 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, \
......
/* 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. */
......
/* 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. */
......
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