dwarf2read: C++ify dwo_file
authorSimon Marchi <simon.marchi@polymtl.ca>
Fri, 21 Jun 2019 18:10:14 +0000 (14:10 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Fri, 21 Jun 2019 18:10:14 +0000 (14:10 -0400)
commit51ac9db596ea9f0affa9f7db25bb179cf70beac4
treeca356b2b22e29b2f5d11378de8d084cf9c24853b
parentdc4ccb6f7f07e41616fd42625226229f0795d198
dwarf2read: C++ify dwo_file

This patch changes dwo_file to be allocated/deallocated with new/delete,
so that we can start using C++ features in it, and in struct
dwo_sections.

The free_dwo_file function becomes the destructor of struct dwo_file
(and will disappear in upcoming patches, which will use gdb_bfd_ref_ptr
for dbfd and an std::vector for sections.types).

gdb/ChangeLog:

* dwarf2read.h (struct dwarf2_per_objfile) <dwo_files>: Change
type to htab_up.
* dwarf2read.c (struct dwo_file): Initialize fields.
<~dwo_file>: New.
(free_dwo_file): Remove, move content to ~dwo_file.
(struct dwo_file_deleter): Remove.
(dwo_file_up>: Remove custom deleter.
(free_dwo_files): Remove.
(dwarf2_per_objfile::~dwarf2_per_objfile): Don't explicitly free
dwo_files.
(process_skeletonless_type_units): Call unique_ptr::get.
(allocate_dwo_file_hash_table): Add deleter to created hash
table.  Change return type to htab_up.
(lookup_dwo_file_slot): Don't memset dwo_file, call
unique_ptr::get.
(create_dwo_unit_in_dwp_v1): Allocate dwo_file with new.
(create_dwo_unit_in_dwp_v2): Likewise.
(open_and_init_dwo_file): Likewise.
(free_dwo_file_from_slot): Remove.
gdb/ChangeLog
gdb/dwarf2read.c
gdb/dwarf2read.h