diff options
author | Pedro Alves <palves@redhat.com> | 2020-05-24 13:32:25 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2020-05-24 13:32:25 +0100 |
commit | e08bd6c5081f4957ddb60117ac94775dcd618db7 (patch) | |
tree | 816111736ca11d83497d4505c9510fc892bdbfd0 /gdb/symtab.c | |
parent | bb68f22c8e648032a0d1c1d17353eec599ff5e6a (diff) | |
download | gdb-e08bd6c5081f4957ddb60117ac94775dcd618db7.zip gdb-e08bd6c5081f4957ddb60117ac94775dcd618db7.tar.gz gdb-e08bd6c5081f4957ddb60117ac94775dcd618db7.tar.bz2 |
Don't remove C++ aliases from completions if symbol doesn't match
completion_list_add_symbol currently tries to remove C++ function
aliases from the completions match list even if the symbol passed down
wasn't successfully added to the completion list because it didn't
match. I.e., we call cp_canonicalize_string_no_typedefs for each and
every C++ function in the program, which is useful work. This patch
skips that useless work.
gdb/ChangeLog:
2020-05-24 Pedro Alves <palves@redhat.com>
* symtab.c (completion_list_add_name): Return boolean indication
of whether the symbol matched.
(completion_list_add_symbol): Don't try to remove C++ aliases if
the symbol didn't match in the first place.
* symtab.h (completion_list_add_name): Return bool.
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r-- | gdb/symtab.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c index 3f90ea9..5c4e282 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -5260,7 +5260,7 @@ compare_symbol_name (const char *symbol_name, language symbol_language, /* See symtab.h. */ -void +bool completion_list_add_name (completion_tracker &tracker, language symbol_language, const char *symname, @@ -5272,7 +5272,7 @@ completion_list_add_name (completion_tracker &tracker, /* Clip symbols that cannot match. */ if (!compare_symbol_name (symname, symbol_language, lookup_name, match_res)) - return; + return false; /* Refresh SYMNAME from the match string. It's potentially different depending on language. (E.g., on Ada, the match may be @@ -5296,6 +5296,8 @@ completion_list_add_name (completion_tracker &tracker, tracker.add_completion (std::move (completion), &match_res.match_for_lcd, text, word); } + + return true; } /* completion_list_add_name wrapper for struct symbol. */ @@ -5306,9 +5308,10 @@ completion_list_add_symbol (completion_tracker &tracker, const lookup_name_info &lookup_name, const char *text, const char *word) { - completion_list_add_name (tracker, sym->language (), - sym->natural_name (), - lookup_name, text, word); + if (!completion_list_add_name (tracker, sym->language (), + sym->natural_name (), + lookup_name, text, word)) + return; /* C++ function symbols include the parameters within both the msymbol name and the symbol name. The problem is that the msymbol name will |