gdb: make cooked_index_storage::get_abbrev_table_cache return a reference

It can never return nullptr, return a reference instead of a pointer.

Change-Id: Ibc6f16eb74dc16059152982600ca9f426d7f80a4
Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
Simon Marchi 2024-11-04 13:27:34 -05:00 committed by Simon Marchi
parent c9e2e9992a
commit 27f4421427
2 changed files with 4 additions and 4 deletions

View File

@ -377,8 +377,8 @@ class cooked_index_storage
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. */

View 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)