Simplify quick_symbol_functions::map_matching_symbols

quick_symbol_functions::map_matching_symbols is only used by the Ada
code.  Currently, it both expands certain psymtabs and then walks over
the full symtabs -- including any already-expanded ones -- calling a
callback.

It appears to work lazily as well, in that if the callback returns
false, iteration stops.  However, only the psymtab implementation does
this; the DWARF index implementations are not lazy.  It turns out,
though, that the only callback that is ever passed here never returns
false.

This patch simplifies this method by removing the callback.  The
method is also renamed.  In the new scheme, the caller is responsible
for walking the full symtabs, which removes some redundancy as well.

gdb/ChangeLog
2021-04-17  Tom Tromey  <tom@tromey.com>

	* psymtab.c (psymbol_functions::expand_matching_symbols): Rename
	from map_matching_symbols.  Change parameters.
	* psympriv.h (struct psymbol_functions) <expand_matching_symbols>:
	Rename from map_matching_symbols.  Change parameters.
	* dwarf2/read.c (struct dwarf2_gdb_index)
	<expand_matching_symbols>: Rename from map_matching_symbols.
	Change parameters.
	(struct dwarf2_debug_names_index) <expand_matching_symbols>:
	Rename from map_matching_symbols.  Change parameters.
	(dwarf2_gdb_index::expand_matching_symbols): Rename from
	dw2_map_matching_symbols.  Change parameters.
	(dwarf2_gdb_index::expand_matching_symbols): Remove old
	implementation.
	(dwarf2_debug_names_index::expand_matching_symbols): Rename from
	map_matching_symbols.  Change parameters.
	* objfiles.h (struct objfile) <expand_matching_symbols>: Rename
	from map_matching_symbols.  Change parameters.
	* symfile-debug.c (objfile::expand_matching_symbols): Rename from
	map_matching_symbols.  Change parameters.
	* ada-lang.c (map_matching_symbols): New function.
	(add_nonlocal_symbols): Update.
This commit is contained in:
Tom Tromey
2021-04-17 09:35:04 -06:00
parent 90160b5703
commit 0b7b2c2adf
8 changed files with 76 additions and 84 deletions

View File

@ -353,22 +353,21 @@ objfile::expand_symtabs_with_fullname (const char *fullname)
}
void
objfile::map_matching_symbols
objfile::expand_matching_symbols
(const lookup_name_info &name, domain_enum domain,
int global,
gdb::function_view<symbol_found_callback_ftype> callback,
symbol_compare_ftype *ordered_compare)
{
if (debug_symfile)
fprintf_filtered (gdb_stdlog,
"qf->map_matching_symbols (%s, %s, %d, %s)\n",
"qf->expand_matching_symbols (%s, %s, %d, %s)\n",
objfile_debug_name (this),
domain_name (domain), global,
host_address_to_string (ordered_compare));
for (const auto &iter : qf)
iter->map_matching_symbols (this, name, domain, global,
callback, ordered_compare);
iter->expand_matching_symbols (this, name, domain, global,
ordered_compare);
}
bool