mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-25 08:47:28 +00:00
Convert ada-lang.c:map_matching_symbols
This converts ada-lang.c:map_matching_symbols to the callback approach, merging the search loop and the call to expand_symtabs_matching. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16994 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=16998 Acked-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
@@ -5509,22 +5509,22 @@ map_matching_symbols (struct objfile *objfile,
|
|||||||
match_data &data)
|
match_data &data)
|
||||||
{
|
{
|
||||||
data.objfile = objfile;
|
data.objfile = objfile;
|
||||||
|
|
||||||
|
const int block_kind = global ? GLOBAL_BLOCK : STATIC_BLOCK;
|
||||||
|
auto callback = [&] (compunit_symtab *symtab)
|
||||||
|
{
|
||||||
|
const struct block *block
|
||||||
|
= symtab->blockvector ()->block (block_kind);
|
||||||
|
return iterate_over_symbols_terminated (block, lookup_name,
|
||||||
|
domain, data);
|
||||||
|
};
|
||||||
|
|
||||||
objfile->expand_symtabs_matching (nullptr, &lookup_name,
|
objfile->expand_symtabs_matching (nullptr, &lookup_name,
|
||||||
nullptr, nullptr,
|
nullptr, callback,
|
||||||
global
|
global
|
||||||
? SEARCH_GLOBAL_BLOCK
|
? SEARCH_GLOBAL_BLOCK
|
||||||
: SEARCH_STATIC_BLOCK,
|
: SEARCH_STATIC_BLOCK,
|
||||||
domain);
|
domain);
|
||||||
|
|
||||||
const int block_kind = global ? GLOBAL_BLOCK : STATIC_BLOCK;
|
|
||||||
for (compunit_symtab *symtab : objfile->compunits ())
|
|
||||||
{
|
|
||||||
const struct block *block
|
|
||||||
= symtab->blockvector ()->block (block_kind);
|
|
||||||
if (!iterate_over_symbols_terminated (block, lookup_name,
|
|
||||||
domain, data))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add to RESULT all non-local symbols whose name and domain match
|
/* Add to RESULT all non-local symbols whose name and domain match
|
||||||
|
|||||||
Reference in New Issue
Block a user