aboutsummaryrefslogtreecommitdiff
path: root/gdb/compile
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2024-01-25 11:17:24 -0700
committerTom Tromey <tromey@adacore.com>2024-02-15 10:16:48 -0700
commite70d6457a648c25d4382bcc030e9f5a94f3ca189 (patch)
tree3f52408d44a03e39787392ac5b5fa30abde5d029 /gdb/compile
parent7921285b6c2ba0bee9bb21d8e23fdea4c790c181 (diff)
downloadbinutils-e70d6457a648c25d4382bcc030e9f5a94f3ca189.zip
binutils-e70d6457a648c25d4382bcc030e9f5a94f3ca189.tar.gz
binutils-e70d6457a648c25d4382bcc030e9f5a94f3ca189.tar.bz2
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.
Diffstat (limited to 'gdb/compile')
-rw-r--r--gdb/compile/compile-object-load.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
index e26f0f4..33971a5 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -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 ();