From c9debfb97e052c32cf0308157cae529ce2059f48 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Mon, 1 Jun 2020 11:46:54 +0100 Subject: 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): get_symbol_name_matcher (language_defn *lang, ) { if (current_language == ada) current_language->la_get_symbol_name_matcher (); else lang->la_get_symbol_name_matcher (); } 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 { get_symbol_name_matcher () { if (current_language == ada) return current_language->get_symbol_name_matcher_inner (); else return this->get_symbol_name_matcher_inner (); } virtual get_symbol_name_matcher_inner () { .... } } 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. --- gdb/cp-support.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gdb/cp-support.h') diff --git a/gdb/cp-support.h b/gdb/cp-support.h index 7c948b2..d031ad9 100644 --- a/gdb/cp-support.h +++ b/gdb/cp-support.h @@ -127,8 +127,7 @@ extern struct type *cp_lookup_rtti_type (const char *name, "function" or "bar::function" in all namespaces is possible. */ extern unsigned int cp_search_name_hash (const char *search_name); -/* Implement the "la_get_symbol_name_matcher" language_defn method for - C++. */ +/* Implement the "get_symbol_name_matcher" language_defn method for C++. */ extern symbol_name_matcher_ftype *cp_get_symbol_name_matcher (const lookup_name_info &lookup_name); -- cgit v1.1