aboutsummaryrefslogtreecommitdiff
path: root/gdb/language.h
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-05-01 22:42:21 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-06-02 13:53:10 +0100
commit4009ee92c4ec3ee63f455c5abd761e26a819ef4a (patch)
treea088ee6a463cb0735622cf690787f8df3f131b4f /gdb/language.h
parent54f4ca4610893424746e56997115b71bc31ffd8a (diff)
downloadbinutils-4009ee92c4ec3ee63f455c5abd761e26a819ef4a.zip
binutils-4009ee92c4ec3ee63f455c5abd761e26a819ef4a.tar.gz
binutils-4009ee92c4ec3ee63f455c5abd761e26a819ef4a.tar.bz2
gdb: Convert language la_iterate_over_symbols field to a method
This commit changes the language_data::la_iterate_over_symbols function pointer member variable into a member function of language_defn. There should be no user visible changes after this commit. gdb/ChangeLog: * ada-lang.c (ada_add_all_symbols): Update comment. (ada_iterate_over_symbols): Delete, move implementation to... (ada_language::iterate_over_symbols): ...here, a new member function, rewrite to use range based for loop. (ada_language_data): Delete la_iterate_over_symbols initializer. * c-lang.c (c_language_data): Likewise. (cplus_language_data): Likewise. (asm_language_data): Likewise. (minimal_language_data): Likewise. * d-lang.c (d_language_data): Likewise. * f-lang.c (f_language_data): Likewise. * go-lang.c (go_language_data): Likewise. * language.c (unknown_language_data): Likewise. (auto_language_data): Likewise. * language.h (language_data): Delete la_iterate_over_symbols field. (language_defn::iterate_over_symbols): New member function. (LA_ITERATE_OVER_SYMBOLS): Update. * linespec.c (iterate_over_all_matching_symtabs): Update. * m2-lang.c (m2_language_data): Delete la_iterate_over_symbols initializer. * objc-lang.c (objc_language_data): Likewise. * opencl-lang.c (opencl_language_data): Likewise. * p-lang.c (pascal_language_data): Likewise. * rust-lang.c (rust_language_data): Likewise.
Diffstat (limited to 'gdb/language.h')
-rw-r--r--gdb/language.h41
1 files changed, 22 insertions, 19 deletions
diff --git a/gdb/language.h b/gdb/language.h
index 505600a..0880ced 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -384,24 +384,6 @@ struct language_data
symbol_name_matcher_ftype *(*la_get_symbol_name_matcher)
(const lookup_name_info &);
- /* Find all symbols in the current program space matching NAME in
- DOMAIN, according to this language's rules.
-
- The search is done in BLOCK only.
- The caller is responsible for iterating up through superblocks
- if desired.
-
- For each one, call CALLBACK with the symbol. If CALLBACK
- returns false, the iteration ends at that point.
-
- This field may not be NULL. If the language does not need any
- special processing here, 'iterate_over_symbols' should be
- used as the definition. */
- bool (*la_iterate_over_symbols)
- (const struct block *block, const lookup_name_info &name,
- domain_enum domain,
- gdb::function_view<symbol_found_callback_ftype> callback);
-
/* Hash the given symbol search name. Use
default_search_name_hash if no special treatment is
required. */
@@ -508,6 +490,27 @@ struct language_defn : language_data
return basic_lookup_transparent_type (name);
}
+ /* Find all symbols in the current program space matching NAME in
+ DOMAIN, according to this language's rules.
+
+ The search is done in BLOCK only.
+ The caller is responsible for iterating up through superblocks
+ if desired.
+
+ For each one, call CALLBACK with the symbol. If CALLBACK
+ returns false, the iteration ends at that point.
+
+ This field may not be NULL. If the language does not need any
+ special processing here, 'iterate_over_symbols' should be
+ used as the definition. */
+ virtual bool iterate_over_symbols
+ (const struct block *block, const lookup_name_info &name,
+ domain_enum domain,
+ gdb::function_view<symbol_found_callback_ftype> callback) const
+ {
+ return ::iterate_over_symbols (block, name, domain, callback);
+ }
+
/* List of all known languages. */
static const struct language_defn *languages[nr_languages];
};
@@ -617,7 +620,7 @@ extern enum language set_language (enum language);
options))
#define LA_ITERATE_OVER_SYMBOLS(BLOCK, NAME, DOMAIN, CALLBACK) \
- (current_language->la_iterate_over_symbols (BLOCK, NAME, DOMAIN, CALLBACK))
+ (current_language->iterate_over_symbols (BLOCK, NAME, DOMAIN, CALLBACK))
/* Test a character to decide whether it can be printed in literal form
or needs to be printed in another representation. For example,