gdb_assert (args[0].type ()->code () == TYPE_CODE_PTR);
domain = args[0].type ()->target_type ();
- if (TYPE_CONST (domain))
+ if (domain->is_const ())
gdb_printf (stream, " const");
if (TYPE_VOLATILE (domain))
/* We don't print `const' qualifiers for references --- since all
operators affect the thing referenced, not the reference itself,
every reference is `const'. */
- if (TYPE_CONST (type) && !TYPE_IS_REFERENCE (type))
+ if (type->is_const () && !TYPE_IS_REFERENCE (type))
{
if (need_pre_space)
gdb_printf (stream, " ");
unqual_converted = context->convert_type (unqual);
- if (TYPE_CONST (type))
+ if (type->is_const ())
quals |= GCC_QUALIFIER_CONST;
if (TYPE_VOLATILE (type))
quals |= GCC_QUALIFIER_VOLATILE;
{
/* If we are converting a qualified type, first convert the
unqualified type and then apply the qualifiers. */
- if (TYPE_CONST (type) || TYPE_VOLATILE (type) || TYPE_RESTRICT (type))
+ if (type->is_const () || TYPE_VOLATILE (type) || TYPE_RESTRICT (type))
return convert_qualified (context, type);
switch (type->code ())
gcc_type class_type = instance->convert_type (parent_type);
gcc_cp_qualifiers_flags quals = 0;
- if (TYPE_CONST (method_type))
+ if (method_type->is_const ())
quals |= GCC_CP_QUALIFIER_CONST;
if (TYPE_VOLATILE (method_type))
quals |= GCC_CP_QUALIFIER_VOLATILE;
gcc_cp_qualifiers_flags quals = (enum gcc_cp_qualifiers) 0;
gcc_type unqual_converted = instance->convert_type (unqual);
- if (TYPE_CONST (type))
+ if (type->is_const ())
quals |= GCC_CP_QUALIFIER_CONST;
if (TYPE_VOLATILE (type))
quals |= GCC_CP_QUALIFIER_VOLATILE;
{
/* If we are converting a qualified type, first convert the
unqualified type and then apply the qualifiers. */
- if (TYPE_CONST (type) || TYPE_VOLATILE (type) || TYPE_RESTRICT (type))
+ if (type->is_const () || TYPE_VOLATILE (type) || TYPE_RESTRICT (type))
return compile_cplus_convert_qualified (instance, type);
switch (type->code ())
}
el_type = inner_array->target_type ();
- cnst |= TYPE_CONST (el_type);
+ cnst |= el_type->is_const ();
voltl |= TYPE_VOLATILE (el_type);
inner_array->set_target_type (make_cv_type (cnst, voltl, el_type));
if (ctf_type_kind (dict, btid) == CTF_K_ARRAY)
return add_array_cv_type (ccp, tid, base_type, 0, 1);
- cv_type = make_cv_type (TYPE_CONST (base_type), 1, base_type);
+ cv_type = make_cv_type (base_type->is_const (), 1, base_type);
return set_tid_type (ccp, tid, cv_type);
}
if (type->num_fields () > 0
&& type->field (0).is_artificial ()
&& type->field (0).type ()->code () == TYPE_CODE_PTR
- && TYPE_CONST (type->field (0).type ()->target_type ()))
+ && type->field (0).type ()->target_type ()->is_const ())
buf.puts (" const");
}
}
}
el_type = inner_array->target_type ();
- cnst |= TYPE_CONST (el_type);
+ cnst |= el_type->is_const ();
voltl |= TYPE_VOLATILE (el_type);
inner_array->set_target_type (make_cv_type (cnst, voltl, el_type));
if (base_type->code () == TYPE_CODE_ARRAY)
return add_array_cv_type (die, cu, base_type, 0, 1);
- cv_type = make_cv_type (TYPE_CONST (base_type), 1, base_type);
+ cv_type = make_cv_type (base_type->is_const (), 1, base_type);
return set_die_type (die, cv_type, cu);
}
expects. GCC marks THIS as const in method definitions,
but not in the class specifications (GCC PR 43053). */
if (cu->lang () == language_cplus
- && !TYPE_CONST (arg_type)
+ && !arg_type->is_const ()
&& ftype->field (iparams).is_artificial ())
{
int is_this = 0;
if (types_equal (t1, t2))
{
/* Make sure they are CV equal. */
- if (TYPE_CONST (t1) != TYPE_CONST (t2))
+ if (t1->is_const () != t2->is_const ())
rank.subrank |= CV_CONVERSION_CONST;
if (TYPE_VOLATILE (t1) != TYPE_VOLATILE (t2))
rank.subrank |= CV_CONVERSION_VOLATILE;
lvalue references. */
if (parm->code () == TYPE_CODE_RVALUE_REF)
rank.subrank = REFERENCE_CONVERSION_RVALUE;
- else if (TYPE_CONST (parm->target_type ()))
+ else if (parm->target_type ()->is_const ())
rank.subrank = REFERENCE_CONVERSION_CONST_LVALUE;
else
return INCOMPATIBLE_TYPE_BADNESS;
}
/* Make sure they are CV equal, too. */
- if (TYPE_CONST (t1) != TYPE_CONST (t2))
+ if (t1->is_const () != t2->is_const ())
rank.subrank |= CV_CONVERSION_CONST;
if (TYPE_VOLATILE (t1) != TYPE_VOLATILE (t2))
rank.subrank |= CV_CONVERSION_VOLATILE;
gdb_printf ("%*stype_chain %s\n", spaces, "",
host_address_to_string (type->chain));
gdb_printf ("%*sinstance_flags [", spaces, "");
- if (TYPE_CONST (type))
- {
- gdb_puts (" TYPE_CONST");
- }
+ if (type->is_const ())
+ gdb_puts (" TYPE_CONST");
if (TYPE_VOLATILE (type))
{
gdb_puts (" TYPE_VOLATILE");
bool is_atomic : 1;
};
-#define TYPE_CONST(t) (((t)->instance_flags ()).is_const)
#define TYPE_VOLATILE(t) (((t)->instance_flags ()).is_volatile)
#define TYPE_RESTRICT(t) (((t)->instance_flags ()).is_restrict)
#define TYPE_ATOMIC(t) (((t)->instance_flags ()).is_atomic)
return this->m_instance_flags.is_nottext;
}
+ /* Return if this type is const. */
+ bool is_const () const
+ {
+ return this->m_instance_flags.is_const;
+ }
+
/* Get the bounds bounds of this type. The type must be a range type. */
range_bounds *bounds () const
{
m2_pointer (struct type *type, struct ui_file *stream, int show,
int level, const struct type_print_options *flags)
{
- if (TYPE_CONST (type))
+ if (type->is_const ())
gdb_printf (stream, "[...] : ");
else
gdb_printf (stream, "POINTER TO ");
break;
case TYPE_CODE_PTR:
- if (TYPE_CONST (type))
+ if (type->is_const ())
print_variable_at_address (type, valaddr, stream, recurse, options);
else if (options->format && options->format != 's')
value_print_scalar_formatted (val, options, 0, stream);
if (dst_type == NULL)
dst_type = init_vector_type (elm_type, n);
- make_cv_type (TYPE_CONST (type), TYPE_VOLATILE (type), dst_type);
+ make_cv_type (type->is_const (), TYPE_VOLATILE (type), dst_type);
if (noside == EVAL_AVOID_SIDE_EFFECTS)
ret = value::allocate (dst_type);
try
{
- type = make_cv_type (TYPE_CONST (type), 1, type);
+ type = make_cv_type (type->is_const (), 1, type);
}
catch (const gdb_exception &except)
{
rtype = make_cv_type (1, TYPE_VOLATILE (type), type);
break;
case DEMANGLE_COMPONENT_VOLATILE:
- rtype = make_cv_type (TYPE_CONST (type), 1, type);
+ rtype = make_cv_type (type->is_const (), 1, type);
break;
}
}
TYPE_VOLATILE (follow_type),
follow_type);
if (make_volatile)
- follow_type = make_cv_type (TYPE_CONST (follow_type),
+ follow_type = make_cv_type (follow_type->is_const (),
make_volatile,
follow_type);
if (make_harvard_aspace != HARVARD_ASPACE_NONE)
{
for (j = 0; j < len; ++j)
{
- if (TYPE_CONST (intype) != TYPE_FN_FIELD_CONST (f, j))
+ if (intype->is_const () != TYPE_FN_FIELD_CONST (f, j))
continue;
if (TYPE_VOLATILE (intype) != TYPE_FN_FIELD_VOLATILE (f, j))
continue;
{
/* Copy qualifiers to the referenced object. */
target_type = target->type ();
- real_type = make_cv_type (TYPE_CONST (target_type),
+ real_type = make_cv_type (target_type->is_const (),
TYPE_VOLATILE (target_type), real_type);
if (TYPE_IS_REFERENCE (type))
real_type = lookup_reference_type (real_type, type->code ());
internal_error (_("Unexpected value type."));
/* Copy qualifiers to the pointer/reference. */
- real_type = make_cv_type (TYPE_CONST (type), TYPE_VOLATILE (type),
+ real_type = make_cv_type (type->is_const (), TYPE_VOLATILE (type),
real_type);
}