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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130960
138bc75d-0d04-0410-961f-
82ee72b054a4
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
initializers just because of debug information.
* tree.h (TREE_ASM_WRITTEN): Document use for STRING_CSTs.
+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
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. */
#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
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)
{
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:
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:
{
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:
{
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));
}
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. */
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)
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:
+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++
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
#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
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"
/* 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
#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, \
/* 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. */
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);