Move lookup_name_info creation into basic_lookup_transparent_type

I noticed that basic_lookup_transparent_type calls two different
functions that both proceed to create a lookup_name_info.  It's more
efficient to create this object in the outermost layer possible.
Making this change required a few related changes, resulting in this
patch.

There are still more changes of this sort that could be made.

Regression tested on x86-64 Fedora 38.
This commit is contained in:
Tom Tromey
2024-01-25 11:17:24 -07:00
parent 7921285b6c
commit e70d6457a6
7 changed files with 46 additions and 45 deletions

View File

@@ -240,7 +240,7 @@ objfile::map_symtabs_matching_filename
}
struct compunit_symtab *
objfile::lookup_symbol (block_enum kind, const char *name,
objfile::lookup_symbol (block_enum kind, const lookup_name_info &name,
domain_search_flags domain)
{
struct compunit_symtab *retval = nullptr;
@@ -248,18 +248,16 @@ objfile::lookup_symbol (block_enum kind, const char *name,
if (debug_symfile)
gdb_printf (gdb_stdlog,
"qf->lookup_symbol (%s, %d, \"%s\", %s)\n",
objfile_debug_name (this), kind, name,
objfile_debug_name (this), kind, name.c_str (),
domain_name (domain).c_str ());
lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
auto search_one_symtab = [&] (compunit_symtab *stab)
{
struct symbol *sym, *with_opaque = NULL;
const struct blockvector *bv = stab->blockvector ();
const struct block *block = bv->block (kind);
sym = block_find_symbol (block, lookup_name, domain, &with_opaque);
sym = block_find_symbol (block, name, domain, &with_opaque);
/* Some caution must be observed with overloaded functions
and methods, since the index will not contain any overload
@@ -282,7 +280,7 @@ objfile::lookup_symbol (block_enum kind, const char *name,
{
if (!iter->expand_symtabs_matching (this,
nullptr,
&lookup_name,
&name,
nullptr,
search_one_symtab,
kind == GLOBAL_BLOCK