]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove dwarf2_per_bfd::m_num_psymtabs
authorTom Tromey <tom@tromey.com>
Sat, 29 May 2021 21:35:07 +0000 (15:35 -0600)
committerTom Tromey <tom@tromey.com>
Mon, 31 May 2021 01:44:05 +0000 (19:44 -0600)
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.

gdb/ChangeLog
gdb/dwarf2/read.c
gdb/dwarf2/read.h

index 03910c0634c1e55eb1a6e962bdb5ba810dac1c6d..ecec841d860eb5e601c1c8b02ee8f26c8d3b4f81 100644 (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.
index 4cc5b4f32d7a14f87b20a41879f0c427fa8ba43e..6da312413675149ac55f746e1a506f81652006d5 100644 (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;
 }
index 0bb3da5a34ab4b719305668411efeb2e0ef9a53f..07fbb36c419babfbbe5d67a05533344475315620 100644 (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,