This changes block_lookup_symbol_primary to accept a lookup_name_info.
This follows the general trend of hoisting these objects to the
outermost layer where they make sense -- somewhat reducing the cost of
using them.
---
gdb/block.c | 7 +++----
gdb/block.h | 2 +-
gdb/symtab.c | 3 ++-
3 files changed, 6 insertions(+), 6 deletions(-)
@@ -718,17 +718,16 @@ block_lookup_symbol (const struct block *block, const lookup_name_info &name,
/* See block.h. */
struct symbol *
-block_lookup_symbol_primary (const struct block *block, const char *name,
+block_lookup_symbol_primary (const struct block *block,
+ const lookup_name_info &name,
const domain_search_flags domain)
{
- lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
-
/* Verify BLOCK is STATIC_BLOCK or GLOBAL_BLOCK. */
gdb_assert (block->superblock () == NULL
|| block->superblock ()->superblock () == NULL);
symbol *other = nullptr;
- for (symbol *sym : block_iterator_range (block, &lookup_name))
+ for (symbol *sym : block_iterator_range (block, &name))
{
/* With the fix for PR gcc/debug/91507, we get for:
...
@@ -636,7 +636,7 @@ extern struct symbol *block_lookup_symbol (const struct block *block,
extern struct symbol *block_lookup_symbol_primary
(const struct block *block,
- const char *name,
+ const lookup_name_info &name,
const domain_search_flags domain);
/* Find symbol NAME in BLOCK and in DOMAIN. This will return a
@@ -2365,6 +2365,7 @@ lookup_symbol_in_objfile_symtabs (struct objfile *objfile,
block_index == GLOBAL_BLOCK ? "GLOBAL_BLOCK" : "STATIC_BLOCK",
name, domain_name (domain).c_str ());
+ lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
struct block_symbol other;
other.symbol = NULL;
for (compunit_symtab *cust : objfile->compunits ())
@@ -2375,7 +2376,7 @@ lookup_symbol_in_objfile_symtabs (struct objfile *objfile,
bv = cust->blockvector ();
block = bv->block (block_index);
- result.symbol = block_lookup_symbol_primary (block, name, domain);
+ result.symbol = block_lookup_symbol_primary (block, lookup_name, domain);
result.block = block;
if (result.symbol == NULL)
continue;