which = STATIC_BLOCK;
else
{
- iter->d.block = block;
-
/* A signal value meaning that we're iterating over a single
block. */
iter->which = FIRST_LOCAL_BLOCK;
directly. */
if (cu->includes.empty ())
{
- iter->d.block = block;
/* A signal value meaning that we're iterating over a single
block. */
iter->which = FIRST_LOCAL_BLOCK;
}
else
{
- iter->d.compunit_symtab = cu;
+ iter->compunit_symtab_ = cu;
iter->which = which;
}
}
block_iterator::compunit_symtab () const
{
if (this->idx == -1)
- return this->d.compunit_symtab;
+ return this->compunit_symtab_;
- auto &includes = this->d.compunit_symtab->includes;
+ auto &includes = this->compunit_symtab_->includes;
if (this->idx < includes.size ())
return includes[this->idx];
iterates. Return nullptr if the iteration is finished. */
struct compunit_symtab *compunit_symtab () const;
- /* If we're iterating over a single block, this holds the block.
- Otherwise, it holds the canonical compunit. */
+ /* If iterating on a global or static blocks, iteration starts from the
+ top-level CU and then continues with the global or static blocks of all
+ the included CUs. This field holds the compunit of the current block.
- union
- {
- struct compunit_symtab *compunit_symtab;
- const struct block *block;
- } d;
+ This field is not private because block_iterator must remain trivial,
+ but treat it as private. */
+ struct compunit_symtab *compunit_symtab_;
/* If we're trying to match a name, this will be non-NULL. */
const lookup_name_info *name;