Use htab_up in dwarf2/read.c
authorTom Tromey <tom@tromey.com>
Thu, 17 Sep 2020 17:47:50 +0000 (11:47 -0600)
committerTom Tromey <tom@tromey.com>
Thu, 17 Sep 2020 17:58:56 +0000 (11:58 -0600)
This changes dwarf2/read.c to use htab_up rather than explicit calls
to htab_delete.

gdb/ChangeLog
2020-09-17  Tom Tromey  <tom@tromey.com>

* dwarf2/read.c (compute_compunit_symtab_includes): Use htab_up.

gdb/ChangeLog
gdb/dwarf2/read.c

index b7e93c127ba45b7c68279bfe15fddcc120ec362a..3c8e4a1c5ea8cc2ff9b99bb021d851ca2bf1c7ce 100644 (file)
@@ -1,3 +1,7 @@
+2020-09-17  Tom Tromey  <tom@tromey.com>
+
+       * dwarf2/read.c (compute_compunit_symtab_includes): Use htab_up.
+
 2020-09-17  Tom Tromey  <tom@tromey.com>
 
        * value.c (preserve_values): Update.
index 33292b6ce22493171cbeb4581450617059fbd4a8..8cd1ace9714da816e95b1cd7e7466aa9081aae1d 100644 (file)
@@ -9857,23 +9857,24 @@ compute_compunit_symtab_includes (dwarf2_per_cu_data *per_cu,
     {
       int len;
       std::vector<compunit_symtab *> result_symtabs;
-      htab_t all_children, all_type_symtabs;
       compunit_symtab *cust = per_objfile->get_symtab (per_cu);
 
       /* If we don't have a symtab, we can just skip this case.  */
       if (cust == NULL)
        return;
 
-      all_children = htab_create_alloc (1, htab_hash_pointer, htab_eq_pointer,
-                                       NULL, xcalloc, xfree);
-      all_type_symtabs = htab_create_alloc (1, htab_hash_pointer, htab_eq_pointer,
-                                           NULL, xcalloc, xfree);
+      htab_up all_children (htab_create_alloc (1, htab_hash_pointer,
+                                              htab_eq_pointer,
+                                              NULL, xcalloc, xfree));
+      htab_up all_type_symtabs (htab_create_alloc (1, htab_hash_pointer,
+                                                  htab_eq_pointer,
+                                                  NULL, xcalloc, xfree));
 
       for (dwarf2_per_cu_data *ptr : *per_cu->imported_symtabs)
        {
-         recursively_compute_inclusions (&result_symtabs, all_children,
-                                         all_type_symtabs, ptr, per_objfile,
-                                         cust);
+         recursively_compute_inclusions (&result_symtabs, all_children.get (),
+                                         all_type_symtabs.get (), ptr,
+                                         per_objfile, cust);
        }
 
       /* Now we have a transitive closure of all the included symtabs.  */
@@ -9884,9 +9885,6 @@ compute_compunit_symtab_includes (dwarf2_per_cu_data *per_cu,
       memcpy (cust->includes, result_symtabs.data (),
              len * sizeof (compunit_symtab *));
       cust->includes[len] = NULL;
-
-      htab_delete (all_children);
-      htab_delete (all_type_symtabs);
     }
 }