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

@@ -421,6 +421,10 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
lookup_name_info func_matcher (GCC_FE_WRAPPER_FUNCTION,
symbol_name_match_type::SEARCH_NAME);
lookup_name_info i_val_matcher (COMPILE_I_EXPR_VAL,
symbol_name_match_type::SEARCH_NAME);
lookup_name_info i_ptr_matcher (COMPILE_I_EXPR_PTR_TYPE,
symbol_name_match_type::SEARCH_NAME);
bv = func_sym->symtab ()->compunit ()->blockvector ();
nblocks = bv->num_blocks ();
@@ -434,10 +438,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
block = bv->block (block_loop);
if (block->function () != NULL)
continue;
gdb_val_sym = block_lookup_symbol (block,
COMPILE_I_EXPR_VAL,
symbol_name_match_type::SEARCH_NAME,
SEARCH_VFT);
gdb_val_sym = block_lookup_symbol (block, i_val_matcher, SEARCH_VFT);
if (gdb_val_sym == NULL)
continue;
@@ -461,9 +462,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
gdb_type = gdb_val_sym->type ();
gdb_type = check_typedef (gdb_type);
gdb_ptr_type_sym = block_lookup_symbol (block, COMPILE_I_EXPR_PTR_TYPE,
symbol_name_match_type::SEARCH_NAME,
SEARCH_VFT);
gdb_ptr_type_sym = block_lookup_symbol (block, i_ptr_matcher, SEARCH_VFT);
if (gdb_ptr_type_sym == NULL)
error (_("No \"%s\" symbol found"), COMPILE_I_EXPR_PTR_TYPE);
gdb_ptr_type = gdb_ptr_type_sym->type ();