static const char *ada_decoded_op_name (enum exp_opcode);
static struct type *ada_lookup_struct_elt_type (struct type *, const char *,
- int, int);
+ bool, bool);
static struct type *ada_find_parallel_type_with_name (struct type *,
const char *);
The latter should be shown as usual (as a pointer), whereas
a reference should mostly be transparent to the user. */
- if (ada_is_tagged_type (t1, 0)
+ if (ada_is_tagged_type (t1, false)
|| (t1->code () == TYPE_CODE_REF
- && ada_is_tagged_type (t1->target_type (), 0)))
+ && ada_is_tagged_type (t1->target_type (), false)))
{
/* We first try to find the searched field in the current type.
If not found then let's look in the fixed type. */
/* If this is the dispatch table of a tagged type or an interface tag,
then ignore. */
- if (ada_is_tagged_type (type, 1)
+ if (ada_is_tagged_type (type, true)
&& (ada_is_dispatch_table_ptr_type (type->field (field_num).type ())
|| ada_is_interface_tag (type->field (field_num).type ())))
return true;
/* True iff TYPE has a tag field. If REFOK, then TYPE may also be a
pointer or reference type whose ultimate target has a tag field. */
-int
-ada_is_tagged_type (struct type *type, int refok)
+bool
+ada_is_tagged_type (struct type *type, bool refok)
{
- return (ada_lookup_struct_elt_type (type, "_tag", refok, 1) != NULL);
+ return ada_lookup_struct_elt_type (type, "_tag", refok, true) != nullptr;
}
/* True iff TYPE represents the type of X'Tag */
static struct type *
ada_tag_type (struct value *val)
{
- return ada_lookup_struct_elt_type (val->type (), "_tag", 1, 0);
+ return ada_lookup_struct_elt_type (val->type (), "_tag", true, false);
}
/* Return 1 if TAG follows the old scheme for Ada tags (used for Ada 95,
{
const char *name = ada_variant_discrim_name (var_type);
- return ada_lookup_struct_elt_type (outer_type, name, 1, 1);
+ return ada_lookup_struct_elt_type (outer_type, name, true, true);
}
/* Assuming that TYPE is the type of a variant wrapper, and FIELD_NUM is a
In the case of homonyms in the tagged types, please refer to the
long explanation in find_struct_field's function documentation.
- If NOERR is nonzero, return NULL if NAME is not suitably defined or
+ If NOERR is true, return NULL if NAME is not suitably defined or
TYPE is not a type of the right kind. */
static struct type *
-ada_lookup_struct_elt_type (struct type *type, const char *name, int refok,
- int noerr)
+ada_lookup_struct_elt_type (struct type *type, const char *name, bool refok,
+ bool noerr)
{
if (name == NULL)
goto BadName;
{
const char *discrim_name = ada_variant_discrim_name (var_type);
- return (ada_lookup_struct_elt_type (outer_type, discrim_name, 0, 1) == NULL);
+ return (ada_lookup_struct_elt_type (outer_type, discrim_name, false, true)
+ == nullptr);
}
{
struct value *val = value_ind (val0);
- if (ada_is_tagged_type (val->type (), 0))
+ if (ada_is_tagged_type (val->type (), false))
val = ada_tag_value_at_base_address (val);
return ada_to_fixed_value (val);
val = coerce_ref (val);
- if (ada_is_tagged_type (val->type (), 0))
+ if (ada_is_tagged_type (val->type (), false))
val = ada_tag_value_at_base_address (val);
return ada_to_fixed_value (val);
and the way the location of _tag is expressed may depend on
them). */
- if (check_tag && address != 0 && ada_is_tagged_type (static_type, 0))
+ if (check_tag && address != 0 && ada_is_tagged_type (static_type,
+ false))
{
struct value *tag =
value_tag_from_contents_and_address
we have to be careful to exclude pointers to tagged types.
The latter should be shown as usual (as a pointer), whereas
a reference should mostly be transparent to the user. */
- if (ada_is_tagged_type (type, 0)
+ if (ada_is_tagged_type (type, false)
|| (type->code () == TYPE_CODE_REF
- && ada_is_tagged_type (type->target_type (), 0)))
+ && ada_is_tagged_type (type->target_type (), false)))
{
/* Tagged types are a little special in the fact that the real
type is dynamic and can only be determined by inspecting the
sym->print_name ());
struct type *type = static_unwrap_type (sym->type ());
- if (ada_is_tagged_type (type, 0)
+ if (ada_is_tagged_type (type, false)
|| (type->code () == TYPE_CODE_REF
- && ada_is_tagged_type (type->target_type (), 0)))
+ && ada_is_tagged_type (type->target_type (), false)))
error (_("Tagged types cannot be handled in agent expressions"));
if ((type->code () == TYPE_CODE_STRUCT
if ((type->code () == TYPE_CODE_REF
|| type->code () == TYPE_CODE_PTR)
- && ada_is_tagged_type (type->target_type (), 0))
+ && ada_is_tagged_type (type->target_type (), false))
{
arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp,
EVAL_NORMAL);
struct type *type;
struct type *type1 = arg1->type ();
- if (ada_is_tagged_type (type1, 1))
+ if (ada_is_tagged_type (type1, true))
{
- type = ada_lookup_struct_elt_type (type1, str, 1, 1);
+ type = ada_lookup_struct_elt_type (type1, str, true, true);
/* If the field is not found, check if it exists in the
extension of this object's type. This means that we
}
}
else
- type = ada_lookup_struct_elt_type (type1, str, 1, 0);
+ type = ada_lookup_struct_elt_type (type1, str, true, false);
return value::zero (ada_aligned_type (type), lval_memory);
}
/* If this is a tagged type, we need to transform it a bit in order
to be able to fetch its full view. As always with tagged types,
we can only do that if we have a value. */
- if (*value != NULL && ada_is_tagged_type (*type, 1))
+ if (*value != NULL && ada_is_tagged_type (*type, true))
{
*value = ada_tag_value_at_base_address (*value);
*type = (*value)->type ();
ada_varobj_struct_elt (parent_value, parent_type, i,
&elt_value, &elt_type);
- if (ada_is_tagged_type (elt_type, 0))
+ if (ada_is_tagged_type (elt_type, false))
{
/* We must not use ada_varobj_get_number_of_children
to determine is element's number of children, because
ada_varobj_struct_elt (parent_value, parent_type, fieldno,
&elt_value, &elt_type);
- if (ada_is_tagged_type (elt_type, 0))
+ if (ada_is_tagged_type (elt_type, false))
{
/* Same as in ada_varobj_get_struct_number_of_children:
For tagged types, we must be careful to not call
of this wrapper field? */
if (child_index - childno < elt_n_children)
{
- if (ada_is_tagged_type (elt_type, 0))
+ if (ada_is_tagged_type (elt_type, false))
{
/* Same as in ada_varobj_get_struct_number_of_children:
For tagged types, we must be careful to not call