]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR debug/51950 (fdebug-types-section regression for member pointers)
authorJakub Jelinek <jakub@redhat.com>
Tue, 14 Feb 2012 23:35:15 +0000 (00:35 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 14 Feb 2012 23:35:15 +0000 (00:35 +0100)
Backported from mainline
2012-02-14  Jakub Jelinek  <jakub@redhat.com>

PR debug/51950
* dwarf2out.c (clone_tree_hash): New function.
(copy_decls_walk): Use it instead of clone_tree.

From-SVN: r184243

gcc/ChangeLog
gcc/dwarf2out.c

index e458e08ac4eb2939e774d621bf759e2376f97b85..b2a34e78e24274de23baeb0c8ee3f698b24f6f88 100644 (file)
@@ -3,6 +3,10 @@
        Backported from mainline
        2012-02-14  Jakub Jelinek  <jakub@redhat.com>
 
+       PR debug/51950
+       * dwarf2out.c (clone_tree_hash): New function.
+       (copy_decls_walk): Use it instead of clone_tree.
+
        PR c/52181
        * c-decl.c (merge_decls): Copy DECL_USER_ALIGN bit from olddecl to
        newdecl.
index 1860af92f48d355d73082a583ce2a4b26ff88e07..1ed3d5ad5d96d5a7e6c1e00f87a5fad5ed5f2392 100644 (file)
@@ -10410,6 +10410,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).  */
@@ -10446,7 +10472,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.  */