]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: make `cooked_index_storage::get_abbrev_table_cache` return a reference
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 4 Nov 2024 18:27:34 +0000 (13:27 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Tue, 26 Nov 2024 03:07:03 +0000 (22:07 -0500)
It can never return nullptr, return a reference instead of a pointer.

Change-Id: Ibc6f16eb74dc16059152982600ca9f426d7f80a4
Approved-By: Tom Tromey <tom@tromey.com>
gdb/dwarf2/cooked-index.h
gdb/dwarf2/read.c

index 6f9311bd108c0010e2f24607691e6823694dc8dc..d1d81f8e2a54e34d6b5a7c671ccf0316a1fdee58 100644 (file)
@@ -377,8 +377,8 @@ public:
   DISABLE_COPY_AND_ASSIGN (cooked_index_storage);
 
   /* Return the current abbrev table_cache.  */
-  const abbrev_table_cache *get_abbrev_table_cache () const
-  { return &m_abbrev_table_cache; }
+  const abbrev_table_cache &get_abbrev_table_cache () const
+  { return m_abbrev_table_cache; }
 
   /* Return the DIE reader corresponding to PER_CU.  If no such reader
      has been registered, return NULL.  */
index b0b2b51fe5fcdc3175618a7750b90e3b99681d87..4c3f8a44442286b554d132ad3792460819f7d29a 100644 (file)
@@ -4609,7 +4609,7 @@ process_psymtab_comp_unit (dwarf2_per_cu_data *this_cu,
   if (reader == nullptr)
     {
       cutu_reader new_reader (this_cu, per_objfile, nullptr, nullptr, false,
-                             storage->get_abbrev_table_cache ());
+                             &storage->get_abbrev_table_cache ());
 
       if (new_reader.comp_unit_die == nullptr || new_reader.dummy_p)
        return;
@@ -16243,7 +16243,7 @@ cooked_indexer::ensure_cu_exists (cutu_reader *reader,
   if (result == nullptr)
     {
       cutu_reader new_reader (per_cu, per_objfile, nullptr, nullptr, false,
-                             m_index_storage->get_abbrev_table_cache ());
+                             &m_index_storage->get_abbrev_table_cache ());
 
       if (new_reader.dummy_p || new_reader.comp_unit_die == nullptr
          || !new_reader.comp_unit_die->has_children)