diff options
author | Tom Tromey <tromey@adacore.com> | 2020-04-01 07:47:13 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-04-01 07:47:13 -0600 |
commit | e0802d59969339502203ad8e0d161b5f93beca73 (patch) | |
tree | 71137374b46f6d98923a95882567c7b9f2d9b46a /gdb/ChangeLog | |
parent | 8c072cb6a19abdc9d4b93c19a1d609fe1a486c32 (diff) | |
download | binutils-gdb-e0802d59969339502203ad8e0d161b5f93beca73.tar.gz |
Avoid copying in lookup_name_info
lookup_name_info always copies the name that is passed in. However,
normally a copy is not needed. This patch changes this class to avoid
copying. This required changing the "name" method to return something
else; I chose a gdb::string_view, to avoid excessive calls to strlen
in the code using the lookup_name_info. However, as this class does
not allow an arbitrary string_view, I've also added a c_str method
that guarantees a \0-terminated result -- a pedantic difference but
one that respects the string_view contract, IMO.
gdb/ChangeLog
2020-04-01 Tom Tromey <tromey@adacore.com>
* symtab.h (class lookup_name_info) <lookup_name_info>: Change
"name" parameter to rvalue reference. Initialize m_name_holder.
<lookup_name_info>: New overloads.
<name>: Return gdb::string_view.
<c_str>: New method.
<make_ignore_params>: Update.
<search_name_hash>: Update.
<language_lookup_name>: Return const char *.
<m_name>: Change type.
* symtab.c (demangle_for_lookup_info::demangle_for_lookup_info)
(demangle_for_lookup_info::demangle_for_lookup_info): Update.
(lookup_name_info::match_any): Update.
* psymtab.c (match_partial_symbol, lookup_partial_symbol):
Update.
* minsyms.c (linkage_name_str): Update.
* language.c (default_symbol_name_matcher): Update.
* dwarf2/read.c (mapped_index_base::find_name_components_bounds):
Update.
* ada-lang.c (ada_fold_name): Change parameter to string_view.
(ada_lookup_name_info::ada_lookup_name_info): Update.
(literal_symbol_name_matcher): Update.
Diffstat (limited to 'gdb/ChangeLog')
-rw-r--r-- | gdb/ChangeLog | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7c1d84c330f..8afad21c9ec 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,29 @@ 2020-04-01 Tom Tromey <tromey@adacore.com> + * symtab.h (class lookup_name_info) <lookup_name_info>: Change + "name" parameter to rvalue reference. Initialize m_name_holder. + <lookup_name_info>: New overloads. + <name>: Return gdb::string_view. + <c_str>: New method. + <make_ignore_params>: Update. + <search_name_hash>: Update. + <language_lookup_name>: Return const char *. + <m_name>: Change type. + * symtab.c (demangle_for_lookup_info::demangle_for_lookup_info) + (demangle_for_lookup_info::demangle_for_lookup_info): Update. + (lookup_name_info::match_any): Update. + * psymtab.c (match_partial_symbol, lookup_partial_symbol): + Update. + * minsyms.c (linkage_name_str): Update. + * language.c (default_symbol_name_matcher): Update. + * dwarf2/read.c (mapped_index_base::find_name_components_bounds): + Update. + * ada-lang.c (ada_fold_name): Change parameter to string_view. + (ada_lookup_name_info::ada_lookup_name_info): Update. + (literal_symbol_name_matcher): Update. + +2020-04-01 Tom Tromey <tromey@adacore.com> + * psymtab.c (psymtab_search_name): Remove function. (psym_lookup_symbol): Create search name and lookup name here. (lookup_partial_symbol): Remove "name" parameter; add |