From fc4007c969ec4208fb7c7cee2f50211a9aa0f40f Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 20 Nov 2016 13:20:32 -0700 Subject: Remove make_cleanup_htab_delete This removes make_cleanup_htab_delete in favor of destructors, building on an earlier patch that added the htab_up typedef. Testing revealed that more cleanup-removal work was needed in dwarf2loc.c, so this version of the patch changes code there to use unordered_set and vector, removing some more cleanups. 2017-01-10 Tom Tromey * utils.h (make_cleanup_htab_delete): Don't declare. * utils.c (do_htab_delete_cleanup, make_cleanup_htab_delete): Remove. * linespec.c (decode_compound_collector): Add constructor, destructor. (lookup_prefix_sym): Remove cleanup. (symtab_collector): Add constructor, destructor. (collect_symtabs_from_filename): Remove cleanup. * disasm.c (do_mixed_source_and_assembly): Use htab_up. * compile/compile-c-symbols.c (generate_c_for_variable_locations): Use htab_up. * gnu-v3-abi.c (gnuv3_print_vtable): Use htab_up. * dwarf2read.c (dw2_expand_symtabs_matching) (dw2_map_symbol_filenames, dwarf_decode_macros) (write_psymtabs_to_index): Use htab_up. * dwarf2loc.c (func_verify_no_selftailcall) (call_site_find_chain_1, func_verify_no_selftailcall) (chain_candidate, call_site_find_chain_1): Use std::unordered_set, std::vector, gdb::unique_xmalloc_ptr. (call_sitep): Remove typedef. (dwarf2_locexpr_baton_eval): Remove unused variable. --- gdb/gnu-v3-abi.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'gdb/gnu-v3-abi.c') diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index ea21bed..6c7f35b 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -940,7 +940,6 @@ gnuv3_print_vtable (struct value *value) struct type *type; struct value *vtable; struct value_print_options opts; - htab_t offset_hash; struct cleanup *cleanup; VEC (value_and_voffset_p) *result_vec = NULL; struct value_and_voffset *iter; @@ -976,13 +975,12 @@ gnuv3_print_vtable (struct value *value) return; } - offset_hash = htab_create_alloc (1, hash_value_and_voffset, - eq_value_and_voffset, - xfree, xcalloc, xfree); - cleanup = make_cleanup_htab_delete (offset_hash); - make_cleanup (VEC_cleanup (value_and_voffset_p), &result_vec); + htab_up offset_hash (htab_create_alloc (1, hash_value_and_voffset, + eq_value_and_voffset, + xfree, xcalloc, xfree)); + cleanup = make_cleanup (VEC_cleanup (value_and_voffset_p), &result_vec); - compute_vtable_size (offset_hash, &result_vec, value); + compute_vtable_size (offset_hash.get (), &result_vec, value); qsort (VEC_address (value_and_voffset_p, result_vec), VEC_length (value_and_voffset_p, result_vec), -- cgit v1.1