aboutsummaryrefslogtreecommitdiff
path: root/gdb/c-lang.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-06-01 11:46:54 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-06-17 09:25:09 +0100
commitc9debfb97e052c32cf0308157cae529ce2059f48 (patch)
treeb1aa4df0a0b049c766e6b29eac377655ed77adbd /gdb/c-lang.c
parent9a49ad8c522a1ce83645d477bf6ced574c3bf651 (diff)
downloadgdb-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/c-lang.c')
-rw-r--r--gdb/c-lang.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index 9d72c0e..8edab07 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -917,7 +917,6 @@ extern const struct language_data c_language_data =
default_word_break_characters,
default_collect_symbol_completion_matches,
c_watch_location_expression,
- NULL, /* la_get_symbol_name_matcher */
&c_varobj_ops,
c_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */
@@ -1032,7 +1031,6 @@ extern const struct language_data cplus_language_data =
default_word_break_characters,
default_collect_symbol_completion_matches,
c_watch_location_expression,
- cp_get_symbol_name_matcher,
&cplus_varobj_ops,
c_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */
@@ -1184,6 +1182,16 @@ public:
{
return cp_class_name_from_physname (physname);
}
+
+protected:
+
+ /* See language.h. */
+
+ symbol_name_matcher_ftype *get_symbol_name_matcher_inner
+ (const lookup_name_info &lookup_name) const override
+ {
+ return cp_get_symbol_name_matcher (lookup_name);
+ }
};
/* The single instance of the C++ language class. */
@@ -1225,7 +1233,6 @@ extern const struct language_data asm_language_data =
default_word_break_characters,
default_collect_symbol_completion_matches,
c_watch_location_expression,
- NULL, /* la_get_symbol_name_matcher */
&default_varobj_ops,
c_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */
@@ -1295,7 +1302,6 @@ extern const struct language_data minimal_language_data =
default_word_break_characters,
default_collect_symbol_completion_matches,
c_watch_location_expression,
- NULL, /* la_get_symbol_name_matcher */
&default_varobj_ops,
c_is_string_type_p,
"{...}" /* la_struct_too_deep_ellipsis */