Simplify per-BFD storage management

There's no reason that the objfile_per_bfd_storage must be allocated
via bfd_alloc.  This patch changes objfile_per_bfd_storage to be
managed more simply, via ordinary new and delete; and moves some code
into its (new) destructor.

While doing this I also noticed an extra initialization of
language_of_main, and removed it.

gdb/ChangeLog
2019-03-15  Tom Tromey  <tom@tromey.com>

	* objfiles.h (struct objfile_per_bfd_storage): Declare
	destructor.
	* objfiles.c (objfile_per_bfd_storage::~objfile_per_bfd_storage):
	New.
	(get_objfile_bfd_data): Use new.  Don't initialize
	language_of_main.
	(free_objfile_per_bfd_storage): Remove.
	(objfile_bfd_data_free, objfile::~objfile): Use delete.
This commit is contained in:
Tom Tromey 2019-03-02 12:11:26 -07:00
parent 741d7538b7
commit d6797f465c
3 changed files with 27 additions and 32 deletions

View file

@ -235,6 +235,8 @@ struct objfile_per_bfd_storage
: minsyms_read (false)
{}
~objfile_per_bfd_storage ();
/* The storage has an obstack of its own. */
auto_obstack storage_obstack;