diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-06-01 11:46:54 +0100 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-06-17 09:25:09 +0100 |
commit | c9debfb97e052c32cf0308157cae529ce2059f48 (patch) | |
tree | b1aa4df0a0b049c766e6b29eac377655ed77adbd /gdb/minsyms.c | |
parent | 9a49ad8c522a1ce83645d477bf6ced574c3bf651 (diff) | |
download | gdb-c9debfb97e052c32cf0308157cae529ce2059f48.zip gdb-c9debfb97e052c32cf0308157cae529ce2059f48.tar.gz gdb-c9debfb97e052c32cf0308157cae529ce2059f48.tar.bz2 |
gdb: Convert language la_get_symbol_name_matcher field to a method
This commit changes the language_data::la_get_symbol_name_matcher
function pointer member variable into a member function of
language_defn.
There should be no user visible changes after this commit.
Before this commit access to the la_get_symbol_name_matcher function
pointer was through the get_symbol_name_matcher function, which looked
something like this (is pseudo-code):
<return-type>
get_symbol_name_matcher (language_defn *lang, <other args>)
{
if (current_language == ada)
current_language->la_get_symbol_name_matcher (<other args>);
else
lang->la_get_symbol_name_matcher (<other args>);
}
In this commit I moved the get_symbol_name_matcher as a non-virtual
function in the language_defn base class, I then add a new virtual
method that is only used from within get_symbol_name_matcher, this can
then be overridden by specific languages as needed. So we now have:
class language_defn
{
<return-type> get_symbol_name_matcher (<args>)
{
if (current_language == ada)
return current_language->get_symbol_name_matcher_inner (<args>);
else
return this->get_symbol_name_matcher_inner (<args>);
}
virtual <return-type> get_symbol_name_matcher_inner (<args>)
{
....
}
}
gdb/ChangeLog:
* ada-lang.c (ada_get_symbol_name_matcher): Update header comment.
(ada_language_data): Delete la_get_symbol_name_matcher
initializer.
(language_defn::get_symbol_name_matcher_inner): New member
function.
* c-lang.c (c_language_data): Delete la_get_symbol_name_matcher
initializer.
(cplus_language_data): Likewise.
(cplus_language::get_symbol_name_matcher_inner): New member
function.
(asm_language_data): Delete la_get_symbol_name_matcher initializer.
(minimal_language_data): Likewise.
* cp-support.h (cp_get_symbol_name_matcher): Update header comment.
* d-lang.c (d_language_data): Delete la_get_symbol_name_matcher
initializer.
* dictionary.c (iter_match_first_hashed): Update call to
get_symbol_name_matcher.
(iter_match_next_hashed): Likewise.
(iter_match_next_linear): Likewise.
* dwarf2/read.c (dw2_expand_symtabs_matching_symbol): Likewise.
* f-lang.c (f_language_data): Delete la_get_symbol_name_matcher
initializer.
(f_language::get_symbol_name_matcher_inner): New member function.
* go-lang.c (go_language_data): Delete la_get_symbol_name_matcher
initializer.
* language.c (default_symbol_name_matcher): Update header comment,
make static.
(language_defn::get_symbol_name_matcher): New definition.
(language_defn::get_symbol_name_matcher_inner): Likewise.
(get_symbol_name_matcher): Delete.
(unknown_language_data): Delete la_get_symbol_name_matcher
initializer.
(auto_language_data): Likewise.
* language.h (language_data): Delete la_get_symbol_name_matcher
field.
(language_defn::get_symbol_name_matcher): New member function.
(language_defn::get_symbol_name_matcher_inner): Likewise.
(default_symbol_name_matcher): Delete declaration.
* linespec.c (find_methods): Update call to
get_symbol_name_matcher.
* m2-lang.c (m2_language_data): Delete la_get_symbol_name_matcher
initializer.
* minsyms.c (lookup_minimal_symbol): Update call to
get_symbol_name_matcher.
(iterate_over_minimal_symbols): Likewise.
* objc-lang.c (objc_language_data): Delete
la_get_symbol_name_matcher initializer.
* opencl-lang.c (opencl_language_data): Likewise.
* p-lang.c (pascal_language_data): Likewise.
* psymtab.c (psymbol_name_matches): Update call to
get_symbol_name_matcher.
* rust-lang.c (rust_language_data): Delete
la_get_symbol_name_matcher initializer.
* symtab.c (symbol_matches_search_name): Update call to
get_symbol_name_matcher.
(compare_symbol_name): Likewise.
Diffstat (limited to 'gdb/minsyms.c')
-rw-r--r-- | gdb/minsyms.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 47c6f0b..f4a2544 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -363,8 +363,8 @@ lookup_minimal_symbol (const char *name, const char *sfile, % MINIMAL_SYMBOL_HASH_SIZE); symbol_name_matcher_ftype *match - = get_symbol_name_matcher (language_def (lang), - lookup_name); + = language_def (lang)->get_symbol_name_matcher + (lookup_name); struct minimal_symbol **msymbol_demangled_hash = objfile->per_bfd->msymbol_demangled_hash; @@ -507,7 +507,7 @@ iterate_over_minimal_symbols enum language lang = (enum language) liter; const language_defn *lang_def = language_def (lang); symbol_name_matcher_ftype *name_match - = get_symbol_name_matcher (lang_def, lookup_name); + = lang_def->get_symbol_name_matcher (lookup_name); unsigned int hash = lookup_name.search_name_hash (lang) % MINIMAL_SYMBOL_HASH_SIZE; |