aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
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/ada-lang.c
parent54f4ca4610893424746e56997115b71bc31ffd8a (diff)
downloadgdb-4009ee92c4ec3ee63f455c5abd761e26a819ef4a.zip
gdb-4009ee92c4ec3ee63f455c5abd761e26a819ef4a.tar.gz
gdb-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/ada-lang.c')
-rw-r--r--gdb/ada-lang.c44
1 files changed, 20 insertions, 24 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 7d23fd5..762c124 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -5681,7 +5681,7 @@ ada_add_all_symbols (struct obstack *obstackp,
else
{
/* In the !full_search case we're are being called by
- ada_iterate_over_symbols, and we don't want to search
+ iterate_over_symbols, and we don't want to search
superblocks. */
ada_add_block_symbols (obstackp, block, lookup_name, domain, NULL);
}
@@ -5782,28 +5782,6 @@ ada_lookup_symbol_list (const char *name, const struct block *block,
return ada_lookup_symbol_list_worker (lookup_name, block, domain, results, 1);
}
-/* Implementation of the la_iterate_over_symbols method. */
-
-static bool
-ada_iterate_over_symbols
- (const struct block *block, const lookup_name_info &name,
- domain_enum domain,
- gdb::function_view<symbol_found_callback_ftype> callback)
-{
- int ndefs, i;
- std::vector<struct block_symbol> results;
-
- ndefs = ada_lookup_symbol_list_worker (name, block, domain, &results, 0);
-
- for (i = 0; i < ndefs; ++i)
- {
- if (!callback (&results[i]))
- return false;
- }
-
- return true;
-}
-
/* The result is as for ada_lookup_symbol_list with FULL_SEARCH set
to 1, but choosing the first symbol found if there are multiple
choices.
@@ -13999,7 +13977,6 @@ extern const struct language_data ada_language_data =
ada_collect_symbol_completion_matches,
ada_watch_location_expression,
ada_get_symbol_name_matcher, /* la_get_symbol_name_matcher */
- ada_iterate_over_symbols,
default_search_name_hash,
&ada_varobj_ops,
NULL,
@@ -14114,6 +14091,25 @@ public:
lai->bool_type_symbol = NULL;
lai->bool_type_default = builtin->builtin_bool;
}
+
+ /* See language.h. */
+
+ 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 override
+ {
+ std::vector<struct block_symbol> results;
+
+ ada_lookup_symbol_list_worker (name, block, domain, &results, 0);
+ for (block_symbol &sym : results)
+ {
+ if (!callback (&sym))
+ return false;
+ }
+
+ return true;
+ }
};
/* Single instance of the Ada language class. */