+2019-09-10 Tom Tromey <tromey@adacore.com>
+
+ * ada-lang.c (ada_iterate_over_symbols): Return bool.
+ * language.h (struct language_defn) <la_iterate_over_symbols>:
+ Return bool.
+ * symtab.c (iterate_over_symbols): Return bool.
+ * symtab.h (iterate_over_symbols): Return bool.
+
2019-09-10 Tom Tromey <tromey@adacore.com>
* ada-lang.c (aux_add_nonlocal_symbols): Change type.
/* Implementation of the la_iterate_over_symbols method. */
-static void
+static bool
ada_iterate_over_symbols
(const struct block *block, const lookup_name_info &name,
domain_enum domain,
for (i = 0; i < ndefs; ++i)
{
if (!callback (&results[i]))
- break;
+ return false;
}
+
+ return true;
}
/* The result is as for ada_lookup_symbol_list with FULL_SEARCH set
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. */
- void (*la_iterate_over_symbols)
+ 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);
return (struct type *) 0;
}
-/* Iterate over the symbols named NAME, matching DOMAIN, in BLOCK.
-
- For each symbol that matches, CALLBACK is called. The symbol is
- passed to the callback.
-
- If CALLBACK returns false, the iteration ends. Otherwise, the
- search continues. */
+/* See symtab.h. */
-void
+bool
iterate_over_symbols (const struct block *block,
const lookup_name_info &name,
const domain_enum domain,
struct block_symbol block_sym = {sym, block};
if (!callback (&block_sym))
- return;
+ return false;
}
}
+ return true;
}
/* Find the compunit symtab associated with PC and SECTION.
typedef bool (symbol_found_callback_ftype) (struct block_symbol *bsym);
-void iterate_over_symbols (const struct block *block,
+/* Iterate over the symbols named NAME, matching DOMAIN, in BLOCK.
+
+ For each symbol that matches, CALLBACK is called. The symbol is
+ passed to the callback.
+
+ If CALLBACK returns false, the iteration ends and this function
+ returns false. Otherwise, the search continues, and the function
+ eventually returns true. */
+
+bool iterate_over_symbols (const struct block *block,
const lookup_name_info &name,
const domain_enum domain,
gdb::function_view<symbol_found_callback_ftype> callback);