re PR debug/7081 (DWARF enhancements for C++)
gcc/ChangeLog: PR debug/7081 * dwarf2out.c (dwarf_tag_name): Synchronize with dwarf2.h. (is_type_die): Cover interface types. (class_or_namespace_scope_p): Cover interface and class types. (record_type_tag): New. (gen_inlined_structure_type_die): Use it. (gen_struct_or_union_type_die): Likewise. (prune_unused_types_walk): Cover interface types. * langhooks.h (classify_record): New enum. (classify_record): New member in struct langhooks_for_types. * langhooks-def.h (LANG_HOOKS_CLASSIFY_RECORD): New. (LANGHOOKS_FOR_TYPES_INITIALIZER): Adjust. gcc/cp/ChangeLog: PR debug/7081 * cp-lang.c (cp_classify_record): New. (LANG_HOOKS_CLASSIFY_RECORD): Override. gcc/java/ChangeLog: PR debug/7081 * lang.c (java_classify_record): New. (LANG_HOOKS_CLASSIFY_RECORD): Override. From-SVN: r130960
This commit is contained in:
parent
d2f08d9879
commit
394d9fe79e
@ -1,3 +1,18 @@
|
||||
2007-12-15 Alexandre Oliva <aoliva@redhat.com>
|
||||
|
||||
PR debug/7081
|
||||
* dwarf2out.c (dwarf_tag_name): Synchronize with dwarf2.h.
|
||||
(is_type_die): Cover interface types.
|
||||
(class_or_namespace_scope_p): Cover interface and class types.
|
||||
(record_type_tag): New.
|
||||
(gen_inlined_structure_type_die): Use it.
|
||||
(gen_struct_or_union_type_die): Likewise.
|
||||
(prune_unused_types_walk): Cover interface types.
|
||||
* langhooks.h (classify_record): New enum.
|
||||
(classify_record): New member in struct langhooks_for_types.
|
||||
* langhooks-def.h (LANG_HOOKS_CLASSIFY_RECORD): New.
|
||||
(LANGHOOKS_FOR_TYPES_INITIALIZER): Adjust.
|
||||
|
||||
2007-12-15 Alexandre Oliva <aoliva@redhat.com>
|
||||
|
||||
* dwarf2out.c (reference_to_unused): Don't emit strings in
|
||||
|
@ -1,3 +1,9 @@
|
||||
2007-12-15 Alexandre Oliva <aoliva@redhat.com>
|
||||
|
||||
PR debug/7081
|
||||
* cp-lang.c (cp_classify_record): New.
|
||||
(LANG_HOOKS_CLASSIFY_RECORD): Override.
|
||||
|
||||
2007-12-11 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/34238
|
||||
|
@ -36,6 +36,7 @@ along with GCC; see the file COPYING3. If not see
|
||||
enum c_language_kind c_language = clk_cxx;
|
||||
static void cp_init_ts (void);
|
||||
static const char * cxx_dwarf_name (tree t, int verbosity);
|
||||
static enum classify_record cp_classify_record (tree type);
|
||||
|
||||
/* Lang hooks common to C++ and ObjC++ are declared in cp/cp-objcp-common.h;
|
||||
consequently, there should be very few hooks below. */
|
||||
@ -44,6 +45,8 @@ static const char * cxx_dwarf_name (tree t, int verbosity);
|
||||
#define LANG_HOOKS_NAME "GNU C++"
|
||||
#undef LANG_HOOKS_INIT
|
||||
#define LANG_HOOKS_INIT cxx_init
|
||||
#undef LANG_HOOKS_CLASSIFY_RECORD
|
||||
#define LANG_HOOKS_CLASSIFY_RECORD cp_classify_record
|
||||
#undef LANG_HOOKS_GENERIC_TYPE_P
|
||||
#define LANG_HOOKS_GENERIC_TYPE_P class_tmpl_impl_spec_p
|
||||
#undef LANG_HOOKS_DECL_PRINTABLE_NAME
|
||||
@ -153,6 +156,15 @@ cxx_dwarf_name (tree t, int verbosity)
|
||||
return cxx_printable_name (t, verbosity);
|
||||
}
|
||||
|
||||
static enum classify_record
|
||||
cp_classify_record (tree type)
|
||||
{
|
||||
if (CLASSTYPE_DECLARED_CLASS (type))
|
||||
return RECORD_IS_CLASS;
|
||||
|
||||
return RECORD_IS_STRUCT;
|
||||
}
|
||||
|
||||
void
|
||||
finish_file (void)
|
||||
{
|
||||
|
@ -4562,8 +4562,6 @@ dwarf_tag_name (unsigned int tag)
|
||||
return "DW_TAG_namelist";
|
||||
case DW_TAG_namelist_item:
|
||||
return "DW_TAG_namelist_item";
|
||||
case DW_TAG_namespace:
|
||||
return "DW_TAG_namespace";
|
||||
case DW_TAG_packed_type:
|
||||
return "DW_TAG_packed_type";
|
||||
case DW_TAG_subprogram:
|
||||
@ -4582,8 +4580,26 @@ dwarf_tag_name (unsigned int tag)
|
||||
return "DW_TAG_variable";
|
||||
case DW_TAG_volatile_type:
|
||||
return "DW_TAG_volatile_type";
|
||||
case DW_TAG_dwarf_procedure:
|
||||
return "DW_TAG_dwarf_procedure";
|
||||
case DW_TAG_restrict_type:
|
||||
return "DW_TAG_restrict_type";
|
||||
case DW_TAG_interface_type:
|
||||
return "DW_TAG_interface_type";
|
||||
case DW_TAG_namespace:
|
||||
return "DW_TAG_namespace";
|
||||
case DW_TAG_imported_module:
|
||||
return "DW_TAG_imported_module";
|
||||
case DW_TAG_unspecified_type:
|
||||
return "DW_TAG_unspecified_type";
|
||||
case DW_TAG_partial_unit:
|
||||
return "DW_TAG_partial_unit";
|
||||
case DW_TAG_imported_unit:
|
||||
return "DW_TAG_imported_unit";
|
||||
case DW_TAG_condition:
|
||||
return "DW_TAG_condition";
|
||||
case DW_TAG_shared_type:
|
||||
return "DW_TAG_shared_type";
|
||||
case DW_TAG_MIPS_loop:
|
||||
return "DW_TAG_MIPS_loop";
|
||||
case DW_TAG_format_label:
|
||||
@ -6301,6 +6317,7 @@ is_type_die (dw_die_ref die)
|
||||
{
|
||||
case DW_TAG_array_type:
|
||||
case DW_TAG_class_type:
|
||||
case DW_TAG_interface_type:
|
||||
case DW_TAG_enumeration_type:
|
||||
case DW_TAG_pointer_type:
|
||||
case DW_TAG_reference_type:
|
||||
@ -11475,6 +11492,8 @@ class_or_namespace_scope_p (dw_die_ref context_die)
|
||||
{
|
||||
return (context_die
|
||||
&& (context_die->die_tag == DW_TAG_structure_type
|
||||
|| context_die->die_tag == DW_TAG_class_type
|
||||
|| context_die->die_tag == DW_TAG_interface_type
|
||||
|| context_die->die_tag == DW_TAG_union_type
|
||||
|| context_die->die_tag == DW_TAG_namespace));
|
||||
}
|
||||
@ -11893,12 +11912,36 @@ gen_inlined_enumeration_type_die (tree type, dw_die_ref context_die)
|
||||
add_abstract_origin_attribute (type_die, type);
|
||||
}
|
||||
|
||||
/* Determine what tag to use for a record type. */
|
||||
|
||||
static enum dwarf_tag
|
||||
record_type_tag (tree type)
|
||||
{
|
||||
if (! lang_hooks.types.classify_record)
|
||||
return DW_TAG_structure_type;
|
||||
|
||||
switch (lang_hooks.types.classify_record (type))
|
||||
{
|
||||
case RECORD_IS_STRUCT:
|
||||
return DW_TAG_structure_type;
|
||||
|
||||
case RECORD_IS_CLASS:
|
||||
return DW_TAG_class_type;
|
||||
|
||||
case RECORD_IS_INTERFACE:
|
||||
return DW_TAG_interface_type;
|
||||
|
||||
default:
|
||||
gcc_unreachable ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Generate a DIE to represent an inlined instance of a structure type. */
|
||||
|
||||
static void
|
||||
gen_inlined_structure_type_die (tree type, dw_die_ref context_die)
|
||||
{
|
||||
dw_die_ref type_die = new_die (DW_TAG_structure_type, context_die, type);
|
||||
dw_die_ref type_die = new_die (record_type_tag (type), context_die, type);
|
||||
|
||||
/* We do not check for TREE_ASM_WRITTEN (type) being set, as the type may
|
||||
be incomplete and such types are not marked. */
|
||||
@ -13099,7 +13142,7 @@ gen_struct_or_union_type_die (tree type, dw_die_ref context_die,
|
||||
dw_die_ref old_die = type_die;
|
||||
|
||||
type_die = new_die (TREE_CODE (type) == RECORD_TYPE
|
||||
? DW_TAG_structure_type : DW_TAG_union_type,
|
||||
? record_type_tag (type) : DW_TAG_union_type,
|
||||
scope_die, type);
|
||||
equate_type_number_to_die (type, type_die);
|
||||
if (old_die)
|
||||
@ -14773,6 +14816,7 @@ prune_unused_types_walk (dw_die_ref die)
|
||||
case DW_TAG_structure_type:
|
||||
case DW_TAG_union_type:
|
||||
case DW_TAG_class_type:
|
||||
case DW_TAG_interface_type:
|
||||
case DW_TAG_friend:
|
||||
case DW_TAG_variant_part:
|
||||
case DW_TAG_enumeration_type:
|
||||
|
@ -1,3 +1,9 @@
|
||||
2007-12-15 Alexandre Oliva <aoliva@redhat.com>
|
||||
|
||||
PR debug/7081
|
||||
* lang.c (java_classify_record): New.
|
||||
(LANG_HOOKS_CLASSIFY_RECORD): Override.
|
||||
|
||||
2007-11-26 Andreas Krebbel <krebbel1@de.ibm.com>
|
||||
|
||||
PR 34081/C++
|
||||
|
@ -64,6 +64,8 @@ static bool java_decl_ok_for_sibcall (const_tree);
|
||||
static tree java_get_callee_fndecl (const_tree);
|
||||
static void java_clear_binding_stack (void);
|
||||
|
||||
static enum classify_record java_classify_record (tree type);
|
||||
|
||||
#ifndef TARGET_OBJECT_SUFFIX
|
||||
# define TARGET_OBJECT_SUFFIX ".o"
|
||||
#endif
|
||||
@ -180,6 +182,8 @@ struct language_function GTY(())
|
||||
#define LANG_HOOKS_TYPE_FOR_MODE java_type_for_mode
|
||||
#undef LANG_HOOKS_TYPE_FOR_SIZE
|
||||
#define LANG_HOOKS_TYPE_FOR_SIZE java_type_for_size
|
||||
#undef LANG_HOOKS_CLASSIFY_RECORD
|
||||
#define LANG_HOOKS_CLASSIFY_RECORD java_classify_record
|
||||
|
||||
#undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN
|
||||
#define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN java_dump_tree
|
||||
@ -955,4 +959,16 @@ java_clear_binding_stack (void)
|
||||
poplevel (0, 0, 0);
|
||||
}
|
||||
|
||||
static enum classify_record
|
||||
java_classify_record (tree type)
|
||||
{
|
||||
if (! CLASS_P (type))
|
||||
return RECORD_IS_STRUCT;
|
||||
|
||||
if (CLASS_INTERFACE (TYPE_NAME (type)))
|
||||
return RECORD_IS_INTERFACE;
|
||||
|
||||
return RECORD_IS_CLASS;
|
||||
}
|
||||
|
||||
#include "gt-java-lang.h"
|
||||
|
@ -172,6 +172,7 @@ extern tree lhd_make_node (enum tree_code);
|
||||
/* Types hooks. There are no reasonable defaults for most of them,
|
||||
so we create a compile-time error instead. */
|
||||
#define LANG_HOOKS_MAKE_TYPE lhd_make_node
|
||||
#define LANG_HOOKS_CLASSIFY_RECORD NULL
|
||||
#define LANG_HOOKS_INCOMPLETE_TYPE_ERROR lhd_incomplete_type_error
|
||||
#define LANG_HOOKS_GENERIC_TYPE_P hook_bool_const_tree_false
|
||||
#define LANG_HOOKS_TYPE_PROMOTES_TO lhd_type_promotes_to
|
||||
@ -185,6 +186,7 @@ extern tree lhd_make_node (enum tree_code);
|
||||
|
||||
#define LANG_HOOKS_FOR_TYPES_INITIALIZER { \
|
||||
LANG_HOOKS_MAKE_TYPE, \
|
||||
LANG_HOOKS_CLASSIFY_RECORD, \
|
||||
LANG_HOOKS_TYPE_FOR_MODE, \
|
||||
LANG_HOOKS_TYPE_FOR_SIZE, \
|
||||
LANG_HOOKS_GENERIC_TYPE_P, \
|
||||
|
@ -33,6 +33,9 @@ struct array_descr_info;
|
||||
/* A print hook for print_tree (). */
|
||||
typedef void (*lang_print_tree_hook) (FILE *, tree, int indent);
|
||||
|
||||
enum classify_record
|
||||
{ RECORD_IS_STRUCT, RECORD_IS_CLASS, RECORD_IS_INTERFACE };
|
||||
|
||||
/* The following hooks are documented in langhooks.c. Must not be
|
||||
NULL. */
|
||||
|
||||
@ -91,6 +94,11 @@ struct lang_hooks_for_types
|
||||
language-specific processing is required. */
|
||||
tree (*make_type) (enum tree_code);
|
||||
|
||||
/* Return what kind of RECORD_TYPE this is, mainly for purposes of
|
||||
debug information. If not defined, record types are assumed to
|
||||
be structures. */
|
||||
enum classify_record (*classify_record) (tree);
|
||||
|
||||
/* Given MODE and UNSIGNEDP, return a suitable type-tree with that
|
||||
mode. */
|
||||
tree (*type_for_mode) (enum machine_mode, int);
|
||||
|
Loading…
Reference in New Issue
Block a user