diff options
author | Tom Tromey <tom@tromey.com> | 2016-11-20 13:20:32 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-01-10 19:14:08 -0700 |
commit | fc4007c969ec4208fb7c7cee2f50211a9aa0f40f (patch) | |
tree | 124c95351da6ad220406cd45875c72043259440d /gdb/compile | |
parent | 8dbcee674ea4a8daa55f880ad7ade96efca96951 (diff) | |
download | gdb-fc4007c969ec4208fb7c7cee2f50211a9aa0f40f.zip gdb-fc4007c969ec4208fb7c7cee2f50211a9aa0f40f.tar.gz gdb-fc4007c969ec4208fb7c7cee2f50211a9aa0f40f.tar.bz2 |
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 <tom@tromey.com>
* 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.
Diffstat (limited to 'gdb/compile')
-rw-r--r-- | gdb/compile/compile-c-symbols.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c index 01e253f..6010006 100644 --- a/gdb/compile/compile-c-symbols.c +++ b/gdb/compile/compile-c-symbols.c @@ -724,8 +724,7 @@ generate_c_for_variable_locations (struct compile_c_instance *compiler, const struct block *block, CORE_ADDR pc) { - struct cleanup *cleanup, *outer; - htab_t symhash; + struct cleanup *outer; const struct block *static_block = block_static_block (block); unsigned char *registers_used; @@ -739,9 +738,8 @@ generate_c_for_variable_locations (struct compile_c_instance *compiler, /* Ensure that a given name is only entered once. This reflects the reality of shadowing. */ - symhash = htab_create_alloc (1, hash_symname, eq_symname, NULL, - xcalloc, xfree); - cleanup = make_cleanup_htab_delete (symhash); + htab_up symhash (htab_create_alloc (1, hash_symname, eq_symname, NULL, + xcalloc, xfree)); while (1) { @@ -754,7 +752,7 @@ generate_c_for_variable_locations (struct compile_c_instance *compiler, sym != NULL; sym = block_iterator_next (&iter)) { - if (!symbol_seen (symhash, sym)) + if (!symbol_seen (symhash.get (), sym)) generate_c_for_for_one_variable (compiler, stream, gdbarch, registers_used, pc, sym); } @@ -766,7 +764,6 @@ generate_c_for_variable_locations (struct compile_c_instance *compiler, block = BLOCK_SUPERBLOCK (block); } - do_cleanups (cleanup); discard_cleanups (outer); return registers_used; } |