aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2007-12-15 20:19:23 +0000
committerAlexandre Oliva <aoliva@redhat.com>2007-12-15 20:19:23 +0000
commit77e64b80b2bccbc6da73d2c7b719abcf999da4b3 (patch)
tree3eeee76c583d6b37c1e438a4ff1bf07b0dc61918
parente795a3d92ee96fdcf1e992710ee91139bb509e7c (diff)
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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@130960 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/cp-lang.c12
-rw-r--r--gcc/dwarf2out.c52
-rw-r--r--gcc/java/ChangeLog6
-rw-r--r--gcc/java/lang.c16
-rw-r--r--gcc/langhooks-def.h2
-rw-r--r--gcc/langhooks.h8
8 files changed, 113 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0bebee04a79..51d18107ac7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,20 @@
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.
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index f8df2b23919..eaa9ff21521 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/cp-lang.c b/gcc/cp/cp-lang.c
index b4b7ec40eb9..70709298e9a 100644
--- a/gcc/cp/cp-lang.c
+++ b/gcc/cp/cp-lang.c
@@ -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)
{
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index a0df24c4461..6c7f75a251d 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -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:
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 354a25700a6..52e9da18a96 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -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++
diff --git a/gcc/java/lang.c b/gcc/java/lang.c
index 42589062077..0b98bf55e75 100644
--- a/gcc/java/lang.c
+++ b/gcc/java/lang.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"
diff --git a/gcc/langhooks-def.h b/gcc/langhooks-def.h
index 91357638622..fd5f474cc1e 100644
--- a/gcc/langhooks-def.h
+++ b/gcc/langhooks-def.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, \
diff --git a/gcc/langhooks.h b/gcc/langhooks.h
index 0b97f26cabe..bbbcc6808c0 100644
--- a/gcc/langhooks.h
+++ b/gcc/langhooks.h
@@ -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);