aboutsummaryrefslogtreecommitdiff
path: root/gdb/symtab.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r--gdb/symtab.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 9508dcf..25b55ed 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -2880,22 +2880,24 @@ find_pc_sect_compunit_symtab (CORE_ADDR pc, struct obj_section *section)
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. */
}
@@ -2946,10 +2948,8 @@ find_symbol_at_address (CORE_ADDR address)
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)
@@ -4709,11 +4709,9 @@ global_symbol_searcher::add_matching_symbols
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 ();
@@ -5673,8 +5671,6 @@ add_symtab_completions (struct compunit_symtab *cust,
const char *text, const char *word,
enum type_code code)
{
- struct symbol *sym;
- struct block_iterator iter;
int i;
if (cust == NULL)
@@ -5685,7 +5681,7 @@ add_symtab_completions (struct compunit_symtab *cust,
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;
@@ -5711,10 +5707,8 @@ default_collect_symbol_completion_matches_break_on
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;
@@ -5835,7 +5829,7 @@ default_collect_symbol_completion_matches_break_on
{
QUIT;
- ALL_BLOCK_SYMBOLS (b, iter, sym)
+ for (struct symbol *sym : block_iterator_range (b))
{
if (code == TYPE_CODE_UNDEF)
{
@@ -5863,12 +5857,12 @@ default_collect_symbol_completion_matches_break_on
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);
}