gdb: remove BLOCKVECTOR_BLOCK and BLOCKVECTOR_NBLOCKS macros

Replace with calls to blockvector::blocks, and the appropriate method
call on the returned array_view.

Change-Id: I04d1f39603e4d4c21c96822421431d9a029d8ddd
This commit is contained in:
Simon Marchi
2022-02-06 22:54:03 -05:00
committed by Simon Marchi
parent 6395b62847
commit 63d609debb
25 changed files with 194 additions and 161 deletions

View File

@ -4711,12 +4711,13 @@ cache_symbol (const char *name, domain_enum domain, struct symbol *sym,
for that symbol depends on the context. To determine whether
the symbol is local or not, we check the block where we found it
against the global and static blocks of its associated symtab. */
if (sym
&& BLOCKVECTOR_BLOCK (sym->symtab ()->compunit ()->blockvector (),
GLOBAL_BLOCK) != block
&& BLOCKVECTOR_BLOCK (sym->symtab ()->compunit ()->blockvector (),
STATIC_BLOCK) != block)
return;
if (sym != nullptr)
{
const blockvector &bv = *sym->symtab ()->compunit ()->blockvector ();
if (bv.global_block () != block && bv.static_block () != block)
return;
}
h = msymbol_hash (name) % HASH_SIZE;
e = XOBNEW (&sym_cache->cache_space, cache_entry);
@ -5563,7 +5564,7 @@ map_matching_symbols (struct objfile *objfile,
for (compunit_symtab *symtab : objfile->compunits ())
{
const struct block *block
= BLOCKVECTOR_BLOCK (symtab->blockvector (), block_kind);
= symtab->blockvector ()->block (block_kind);
if (!iterate_over_symbols_terminated (block, lookup_name,
domain, data))
break;
@ -5592,7 +5593,7 @@ add_nonlocal_symbols (std::vector<struct block_symbol> &result,
for (compunit_symtab *cu : objfile->compunits ())
{
const struct block *global_block
= BLOCKVECTOR_BLOCK (cu->blockvector (), GLOBAL_BLOCK);
= cu->blockvector ()->global_block ();
if (ada_add_block_renamings (result, global_block, lookup_name,
domain))
@ -13099,7 +13100,7 @@ ada_add_global_exceptions (compiled_regex *preg,
for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
{
const struct block *b = BLOCKVECTOR_BLOCK (bv, i);
const struct block *b = bv->block (i);
struct block_iterator iter;
struct symbol *sym;
@ -13687,7 +13688,7 @@ public:
for (compunit_symtab *s : objfile->compunits ())
{
QUIT;
b = BLOCKVECTOR_BLOCK (s->blockvector (), GLOBAL_BLOCK);
b = s->blockvector ()->global_block ();
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
if (completion_skip_symbol (mode, sym))
@ -13706,7 +13707,7 @@ public:
for (compunit_symtab *s : objfile->compunits ())
{
QUIT;
b = BLOCKVECTOR_BLOCK (s->blockvector (), STATIC_BLOCK);
b = s->blockvector ()->static_block ();
/* Don't do this block twice. */
if (b == surrounding_static_block)
continue;