Always use expand_symtabs_matching in ada-lang.c

The previous patch fixed the immediate performance problem with Ada
name matching, by having a subset of matches call
expand_symtabs_matching rather than expand_matching_symbols.  However,
it seemed to me that expand_matching_symbols should not be needed at
all.

To achieve this, this patch changes ada_lookup_name_info::split_name
to use the decoded name, rather than the encoded name.  In order to
make this work correctly, a new decoded form is used: one that does
not decode operators (this is already done) and also does not decode
wide characters.  The latter change is done so that changes to the Ada
source charset don't affect the DWARF index.

With this in place, we can change ada-lang.c to always use
expand_symtabs_matching rather than expand_matching_symbols.
This commit is contained in:
Tom Tromey
2023-11-10 11:58:47 -07:00
parent 47cd8fcf54
commit 957ce53750
4 changed files with 40 additions and 112 deletions

View File

@@ -263,7 +263,11 @@ gdb::unique_xmalloc_ptr<char>
cooked_index_shard::handle_gnat_encoded_entry (cooked_index_entry *entry,
htab_t gnat_entries)
{
std::string canonical = ada_decode (entry->name, false, false);
/* We decode Ada names in a particular way: operators and wide
characters are left as-is. This is done to make name matching a
bit simpler; and for wide characters, it means the choice of Ada
source charset does not affect the indexer directly. */
std::string canonical = ada_decode (entry->name, false, false, false);
if (canonical.empty ())
return {};
std::vector<std::string_view> names = split_name (canonical.c_str (),