diff options
author | Tom Tromey <tom@tromey.com> | 2023-03-30 08:41:17 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2023-09-07 12:24:21 -0600 |
commit | b7a92724c5bd926e094ede860049c1067f0584cf (patch) | |
tree | 10c7ff4050bc9e86896692ae4bf733f56ecd0316 /gdb/symtab.c | |
parent | def2803789208a617c429b5dcf2026decb25ce0c (diff) | |
download | binutils-b7a92724c5bd926e094ede860049c1067f0584cf.zip binutils-b7a92724c5bd926e094ede860049c1067f0584cf.tar.gz binutils-b7a92724c5bd926e094ede860049c1067f0584cf.tar.bz2 |
Simplify block_find_symbol
block_find_symbol takes a callback function, but only two callbacks
are ever passed to it -- and they are similar enough that it seems
cleaner to just have block_find_symbol do the work itself. Also,
block_find_symbol can take a lookup_name_info as an argument,
following the general idea of pushing the construction of these
objects as high in the call chain as feasible.
Regression tested on x86-64 Fedora 38.
Tested-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r-- | gdb/symtab.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c index 22c8b42..c0c2454 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -2679,9 +2679,10 @@ basic_lookup_transparent_type_quick (struct objfile *objfile, bv = cust->blockvector (); block = bv->block (block_index); - sym = block_find_symbol (block, name, STRUCT_DOMAIN, - block_find_non_opaque_type, NULL); - if (sym == NULL) + + lookup_name_info lookup_name (name, symbol_name_match_type::FULL); + sym = block_find_symbol (block, lookup_name, STRUCT_DOMAIN, nullptr); + if (sym == nullptr) error_in_psymtab_expansion (block_index, name, cust); gdb_assert (!TYPE_IS_OPAQUE (sym->type ())); return sym->type (); @@ -2700,13 +2701,13 @@ basic_lookup_transparent_type_1 (struct objfile *objfile, const struct block *block; const struct symbol *sym; + lookup_name_info lookup_name (name, symbol_name_match_type::FULL); for (compunit_symtab *cust : objfile->compunits ()) { bv = cust->blockvector (); block = bv->block (block_index); - sym = block_find_symbol (block, name, STRUCT_DOMAIN, - block_find_non_opaque_type, NULL); - if (sym != NULL) + sym = block_find_symbol (block, lookup_name, STRUCT_DOMAIN, nullptr); + if (sym != nullptr) { gdb_assert (!TYPE_IS_OPAQUE (sym->type ())); return sym->type (); |