Use gdb::function_view in addrmap_foreach
authorTom Tromey <tom@tromey.com>
Fri, 25 Jun 2021 14:40:37 +0000 (08:40 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 25 Jun 2021 14:40:37 +0000 (08:40 -0600)
commit50a6759f0f541ea965c7330bfbfe335cb8d66af8
tree5f7add1207929170a7fcc2effc07c3e25335065d
parent67470e9d8be180344494635dcef34e054938bfb8
Use gdb::function_view in addrmap_foreach

While working on the DWARF psymtab replacement, I needed
addrmap_foreach to accept a gdb::function_view.  This seemed like a
worthwhile change on its own, so I've written it separately for
submission.

Regression tested on x86-64 Fedora 32.

gdb/ChangeLog
2021-06-25  Tom Tromey  <tom@tromey.com>

* dwarf2/index-write.c (struct addrmap_index_data): Add
initializers.
<operator()>: Declare.
(addrmap_index_data::operator()): Rename from
add_address_entry_worker.  Remove 'datap' parameter.
(write_address_map): Update.
* psymtab.c (struct dump_psymtab_addrmap_data): Remove
(dump_psymtab_addrmap_1): Remove 'data' parameter, add other
parameters.
(dump_psymtab_addrmap): Update.
* addrmap.c (struct addrmap_funcs) <foreach>: Remove 'data'
parameter.
(addrmap_foreach, addrmap_fixed_foreach): Likewise.
(struct mutable_foreach_data): Remove.
(addrmap_mutable_foreach_worker): Update.
(addrmap_mutable_foreach): Remove 'data' parameter.
* addrmap.h (addrmap_foreach_fn): Use gdb::function_view.
(addrmap_foreach): Remove 'data' parameter.
gdb/ChangeLog
gdb/addrmap.c
gdb/addrmap.h
gdb/dwarf2/index-write.c
gdb/psymtab.c