summaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2012-02-14 20:40:10 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2012-02-14 20:40:10 +0100
commita85ce59dda4eb5547d9614909e1fcebf0a7add3f (patch)
treee83d2f0949a0a43c2da5dcf2515535b1adb0b8b2 /gcc/dwarf2out.c
parent317ea7c0f44135b03b5dc1827532004ef86d72e0 (diff)
downloadgcc-a85ce59dda4eb5547d9614909e1fcebf0a7add3f.tar.gz
re PR debug/51950 (fdebug-types-section regression for member pointers)
PR debug/51950 * dwarf2out.c (clone_tree_hash): New function. (copy_decls_walk): Use it instead of clone_tree. From-SVN: r184224
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index f710239be9e..d6fbce6771c 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -7407,6 +7407,32 @@ copy_ancestor_tree (dw_die_ref unit, dw_die_ref die, htab_t decl_table)
return copy;
}
+/* Like clone_tree, but additionally enter all the children into
+ the hash table decl_table. */
+
+static dw_die_ref
+clone_tree_hash (dw_die_ref die, htab_t decl_table)
+{
+ dw_die_ref c;
+ dw_die_ref clone = clone_die (die);
+ struct decl_table_entry *entry;
+ void **slot = htab_find_slot_with_hash (decl_table, die,
+ htab_hash_pointer (die), INSERT);
+ /* Assert that DIE isn't in the hash table yet. If it would be there
+ before, the ancestors would be necessarily there as well, therefore
+ clone_tree_hash wouldn't be called. */
+ gcc_assert (*slot == HTAB_EMPTY_ENTRY);
+ entry = XCNEW (struct decl_table_entry);
+ entry->orig = die;
+ entry->copy = clone;
+ *slot = entry;
+
+ FOR_EACH_CHILD (die, c,
+ add_child_die (clone, clone_tree_hash (c, decl_table)));
+
+ return clone;
+}
+
/* Walk the DIE and its children, looking for references to incomplete
or trivial types that are unmarked (i.e., that are not in the current
type_unit). */
@@ -7443,7 +7469,11 @@ copy_decls_walk (dw_die_ref unit, dw_die_ref die, htab_t decl_table)
else
{
dw_die_ref parent = unit;
- dw_die_ref copy = clone_tree (targ);
+ dw_die_ref copy = clone_die (targ);
+
+ FOR_EACH_CHILD (targ, c,
+ add_child_die (copy,
+ clone_tree_hash (c, decl_table)));
/* Make sure the cloned tree is marked as part of the
type unit. */