aboutsummaryrefslogtreecommitdiff
path: root/gdb/linespec.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2025-01-07 18:29:39 -0700
committerTom Tromey <tom@tromey.com>2025-01-11 11:21:59 -0700
commit018f177b39f728a9698f197a143556106b7046ff (patch)
treefac0ef4580397de87a9d7db7257bfcee6c6ac595 /gdb/linespec.c
parente8c3cdc7a3948c6ff1e98a5a187287ff552b79f7 (diff)
downloadgdb-018f177b39f728a9698f197a143556106b7046ff.zip
gdb-018f177b39f728a9698f197a143556106b7046ff.tar.gz
gdb-018f177b39f728a9698f197a143556106b7046ff.tar.bz2
Hoist lambda in linespec.c:add_matching_symbols_to_info
I noticed that two parts of linespec.c:add_matching_symbols_to_info use the same lambda, and hoisting this seems slightly more efficient. Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/linespec.c')
-rw-r--r--gdb/linespec.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gdb/linespec.c b/gdb/linespec.c
index db97943..eb27cb7 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -4250,6 +4250,11 @@ add_matching_symbols_to_info (const char *name,
{
lookup_name_info lookup_name (name, name_match_type);
+ auto add_symbol = [&] (block_symbol *bsym)
+ {
+ return info->add_symbol (bsym);
+ };
+
for (const auto &elt : *info->file_symtabs)
{
if (elt == nullptr)
@@ -4257,8 +4262,7 @@ add_matching_symbols_to_info (const char *name,
iterate_over_all_matching_symtabs (info->state, lookup_name,
domain_search_flags,
pspace, true,
- [&] (block_symbol *bsym)
- { return info->add_symbol (bsym); });
+ add_symbol);
search_minsyms_for_name (info, lookup_name, pspace, NULL);
}
else if (pspace == NULL || pspace == elt->compunit ()->objfile ()->pspace ())
@@ -4270,9 +4274,7 @@ add_matching_symbols_to_info (const char *name,
program_space *elt_pspace = elt->compunit ()->objfile ()->pspace ();
gdb_assert (!elt_pspace->executing_startup);
set_current_program_space (elt_pspace);
- iterate_over_file_blocks (elt, lookup_name, SEARCH_VFT,
- [&] (block_symbol *bsym)
- { return info->add_symbol (bsym); });
+ iterate_over_file_blocks (elt, lookup_name, SEARCH_VFT, add_symbol);
/* If no new symbols were found in this iteration and this symtab
is in assembler, we might actually be looking for a label for