This removes ALL_BLOCK_SYMBOLS in favor of foreach.
const std::string &ada_lookup_name = lookup_name.ada ().lookup_name ();
const char *name = ada_lookup_name.c_str ();
size_t name_len = ada_lookup_name.size ();
- struct symbol *sym;
- struct block_iterator iter;
- ALL_BLOCK_SYMBOLS (block, iter, sym)
+ for (struct symbol *sym : block_iterator_range (block))
{
if (symbol_matches_domain (sym->language (),
sym->domain (), domain))
while (block != 0)
{
- struct block_iterator iter;
- struct symbol *sym;
-
- ALL_BLOCK_SYMBOLS (block, iter, sym)
+ for (struct symbol *sym : block_iterator_range (block))
{
switch (sym->aclass ())
{
for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
{
const struct block *b = bv->block (i);
- struct block_iterator iter;
- struct symbol *sym;
- ALL_BLOCK_SYMBOLS (b, iter, sym)
+ for (struct symbol *sym : block_iterator_range (b))
if (ada_is_non_standard_exception_sym (sym)
&& name_matches_regex (sym->natural_name (), preg))
{
const char *text, const char *word,
enum type_code code) const override
{
- struct symbol *sym;
const struct block *b, *surrounding_static_block = 0;
- struct block_iterator iter;
gdb_assert (code == TYPE_CODE_UNDEF);
if (!b->superblock ())
surrounding_static_block = b; /* For elmin of dups */
- ALL_BLOCK_SYMBOLS (b, iter, sym)
+ for (struct symbol *sym : block_iterator_range (b))
{
if (completion_skip_symbol (mode, sym))
continue;
{
QUIT;
b = s->blockvector ()->global_block ();
- ALL_BLOCK_SYMBOLS (b, iter, sym)
+ for (struct symbol *sym : block_iterator_range (b))
{
if (completion_skip_symbol (mode, sym))
continue;
/* Don't do this block twice. */
if (b == surrounding_static_block)
continue;
- ALL_BLOCK_SYMBOLS (b, iter, sym)
+ for (struct symbol *sym : block_iterator_range (b))
{
if (completion_skip_symbol (mode, sym))
continue;
extern int block_find_non_opaque_type_preferred (struct symbol *sym,
void *data);
-/* Macro to loop through all symbols in BLOCK, in no particular
- order. ITER helps keep track of the iteration, and must be a
- struct block_iterator. SYM points to the current symbol. */
-
-#define ALL_BLOCK_SYMBOLS(block, iter, sym) \
- for ((sym) = block_iterator_first ((block), &(iter)); \
- (sym); \
- (sym) = block_iterator_next (&(iter)))
-
/* Given a vector of pairs, allocate and build an obstack allocated
blockranges struct for a block. */
struct blockranges *make_blockranges (struct objfile *objfile,
/* Note that we only want to fix up symbols from the local
blocks, not blocks coming from included symtabs. That is why
- we use ALL_DICT_SYMBOLS here and not ALL_BLOCK_SYMBOLS. */
+ we use ALL_DICT_SYMBOLS here and not a block iterator. */
ALL_DICT_SYMBOLS (block->multidict (), miter, sym)
if (sym->symtab () == NULL)
sym->set_symtab (symtab);
static void
patch_opaque_types (struct symtab *s)
{
- struct block_iterator iter;
- struct symbol *real_sym;
-
/* Go through the per-file symbols only. */
const struct block *b = s->compunit ()->blockvector ()->static_block ();
- ALL_BLOCK_SYMBOLS (b, iter, real_sym)
+ for (struct symbol *real_sym : block_iterator_range (b))
{
/* Find completed typedefs to use to fix opaque ones.
Remove syms from the chain when their types are stored,
info_common_command_for_block (const struct block *block, const char *comname,
int *any_printed)
{
- struct block_iterator iter;
- struct symbol *sym;
struct value_print_options opts;
get_user_print_options (&opts);
- ALL_BLOCK_SYMBOLS (block, iter, sym)
+ for (struct symbol *sym : block_iterator_range (block))
if (sym->domain () == COMMON_BLOCK_DOMAIN)
{
const struct common_block *common = sym->value_common_block ();
try
{
const struct block *b;
- struct block_iterator iter;
- struct symbol *sym;
int argno = 0;
/* The exception breakpoint is a thread-specific breakpoint on
handler. */
b = func->value_block ();
- ALL_BLOCK_SYMBOLS (b, iter, sym)
+ for (struct symbol *sym : block_iterator_range (b))
{
if (!sym->is_argument ())
continue;
{
if (completion_mode)
{
- struct block_iterator iter;
- struct symbol *sym;
size_t name_len = strlen (name);
int (*cmp) (const char *, const char *, size_t);
cmp = case_sensitivity == case_sensitive_on ? strncmp : strncasecmp;
- ALL_BLOCK_SYMBOLS (block, iter, sym)
+ for (struct symbol *sym : block_iterator_range (block))
{
if (symbol_matches_domain (sym->language (),
sym->domain (), LABEL_DOMAIN)
type. Set that from the type of the parameter symbols. */
int nparams = top_stack->numargs;
int iparams;
- struct symbol *sym;
if (nparams > 0)
{
- struct block_iterator iter;
-
ftype->set_num_fields (nparams);
ftype->set_fields
((struct field *)
TYPE_ALLOC (ftype, nparams * sizeof (struct field)));
iparams = 0;
- ALL_BLOCK_SYMBOLS (cblock, iter, sym)
+ for (struct symbol *sym : block_iterator_range (cblock))
{
if (iparams == nparams)
break;
mylookup_symbol (const char *name, const struct block *block,
domain_enum domain, enum address_class theclass)
{
- struct block_iterator iter;
int inc;
- struct symbol *sym;
inc = name[0];
- ALL_BLOCK_SYMBOLS (block, iter, sym)
+ for (struct symbol *sym : block_iterator_range (block))
{
if (sym->linkage_name ()[0] == inc
&& sym->domain () == domain
frame_info_ptr fi, int skip_unavailable)
{
const struct block *block;
- struct symbol *sym;
- struct block_iterator iter;
const char *name_of_result;
struct ui_out *uiout = current_uiout;
while (block != 0)
{
- ALL_BLOCK_SYMBOLS (block, iter, sym)
+ for (struct symbol *sym : block_iterator_range (block))
{
int print_me = 0;
if (func)
{
const struct block *b = func->value_block ();
- struct block_iterator iter;
- struct symbol *sym;
- ALL_BLOCK_SYMBOLS (b, iter, sym)
+ for (struct symbol *sym : block_iterator_range (b))
{
struct frame_arg arg, entryarg;
iterate_over_block_locals (const struct block *b,
iterate_over_block_arg_local_vars_cb cb)
{
- struct block_iterator iter;
- struct symbol *sym;
-
- ALL_BLOCK_SYMBOLS (b, iter, sym)
+ for (struct symbol *sym : block_iterator_range (b))
{
switch (sym->aclass ())
{
iterate_over_block_arg_vars (const struct block *b,
iterate_over_block_arg_local_vars_cb cb)
{
- struct block_iterator iter;
- struct symbol *sym, *sym2;
-
- ALL_BLOCK_SYMBOLS (b, iter, sym)
+ for (struct symbol *sym : block_iterator_range (b))
{
/* Don't worry about things which aren't arguments. */
if (sym->is_argument ())
float). There are also LOC_ARG/LOC_REGISTER pairs which
are not combined in symbol-reading. */
- sym2 = lookup_symbol_search_name (sym->search_name (),
- b, VAR_DOMAIN).symbol;
+ struct symbol *sym2
+ = lookup_symbol_search_name (sym->search_name (),
+ b, VAR_DOMAIN).symbol;
cb (sym->print_name (), sym2);
}
}
if (section != 0)
{
- struct symbol *sym = NULL;
- struct block_iterator iter;
+ struct symbol *found_sym = nullptr;
for (int b_index = GLOBAL_BLOCK;
- b_index <= STATIC_BLOCK && sym == NULL;
+ b_index <= STATIC_BLOCK && found_sym == nullptr;
++b_index)
{
const struct block *b = bv->block (b_index);
- ALL_BLOCK_SYMBOLS (b, iter, sym)
+ for (struct symbol *sym : block_iterator_range (b))
{
if (matching_obj_sections (sym->obj_section (obj_file),
section))
- break;
+ {
+ found_sym = sym;
+ break;
+ }
}
}
- if (sym == NULL)
+ if (found_sym == nullptr)
continue; /* No symbol in this symtab matches
section. */
}
for (int i = GLOBAL_BLOCK; i <= STATIC_BLOCK; ++i)
{
const struct block *b = bv->block (i);
- struct block_iterator iter;
- struct symbol *sym;
- ALL_BLOCK_SYMBOLS (b, iter, sym)
+ for (struct symbol *sym : block_iterator_range (b))
{
if (sym->aclass () == LOC_STATIC
&& sym->value_address () == addr)
for (block_enum block : { GLOBAL_BLOCK, STATIC_BLOCK })
{
- struct block_iterator iter;
- struct symbol *sym;
const struct block *b = bv->block (block);
- ALL_BLOCK_SYMBOLS (b, iter, sym)
+ for (struct symbol *sym : block_iterator_range (b))
{
struct symtab *real_symtab = sym->symtab ();
const char *text, const char *word,
enum type_code code)
{
- struct symbol *sym;
- struct block_iterator iter;
int i;
if (cust == NULL)
QUIT;
const struct block *b = cust->blockvector ()->block (i);
- ALL_BLOCK_SYMBOLS (b, iter, sym)
+ for (struct symbol *sym : block_iterator_range (b))
{
if (completion_skip_symbol (mode, sym))
continue;
frees them. I'm not going to worry about this; hopefully there
won't be that many. */
- struct symbol *sym;
const struct block *b;
const struct block *surrounding_static_block, *surrounding_global_block;
- struct block_iterator iter;
/* The symbol we are completing on. Points in same buffer as text. */
const char *sym_text;
{
QUIT;
- ALL_BLOCK_SYMBOLS (b, iter, sym)
+ for (struct symbol *sym : block_iterator_range (b))
{
if (code == TYPE_CODE_UNDEF)
{
if (code == TYPE_CODE_UNDEF)
{
if (surrounding_static_block != NULL)
- ALL_BLOCK_SYMBOLS (surrounding_static_block, iter, sym)
+ for (struct symbol *sym : block_iterator_range (surrounding_static_block))
completion_list_add_fields (tracker, sym, lookup_name,
sym_text, word);
if (surrounding_global_block != NULL)
- ALL_BLOCK_SYMBOLS (surrounding_global_block, iter, sym)
+ for (struct symbol *sym : block_iterator_range (surrounding_global_block))
completion_list_add_fields (tracker, sym, lookup_name,
sym_text, word);
}
static void
info_scope_command (const char *args_in, int from_tty)
{
- struct symbol *sym;
struct bound_minimal_symbol msym;
const struct block *block;
const char *symname;
const char *save_args = args_in;
- struct block_iterator iter;
int j, count = 0;
struct gdbarch *gdbarch;
int regno;
while (block != 0)
{
QUIT; /* Allow user to bail out with ^C. */
- ALL_BLOCK_SYMBOLS (block, iter, sym)
+ for (struct symbol *sym : block_iterator_range (block))
{
QUIT; /* Allow user to bail out with ^C. */
if (count == 0)