Remove dwarf2_per_bfd::m_num_psymtabs

Now that CUs and TUs are stored together in all_comp_units, the
m_num_psymtabs member is no longer needed -- it is always identical to
the length of the vector.  This patch removes it.

2021-05-30  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.h (struct dwarf2_per_bfd) <num_psymtabs,
	m_num_psymtabs>: Remove.
	(resize_symtabs): Update.
	* dwarf2/read.c (dwarf2_per_bfd::allocate_per_cu)
	(dwarf2_per_bfd::allocate_signatured_type): Update.
This commit is contained in:
Tom Tromey 2021-05-29 15:35:07 -06:00
parent 140c5aec0d
commit c96e8b04d3
3 changed files with 12 additions and 15 deletions

View file

@ -1,3 +1,11 @@
2021-05-30 Tom Tromey <tom@tromey.com>
* dwarf2/read.h (struct dwarf2_per_bfd) <num_psymtabs,
m_num_psymtabs>: Remove.
(resize_symtabs): Update.
* dwarf2/read.c (dwarf2_per_bfd::allocate_per_cu)
(dwarf2_per_bfd::allocate_signatured_type): Update.
2021-05-27 Simon Marchi <simon.marchi@polymtl.ca>
* Fix tab after space indentation issues throughout.

View file

@ -2288,7 +2288,7 @@ dwarf2_per_bfd::allocate_per_cu ()
{
dwarf2_per_cu_data_up result (new dwarf2_per_cu_data);
result->per_bfd = this;
result->index = m_num_psymtabs++;
result->index = all_comp_units.size ();
return result;
}
@ -2299,7 +2299,7 @@ dwarf2_per_bfd::allocate_signatured_type ()
{
std::unique_ptr<signatured_type> result (new signatured_type);
result->per_bfd = this;
result->index = m_num_psymtabs++;
result->index = all_comp_units.size ();
tu_stats.nr_tus++;
return result;
}

View file

@ -124,11 +124,6 @@ struct dwarf2_per_bfd
is allocated on the dwarf2_per_bfd obstack. */
std::unique_ptr<signatured_type> allocate_signatured_type ();
/* Return the number of partial symtabs allocated with allocate_per_cu
and allocate_signatured_type so far. */
int num_psymtabs () const
{ return m_num_psymtabs; }
private:
/* This function is mapped across the sections and remembers the
offset and size of each of the debugging sections we are
@ -249,12 +244,6 @@ public:
/* The address map that is used by the DWARF index code. */
struct addrmap *index_addrmap = nullptr;
private:
/* The total number of per_cu and signatured_type objects that have
been created so far for this reader. */
size_t m_num_psymtabs = 0;
};
/* This is the per-objfile data associated with a type_unit_group. */
@ -307,9 +296,9 @@ struct dwarf2_per_objfile
void resize_symtabs ()
{
/* The symtabs vector should only grow, not shrink. */
gdb_assert (per_bfd->num_psymtabs () >= m_symtabs.size ());
gdb_assert (per_bfd->all_comp_units.size () >= m_symtabs.size ());
m_symtabs.resize (per_bfd->num_psymtabs ());
m_symtabs.resize (per_bfd->all_comp_units.size ());
}
/* Return true if the symtab corresponding to PER_CU has been set,