C++ify dwarf2_per_objfile
authorPedro Alves <palves@redhat.com>
Mon, 17 Jul 2017 10:31:20 +0000 (11:31 +0100)
committerPedro Alves <palves@redhat.com>
Mon, 17 Jul 2017 10:31:20 +0000 (11:31 +0100)
commit330cdd98910dbd34e969f60d48688fb81c2b374a
treeb888df976db7c12ddcee0dcd3cec8956cdc585c9
parent2a925816fc3848f1d48c4783df3dd54116907a57
C++ify dwarf2_per_objfile

This makes dwarf2_per_objfile a class with cdtors.

A following patch will add a non-trivial field to struct
dwarf2_per_objfile, making dwarf2_per_objfile itself non-trivial.
Since dwarf2_per_objfile is allocated in an obstack, we need to run
its cdtors manually.

Tested on x86-64 GNU/Linux.

gdb/ChangeLog:
2017-07-17  Pedro Alves  <palves@redhat.com>

* dwarf2read.c (dwarf2_per_objfile): In-class initialize all
fields.
(dwarf2_per_objfile::dwarf2_per_objfile(objfile*, const
dwarf2_debug_sections*)): New.
(dwarf2_per_objfile::dwarf2_per_objfile(const
dwarf2_per_objfile&)): Declare as deleted.
(dwarf2_per_objfile::operator=): Declare as deleted.
(dwarf2_per_objfile::dwarf2_per_objfile)
(dwarf2_per_objfile::~dwarf2_per_objfile)
(dwarf2_per_objfile::free_cached_comp_units): New.
(dwarf2_has_info): dwarf2_per_objfile initialization code moved to
ctor.  Call dwarf2_per_objfile's ctor manually.
(dwarf2_locate_sections): Deleted/refactored as ...
(dwarf2_per_objfile::locate_sections): ... this new method.
(free_cached_comp_units): Defer to
dwarf2_per_objfile::free_cached_comp_units.
(dwarf2_free_objfile): Call dwarf2_per_objfile's dtor manually.
gdb/ChangeLog
gdb/dwarf2read.c