Add accessors for symbol's artificial field

For a series I'm experimenting with, it was handy to hide a symbol's
"artificial" field behind accessors.  This patch is the result.
This commit is contained in:
Tom Tromey
2022-04-16 12:33:56 -06:00
parent a827b8ec32
commit 496feb16f8
3 changed files with 18 additions and 6 deletions

View File

@@ -3854,7 +3854,7 @@ ada_resolve_variable (struct symbol *sym, const struct block *block,
candidates.end (),
[] (block_symbol &bsym)
{
return bsym.symbol->artificial;
return bsym.symbol->is_artificial ();
}),
candidates.end ());
@@ -13456,9 +13456,9 @@ public:
}
/* See language.h. */
virtual bool symbol_printing_suppressed (struct symbol *symbol) const override
bool symbol_printing_suppressed (struct symbol *symbol) const override
{
return symbol->artificial;
return symbol->is_artificial ();
}
/* See language.h. */

View File

@@ -20634,7 +20634,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
/* Handle DW_AT_artificial. */
attr = dwarf2_attr (die, DW_AT_artificial, cu);
if (attr != nullptr)
sym->artificial = attr->as_boolean ();
sym->set_is_artificial (attr->as_boolean ());
/* Default assumptions.
Use the passed type or decode it from the die. */

View File

@@ -1203,7 +1203,7 @@ struct symbol : public general_symbol_info, public allocate_on_obstack
m_is_inlined (0),
maybe_copied (0),
subclass (SYMBOL_NONE),
artificial (false)
m_artificial (false)
{
/* We can't use an initializer list for members of a base class, and
general_symbol_info needs to stay a POD type. */
@@ -1369,6 +1369,18 @@ struct symbol : public general_symbol_info, public allocate_on_obstack
m_value.chain = sym;
}
/* Return true if this symbol was marked as artificial. */
bool is_artificial () const
{
return m_artificial;
}
/* Set the 'artificial' flag on this symbol. */
void set_is_artificial (bool artificial)
{
m_artificial = artificial;
}
/* Data type of value */
struct type *m_type = nullptr;
@@ -1423,7 +1435,7 @@ struct symbol : public general_symbol_info, public allocate_on_obstack
/* Whether this symbol is artificial. */
bool artificial : 1;
bool m_artificial : 1;
/* Line number of this symbol's definition, except for inlined
functions. For an inlined function (class LOC_BLOCK and