+2020-05-14 Simon Marchi <simon.marchi@efficios.com>
+
+ * gdbtypes.h (TYPE_CODE): Remove. Change all call sites to use
+ type::code instead.
+
2020-05-14 Simon Marchi <simon.marchi@efficios.com>
* gdbtypes.h (struct type) <code, set_code>: New methods.
aarch64_type_align (gdbarch *gdbarch, struct type *t)
{
t = check_typedef (t);
- if (TYPE_CODE (t) == TYPE_CODE_ARRAY && TYPE_VECTOR (t))
+ if (t->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (t))
{
/* Use the natural alignment for vector types (the same for
scalar type), but the maximum alignment is 128-bit. */
if (type == nullptr)
return -1;
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_FLT:
if (TYPE_LENGTH (type) > 16)
if (*fundamental_type == nullptr)
*fundamental_type = type;
else if (TYPE_LENGTH (type) != TYPE_LENGTH (*fundamental_type)
- || TYPE_CODE (type) != TYPE_CODE (*fundamental_type))
+ || type->code () != (*fundamental_type)->code ())
return -1;
return 1;
if (*fundamental_type == nullptr)
*fundamental_type = target_type;
else if (TYPE_LENGTH (target_type) != TYPE_LENGTH (*fundamental_type)
- || TYPE_CODE (target_type) != TYPE_CODE (*fundamental_type))
+ || target_type->code () != (*fundamental_type)->code ())
return -1;
return 2;
if (*fundamental_type == nullptr)
*fundamental_type = type;
else if (TYPE_LENGTH (type) != TYPE_LENGTH (*fundamental_type)
- || TYPE_CODE (type) != TYPE_CODE (*fundamental_type))
+ || type->code () != (*fundamental_type)->code ())
return -1;
return 1;
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int len = TYPE_LENGTH (type);
- enum type_code typecode = TYPE_CODE (type);
+ enum type_code typecode = type->code ();
int regnum = AARCH64_X0_REGNUM + info->ngrn;
const bfd_byte *buf = value_contents (arg);
struct aarch64_call_info *info, struct type *arg_type,
struct value *arg)
{
- switch (TYPE_CODE (arg_type))
+ switch (arg_type->code ())
{
case TYPE_CODE_FLT:
return pass_in_v (gdbarch, regcache, info, TYPE_LENGTH (arg_type),
continue;
}
- switch (TYPE_CODE (arg_type))
+ switch (arg_type->code ())
{
case TYPE_CODE_INT:
case TYPE_CODE_BOOL:
valbuf += len;
}
}
- else if (TYPE_CODE (type) == TYPE_CODE_INT
- || TYPE_CODE (type) == TYPE_CODE_CHAR
- || TYPE_CODE (type) == TYPE_CODE_BOOL
- || TYPE_CODE (type) == TYPE_CODE_PTR
+ else if (type->code () == TYPE_CODE_INT
+ || type->code () == TYPE_CODE_CHAR
+ || type->code () == TYPE_CODE_BOOL
+ || type->code () == TYPE_CODE_PTR
|| TYPE_IS_REFERENCE (type)
- || TYPE_CODE (type) == TYPE_CODE_ENUM)
+ || type->code () == TYPE_CODE_ENUM)
{
/* If the type is a plain integer, then the access is
straight-forward. Otherwise we have to play around a bit
valbuf += len;
}
}
- else if (TYPE_CODE (type) == TYPE_CODE_INT
- || TYPE_CODE (type) == TYPE_CODE_CHAR
- || TYPE_CODE (type) == TYPE_CODE_BOOL
- || TYPE_CODE (type) == TYPE_CODE_PTR
+ else if (type->code () == TYPE_CODE_INT
+ || type->code () == TYPE_CODE_CHAR
+ || type->code () == TYPE_CODE_BOOL
+ || type->code () == TYPE_CODE_PTR
|| TYPE_IS_REFERENCE (type)
- || TYPE_CODE (type) == TYPE_CODE_ENUM)
+ || type->code () == TYPE_CODE_ENUM)
{
if (TYPE_LENGTH (type) <= X_REGISTER_SIZE)
{
gdb_byte *readbuf, const gdb_byte *writebuf)
{
- if (TYPE_CODE (valtype) == TYPE_CODE_STRUCT
- || TYPE_CODE (valtype) == TYPE_CODE_UNION
- || TYPE_CODE (valtype) == TYPE_CODE_ARRAY)
+ if (valtype->code () == TYPE_CODE_STRUCT
+ || valtype->code () == TYPE_CODE_UNION
+ || valtype->code () == TYPE_CODE_ARRAY)
{
if (aarch64_return_in_memory (gdbarch, valtype))
{
if (type == NULL)
return val;
type = check_typedef (type);
- if (TYPE_CODE (type) != TYPE_CODE_ENUM)
+ if (type->code () != TYPE_CODE_ENUM)
return val;
if ((val >= 'a' && val <= 'z') || (val >= '0' && val <= '9'))
static struct type *
ada_typedef_target_type (struct type *type)
{
- while (TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
+ while (type->code () == TYPE_CODE_TYPEDEF)
type = TYPE_TARGET_TYPE (type);
return type;
}
ada_discrete_type_high_bound (struct type *type)
{
type = resolve_dynamic_type (type, {}, 0);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_RANGE:
return TYPE_HIGH_BOUND (type);
ada_discrete_type_low_bound (struct type *type)
{
type = resolve_dynamic_type (type, {}, 0);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_RANGE:
return TYPE_LOW_BOUND (type);
static struct type *
get_base_type (struct type *type)
{
- while (type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE)
+ while (type != NULL && type->code () == TYPE_CODE_RANGE)
{
if (type == TYPE_TARGET_TYPE (type) || TYPE_TARGET_TYPE (type) == NULL)
return type;
if (ada_is_array_descriptor_type (type)
|| (ada_is_constrained_packed_array_type (type)
- && TYPE_CODE (type) != TYPE_CODE_PTR))
+ && type->code () != TYPE_CODE_PTR))
{
- if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) /* array access type. */
+ if (type->code () == TYPE_CODE_TYPEDEF) /* array access type. */
value = ada_coerce_to_simple_array_ptr (value);
else
value = ada_coerce_to_simple_array (value);
if (type == NULL)
return NULL;
type = ada_check_typedef (type);
- if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
+ if (type->code () == TYPE_CODE_TYPEDEF)
type = ada_typedef_target_type (type);
if (type != NULL
- && (TYPE_CODE (type) == TYPE_CODE_PTR
- || TYPE_CODE (type) == TYPE_CODE_REF))
+ && (type->code () == TYPE_CODE_PTR
+ || type->code () == TYPE_CODE_REF))
return ada_check_typedef (TYPE_TARGET_TYPE (type));
else
return type;
data_type = lookup_pointer_type (data_type);
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ if (type->code () == TYPE_CODE_PTR)
return value_cast (data_type, value_copy (val));
else
return value_from_longest (data_type, value_address (val));
is_thick_pntr (struct type *type)
{
type = desc_base_type (type);
- return (type != NULL && TYPE_CODE (type) == TYPE_CODE_STRUCT
+ return (type != NULL && type->code () == TYPE_CODE_STRUCT
&& lookup_struct_elt_type (type, "P_BOUNDS", 1) != NULL);
}
if (r != NULL)
return ada_check_typedef (r);
}
- else if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ else if (type->code () == TYPE_CODE_STRUCT)
{
r = lookup_struct_elt_type (type, "P_BOUNDS", 1);
if (r != NULL)
/* NOTE: The following calculation is not really kosher, but
since desc_type is an XVE-encoded type (and shouldn't be),
the correct calculation is a real pain. FIXME (and fix GCC). */
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ if (type->code () == TYPE_CODE_PTR)
addr = value_as_long (arr);
else
addr = value_address (arr);
struct type *p_bounds_type = value_type (p_bounds);
if (p_bounds_type
- && TYPE_CODE (p_bounds_type) == TYPE_CODE_PTR)
+ && p_bounds_type->code () == TYPE_CODE_PTR)
{
struct type *target_type = TYPE_TARGET_TYPE (p_bounds_type);
struct type *data_type = lookup_struct_elt_type (type, "P_ARRAY", 1);
if (data_type
- && TYPE_CODE (ada_check_typedef (data_type)) == TYPE_CODE_PTR)
+ && ada_check_typedef (data_type)->code () == TYPE_CODE_PTR)
return ada_check_typedef (TYPE_TARGET_TYPE (data_type));
}
{
type = desc_base_type (type);
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
return lookup_struct_elt_type (type, bound_name[2 * i - 2], 1);
else
return NULL;
if (type == NULL)
return 0;
type = ada_check_typedef (type);
- return (TYPE_CODE (type) == TYPE_CODE_ARRAY
+ return (type->code () == TYPE_CODE_ARRAY
|| ada_is_array_descriptor_type (type));
}
static int
ada_is_array_type (struct type *type)
{
- while (type != NULL
- && (TYPE_CODE (type) == TYPE_CODE_PTR
- || TYPE_CODE (type) == TYPE_CODE_REF))
+ while (type != NULL
+ && (type->code () == TYPE_CODE_PTR
+ || type->code () == TYPE_CODE_REF))
type = TYPE_TARGET_TYPE (type);
return ada_is_direct_array_type (type);
}
if (type == NULL)
return 0;
type = ada_check_typedef (type);
- return (TYPE_CODE (type) == TYPE_CODE_ARRAY
- || (TYPE_CODE (type) == TYPE_CODE_PTR
- && TYPE_CODE (ada_check_typedef (TYPE_TARGET_TYPE (type)))
- == TYPE_CODE_ARRAY));
+ return (type->code () == TYPE_CODE_ARRAY
+ || (type->code () == TYPE_CODE_PTR
+ && (ada_check_typedef (TYPE_TARGET_TYPE (type))->code ()
+ == TYPE_CODE_ARRAY)));
}
/* Non-zero iff TYPE belongs to a GNAT array descriptor. */
return 0;
type = ada_check_typedef (type);
return (data_type != NULL
- && TYPE_CODE (data_type) == TYPE_CODE_ARRAY
+ && data_type->code () == TYPE_CODE_ARRAY
&& desc_arity (desc_bounds_type (type)) > 0);
}
{
return
type != NULL
- && TYPE_CODE (type) == TYPE_CODE_STRUCT
+ && type->code () == TYPE_CODE_STRUCT
&& (lookup_struct_elt_type (type, "P_BOUNDS", 1) != NULL
|| lookup_struct_elt_type (type, "P_ARRAY", 1) != NULL)
&& !ada_is_array_descriptor_type (type);
/* Access to arrays implemented as fat pointers are encoded as a typedef
of the fat pointer type. We need the name of the fat pointer type
to do the decoding, so strip the typedef layer. */
- if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
+ if (type->code () == TYPE_CODE_TYPEDEF)
type = ada_typedef_target_type (type);
raw_name = ada_type_name (ada_check_typedef (type));
LONGEST low_bound, high_bound;
type = ada_check_typedef (type);
- if (TYPE_CODE (type) != TYPE_CODE_ARRAY)
+ if (type->code () != TYPE_CODE_ARRAY)
return type;
index_type_desc = ada_find_parallel_type (type, "___XA");
TYPE_FIELD_BITSIZE (new_type, 0) = *elt_bits;
TYPE_NAME (new_type) = ada_type_name (type);
- if ((TYPE_CODE (check_typedef (index_type)) == TYPE_CODE_RANGE
+ if ((check_typedef (index_type)->code () == TYPE_CODE_RANGE
&& is_dynamic_type (check_typedef (index_type)))
|| get_discrete_bounds (index_type, &low_bound, &high_bound) < 0)
low_bound = high_bound = 0;
}
shadow_type = check_typedef (shadow_type);
- if (TYPE_CODE (shadow_type) != TYPE_CODE_ARRAY)
+ if (shadow_type->code () != TYPE_CODE_ARRAY)
{
lim_warning (_("could not understand bounds "
"information on packed array"));
and "value_ind" routines to perform the dereferencing, as opposed
to using "ada_coerce_ref" or "ada_value_ind". */
arr = coerce_ref (arr);
- if (TYPE_CODE (ada_check_typedef (value_type (arr))) == TYPE_CODE_PTR)
+ if (ada_check_typedef (value_type (arr))->code () == TYPE_CODE_PTR)
arr = value_ind (arr);
type = decode_constrained_packed_array_type (value_type (arr));
elt_type = ada_check_typedef (value_type (arr));
for (i = 0; i < arity; i += 1)
{
- if (TYPE_CODE (elt_type) != TYPE_CODE_ARRAY
+ if (elt_type->code () != TYPE_CODE_ARRAY
|| TYPE_FIELD_BITSIZE (elt_type, 0) == 0)
error
(_("attempt to do packed indexing of "
static int
has_negatives (struct type *type)
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
default:
return 0;
if (VALUE_LVAL (toval) == lval_memory
&& bits > 0
- && (TYPE_CODE (type) == TYPE_CODE_FLT
- || TYPE_CODE (type) == TYPE_CODE_STRUCT))
+ && (type->code () == TYPE_CODE_FLT
+ || type->code () == TYPE_CODE_STRUCT))
{
int len = (value_bitpos (toval)
+ bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT;
struct value *val;
CORE_ADDR to_addr = value_address (toval);
- if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ if (type->code () == TYPE_CODE_FLT)
fromval = value_cast (type, fromval);
read_memory (to_addr, buffer, len);
bool
ada_is_access_to_unconstrained_array (struct type *type)
{
- return (TYPE_CODE (type) == TYPE_CODE_TYPEDEF
+ return (type->code () == TYPE_CODE_TYPEDEF
&& is_thick_pntr (ada_typedef_target_type (type)));
}
elt = ada_coerce_to_simple_array (arr);
elt_type = ada_check_typedef (value_type (elt));
- if (TYPE_CODE (elt_type) == TYPE_CODE_ARRAY
+ if (elt_type->code () == TYPE_CODE_ARRAY
&& TYPE_FIELD_BITSIZE (elt_type, 0) > 0)
return value_subscript_packed (elt, arity, ind);
{
struct type *saved_elt_type = TYPE_TARGET_TYPE (elt_type);
- if (TYPE_CODE (elt_type) != TYPE_CODE_ARRAY)
+ if (elt_type->code () != TYPE_CODE_ARRAY)
error (_("too many subscripts (%d expected)"), k);
elt = value_subscript (elt, pos_atr (ind[k]));
if (ada_is_access_to_unconstrained_array (saved_elt_type)
- && TYPE_CODE (value_type (elt)) != TYPE_CODE_TYPEDEF)
+ && value_type (elt)->code () != TYPE_CODE_TYPEDEF)
{
/* The element is a typedef to an unconstrained array,
except that the value_subscript call stripped the
struct type *type
= check_typedef (value_enclosing_type (array_ind));
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY
+ if (type->code () == TYPE_CODE_ARRAY
&& TYPE_FIELD_BITSIZE (type, 0) > 0)
return value_subscript_packed (array_ind, arity, ind);
LONGEST lwb, upb;
struct value *lwb_value;
- if (TYPE_CODE (type) != TYPE_CODE_ARRAY)
+ if (type->code () != TYPE_CODE_ARRAY)
error (_("too many subscripts (%d expected)"), k);
arr = value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
value_copy (arr));
get_discrete_bounds (TYPE_INDEX_TYPE (type), &lwb, &upb);
- lwb_value = value_from_longest (value_type(ind[k]), lwb);
+ lwb_value = value_from_longest (value_type (ind[k]), lwb);
arr = value_ptradd (arr, pos_atr (ind[k]) - pos_atr (lwb_value));
type = TYPE_TARGET_TYPE (type);
}
type = desc_base_type (type);
arity = 0;
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
return desc_arity (desc_bounds_type (type));
else
- while (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ while (type->code () == TYPE_CODE_ARRAY)
{
arity += 1;
type = ada_check_typedef (TYPE_TARGET_TYPE (type));
{
type = desc_base_type (type);
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
{
int k;
struct type *p_array_type;
}
return p_array_type;
}
- else if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ else if (type->code () == TYPE_CODE_ARRAY)
{
- while (nindices != 0 && TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ while (nindices != 0 && type->code () == TYPE_CODE_ARRAY)
{
type = TYPE_TARGET_TYPE (type);
nindices -= 1;
/* FIXME: The stabs type r(0,0);bound;bound in an array type
has a target type of TYPE_CODE_UNDEF. We compensate here, but
perhaps stabsread.c would make more sense. */
- if (result_type && TYPE_CODE (result_type) == TYPE_CODE_UNDEF)
+ if (result_type && result_type->code () == TYPE_CODE_UNDEF)
result_type = NULL;
}
else
if (arr_type == NULL || !ada_is_simple_array_type (arr_type))
return (LONGEST) - which;
- if (TYPE_CODE (arr_type) == TYPE_CODE_PTR)
+ if (arr_type->code () == TYPE_CODE_PTR)
type = TYPE_TARGET_TYPE (arr_type);
else
type = arr_type;
{
struct type *arr_type;
- if (TYPE_CODE (check_typedef (value_type (arr))) == TYPE_CODE_PTR)
+ if (check_typedef (value_type (arr))->code () == TYPE_CODE_PTR)
arr = value_ind (arr);
arr_type = value_enclosing_type (arr);
struct type *arr_type, *index_type;
int low, high;
- if (TYPE_CODE (check_typedef (value_type (arr))) == TYPE_CODE_PTR)
+ if (check_typedef (value_type (arr))->code () == TYPE_CODE_PTR)
arr = value_ind (arr);
arr_type = value_enclosing_type (arr);
if (index_type != NULL)
{
struct type *base_type;
- if (TYPE_CODE (index_type) == TYPE_CODE_RANGE)
+ if (index_type->code () == TYPE_CODE_RANGE)
base_type = TYPE_TARGET_TYPE (index_type);
else
base_type = index_type;
fprintf_filtered (stream, "%s", sym->print_name ());
if (!print_signatures
|| type == NULL
- || TYPE_CODE (type) != TYPE_CODE_FUNC)
+ || type->code () != TYPE_CODE_FUNC)
return;
if (TYPE_NFIELDS (type) > 0)
fprintf_filtered (stream, ")");
}
if (TYPE_TARGET_TYPE (type) != NULL
- && TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
+ && TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID)
{
fprintf_filtered (stream, " return ");
ada_print_type (TYPE_TARGET_TYPE (type), NULL, stream, -1, 0, flags);
int is_enumeral =
(SYMBOL_CLASS (syms[i].symbol) == LOC_CONST
&& SYMBOL_TYPE (syms[i].symbol) != NULL
- && TYPE_CODE (SYMBOL_TYPE (syms[i].symbol)) == TYPE_CODE_ENUM);
+ && SYMBOL_TYPE (syms[i].symbol)->code () == TYPE_CODE_ENUM);
struct symtab *symtab = NULL;
if (SYMBOL_OBJFILE_OWNED (syms[i].symbol))
}
if (deprocedure_p
- && (TYPE_CODE (SYMBOL_TYPE (exp->elts[pc + 2].symbol))
+ && (SYMBOL_TYPE (exp->elts[pc + 2].symbol)->code ()
== TYPE_CODE_FUNC))
{
replace_operator_with_call (expp, pc, 0, 4,
ftype = ada_check_typedef (ftype);
atype = ada_check_typedef (atype);
- if (TYPE_CODE (ftype) == TYPE_CODE_REF)
+ if (ftype->code () == TYPE_CODE_REF)
ftype = TYPE_TARGET_TYPE (ftype);
- if (TYPE_CODE (atype) == TYPE_CODE_REF)
+ if (atype->code () == TYPE_CODE_REF)
atype = TYPE_TARGET_TYPE (atype);
- switch (TYPE_CODE (ftype))
+ switch (ftype->code ())
{
default:
- return TYPE_CODE (ftype) == TYPE_CODE (atype);
+ return ftype->code () == atype->code ();
case TYPE_CODE_PTR:
- if (TYPE_CODE (atype) == TYPE_CODE_PTR)
+ if (atype->code () == TYPE_CODE_PTR)
return ada_type_match (TYPE_TARGET_TYPE (ftype),
TYPE_TARGET_TYPE (atype), 0);
else
case TYPE_CODE_INT:
case TYPE_CODE_ENUM:
case TYPE_CODE_RANGE:
- switch (TYPE_CODE (atype))
+ switch (atype->code ())
{
case TYPE_CODE_INT:
case TYPE_CODE_ENUM:
}
case TYPE_CODE_ARRAY:
- return (TYPE_CODE (atype) == TYPE_CODE_ARRAY
+ return (atype->code () == TYPE_CODE_ARRAY
|| ada_is_array_descriptor_type (atype));
case TYPE_CODE_STRUCT:
if (ada_is_array_descriptor_type (ftype))
- return (TYPE_CODE (atype) == TYPE_CODE_ARRAY
+ return (atype->code () == TYPE_CODE_ARRAY
|| ada_is_array_descriptor_type (atype));
else
- return (TYPE_CODE (atype) == TYPE_CODE_STRUCT
+ return (atype->code () == TYPE_CODE_STRUCT
&& !ada_is_array_descriptor_type (atype));
case TYPE_CODE_UNION:
case TYPE_CODE_FLT:
- return (TYPE_CODE (atype) == TYPE_CODE (ftype));
+ return (atype->code () == ftype->code ());
}
}
struct type *func_type = SYMBOL_TYPE (func);
if (SYMBOL_CLASS (func) == LOC_CONST
- && TYPE_CODE (func_type) == TYPE_CODE_ENUM)
+ && func_type->code () == TYPE_CODE_ENUM)
return (n_actuals == 0);
- else if (func_type == NULL || TYPE_CODE (func_type) != TYPE_CODE_FUNC)
+ else if (func_type == NULL || func_type->code () != TYPE_CODE_FUNC)
return 0;
if (TYPE_NFIELDS (func_type) != n_actuals)
if (func_type == NULL)
return 1;
- if (TYPE_CODE (func_type) == TYPE_CODE_FUNC)
+ if (func_type->code () == TYPE_CODE_FUNC)
return_type = get_base_type (TYPE_TARGET_TYPE (func_type));
else
return_type = get_base_type (func_type);
context_type = get_base_type (context_type);
- if (TYPE_CODE (return_type) == TYPE_CODE_ENUM)
+ if (return_type->code () == TYPE_CODE_ENUM)
return context_type == NULL || return_type == context_type;
else if (context_type == NULL)
- return TYPE_CODE (return_type) != TYPE_CODE_VOID;
+ return return_type->code () != TYPE_CODE_VOID;
else
- return TYPE_CODE (return_type) == TYPE_CODE (context_type);
+ return return_type->code () == context_type->code ();
}
return 0;
else
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_INT:
case TYPE_CODE_FLT:
return 0;
else
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_INT:
return 1;
return 0;
else
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_INT:
case TYPE_CODE_RANGE:
return 0;
else
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_INT:
case TYPE_CODE_RANGE:
v = NULL;
t1 = t = ada_check_typedef (value_type (arg));
- if (TYPE_CODE (t) == TYPE_CODE_REF)
+ if (t->code () == TYPE_CODE_REF)
{
t1 = TYPE_TARGET_TYPE (t);
if (t1 == NULL)
goto BadValue;
t1 = ada_check_typedef (t1);
- if (TYPE_CODE (t1) == TYPE_CODE_PTR)
+ if (t1->code () == TYPE_CODE_PTR)
{
arg = coerce_ref (arg);
t = t1;
}
}
- while (TYPE_CODE (t) == TYPE_CODE_PTR)
+ while (t->code () == TYPE_CODE_PTR)
{
t1 = TYPE_TARGET_TYPE (t);
if (t1 == NULL)
goto BadValue;
t1 = ada_check_typedef (t1);
- if (TYPE_CODE (t1) == TYPE_CODE_PTR)
+ if (t1->code () == TYPE_CODE_PTR)
{
arg = value_ind (arg);
t = t1;
break;
}
- if (TYPE_CODE (t1) != TYPE_CODE_STRUCT && TYPE_CODE (t1) != TYPE_CODE_UNION)
+ if (t1->code () != TYPE_CODE_STRUCT && t1->code () != TYPE_CODE_UNION)
goto BadValue;
if (t1 == t)
struct type *field_type;
CORE_ADDR address;
- if (TYPE_CODE (t) == TYPE_CODE_PTR)
+ if (t->code () == TYPE_CODE_PTR)
address = value_address (ada_value_ind (arg));
else
address = value_address (ada_coerce_ref (arg));
a reference should mostly be transparent to the user. */
if (ada_is_tagged_type (t1, 0)
- || (TYPE_CODE (t1) == TYPE_CODE_REF
+ || (t1->code () == TYPE_CODE_REF
&& ada_is_tagged_type (TYPE_TARGET_TYPE (t1), 0)))
{
/* We first try to find the searched field in the current type.
{
if (bit_size != 0)
{
- if (TYPE_CODE (t) == TYPE_CODE_REF)
+ if (t->code () == TYPE_CODE_REF)
arg = ada_coerce_ref (arg);
else
arg = ada_value_ind (arg);
struct type *actual_type = ada_check_typedef (value_type (actual));
struct type *formal_type = ada_check_typedef (formal_type0);
struct type *formal_target =
- TYPE_CODE (formal_type) == TYPE_CODE_PTR
+ formal_type->code () == TYPE_CODE_PTR
? ada_check_typedef (TYPE_TARGET_TYPE (formal_type)) : formal_type;
struct type *actual_target =
- TYPE_CODE (actual_type) == TYPE_CODE_PTR
+ actual_type->code () == TYPE_CODE_PTR
? ada_check_typedef (TYPE_TARGET_TYPE (actual_type)) : actual_type;
if (ada_is_array_descriptor_type (formal_target)
- && TYPE_CODE (actual_target) == TYPE_CODE_ARRAY)
+ && actual_target->code () == TYPE_CODE_ARRAY)
return make_array_descriptor (formal_type, actual);
- else if (TYPE_CODE (formal_type) == TYPE_CODE_PTR
- || TYPE_CODE (formal_type) == TYPE_CODE_REF)
+ else if (formal_type->code () == TYPE_CODE_PTR
+ || formal_type->code () == TYPE_CODE_REF)
{
struct value *result;
- if (TYPE_CODE (formal_target) == TYPE_CODE_ARRAY
+ if (formal_target->code () == TYPE_CODE_ARRAY
&& ada_is_array_descriptor_type (actual_target))
result = desc_data (actual);
- else if (TYPE_CODE (formal_type) != TYPE_CODE_PTR)
+ else if (formal_type->code () != TYPE_CODE_PTR)
{
if (VALUE_LVAL (actual) != lval_memory)
{
return actual;
return value_cast_pointers (formal_type, result, 0);
}
- else if (TYPE_CODE (actual_type) == TYPE_CODE_PTR)
+ else if (actual_type->code () == TYPE_CODE_PTR)
return ada_value_ind (actual);
else if (ada_is_aligner_type (formal_type))
{
descriptor = ensure_lval (descriptor);
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ if (type->code () == TYPE_CODE_PTR)
return value_addr (descriptor);
else
return descriptor;
int i;
for (i = 0; i < n; i += 1)
- if (TYPE_CODE (SYMBOL_TYPE (syms[i].symbol)) != TYPE_CODE_FUNC
- && (TYPE_CODE (SYMBOL_TYPE (syms[i].symbol)) != TYPE_CODE_ENUM
+ if (SYMBOL_TYPE (syms[i].symbol)->code () != TYPE_CODE_FUNC
+ && (SYMBOL_TYPE (syms[i].symbol)->code () != TYPE_CODE_ENUM
|| SYMBOL_CLASS (syms[i].symbol) != LOC_CONST))
return 1;
if (type0 == type1)
return 1;
if (type0 == NULL || type1 == NULL
- || TYPE_CODE (type0) != TYPE_CODE (type1))
+ || type0->code () != type1->code ())
return 0;
- if ((TYPE_CODE (type0) == TYPE_CODE_STRUCT
- || TYPE_CODE (type0) == TYPE_CODE_ENUM)
+ if ((type0->code () == TYPE_CODE_STRUCT
+ || type0->code () == TYPE_CODE_ENUM)
&& ada_type_name (type0) != NULL && ada_type_name (type1) != NULL
&& strcmp (ada_type_name (type0), ada_type_name (type1)) == 0)
return 1;
int len0 = strlen (name0);
return
- TYPE_CODE (type0) == TYPE_CODE (type1)
+ type0->code () == type1->code ()
&& (equiv_types (type0, type1)
|| (len0 < strlen (name1) && strncmp (name0, name1, len0) == 0
&& startswith (name1 + len0, "___XV")));
/* Quick check: All symbols should have an enum type. */
for (i = 0; i < syms.size (); i++)
- if (TYPE_CODE (SYMBOL_TYPE (syms[i].symbol)) != TYPE_CODE_ENUM)
+ if (SYMBOL_TYPE (syms[i].symbol)->code () != TYPE_CODE_ENUM)
return 0;
/* Quick check: They should all have the same value. */
{
const char *name;
- if (TYPE_CODE (type) != TYPE_CODE_PTR)
+ if (type->code () != TYPE_CODE_PTR)
return 0;
name = TYPE_NAME (TYPE_TARGET_TYPE (type));
{
type = ada_check_typedef (type);
- if (type == NULL || TYPE_CODE (type) != TYPE_CODE_PTR)
+ if (type == NULL || type->code () != TYPE_CODE_PTR)
return 0;
else
{
/* It is the responsability of the caller to deref pointers. */
- if (TYPE_CODE (obj_type) == TYPE_CODE_PTR
- || TYPE_CODE (obj_type) == TYPE_CODE_REF)
+ if (obj_type->code () == TYPE_CODE_PTR || obj_type->code () == TYPE_CODE_REF)
return obj;
tag = ada_value_tag (obj);
type = ada_check_typedef (type);
- if (type == NULL || TYPE_CODE (type) != TYPE_CODE_STRUCT)
+ if (type == NULL || type->code () != TYPE_CODE_STRUCT)
return NULL;
for (i = 0; i < TYPE_NFIELDS (type); i += 1)
struct type *parent_type = TYPE_FIELD_TYPE (type, i);
/* If the _parent field is a pointer, then dereference it. */
- if (TYPE_CODE (parent_type) == TYPE_CODE_PTR)
+ if (parent_type->code () == TYPE_CODE_PTR)
parent_type = TYPE_TARGET_TYPE (parent_type);
/* If there is a parallel XVS type, get the actual base type. */
parent_type = ada_get_base_type (parent_type);
struct type *field_type = TYPE_FIELD_TYPE (type, field_num);
- return (TYPE_CODE (field_type) == TYPE_CODE_UNION
- || (is_dynamic_field (type, field_num)
- && (TYPE_CODE (TYPE_TARGET_TYPE (field_type))
+ return (field_type->code () == TYPE_CODE_UNION
+ || (is_dynamic_field (type, field_num)
+ && (TYPE_TARGET_TYPE (field_type)->code ()
== TYPE_CODE_UNION)));
}
const char *discrim_end;
const char *discrim_start;
- if (TYPE_CODE (type0) == TYPE_CODE_PTR)
+ if (type0->code () == TYPE_CODE_PTR)
type = TYPE_TARGET_TYPE (type0);
else
type = type0;
while (1)
{
type = ada_check_typedef (type);
- if (TYPE_CODE (type) != TYPE_CODE_PTR
- && TYPE_CODE (type) != TYPE_CODE_REF)
+ if (type->code () != TYPE_CODE_PTR && type->code () != TYPE_CODE_REF)
break;
type = TYPE_TARGET_TYPE (type);
}
if (type == NULL
- || (TYPE_CODE (type) != TYPE_CODE_STRUCT
- && TYPE_CODE (type) != TYPE_CODE_UNION))
+ || (type->code () != TYPE_CODE_STRUCT
+ && type->code () != TYPE_CODE_UNION))
{
if (noerr)
return NULL;
static struct value *
ada_coerce_ref (struct value *val0)
{
- if (TYPE_CODE (value_type (val0)) == TYPE_CODE_REF)
+ if (value_type (val0)->code () == TYPE_CODE_REF)
{
struct value *val = val0;
return 1;
else if (type0 == NULL)
return 0;
- else if (TYPE_CODE (type1) == TYPE_CODE_VOID)
+ else if (type1->code () == TYPE_CODE_VOID)
return 1;
- else if (TYPE_CODE (type0) == TYPE_CODE_VOID)
+ else if (type0->code () == TYPE_CODE_VOID)
return 0;
else if (TYPE_NAME (type1) == NULL && TYPE_NAME (type0) != NULL)
return 1;
{
type = ada_check_typedef (type);
- if (type == NULL || TYPE_CODE (type) != TYPE_CODE_STRUCT
+ if (type == NULL || type->code () != TYPE_CODE_STRUCT
|| ada_type_name (type) == NULL)
return NULL;
else
const char *name = TYPE_FIELD_NAME (templ_type, field_num);
return name != NULL
- && TYPE_CODE (TYPE_FIELD_TYPE (templ_type, field_num)) == TYPE_CODE_PTR
+ && TYPE_FIELD_TYPE (templ_type, field_num)->code () == TYPE_CODE_PTR
&& strstr (name, "___XVL") != NULL;
}
{
int f;
- if (type == NULL || TYPE_CODE (type) != TYPE_CODE_STRUCT)
+ if (type == NULL || type->code () != TYPE_CODE_STRUCT)
return -1;
for (f = 0; f < TYPE_NFIELDS (type); f += 1)
the length of our field. If this is a typedef,
get the length of the target type, not the length
of the typedef. */
- if (TYPE_CODE (field_type) == TYPE_CODE_TYPEDEF)
+ if (field_type->code () == TYPE_CODE_TYPEDEF)
field_type = ada_typedef_target_type (field_type);
fld_bit_len =
if (type == type0)
{
TYPE_TARGET_TYPE (type0) = type = alloc_type_copy (type0);
- type->set_code (TYPE_CODE(type0));
+ type->set_code (type0->code ());
INIT_NONE_SPECIFIC (type);
TYPE_NFIELDS (type) = nfields;
TYPE_FIELDS (type) = (struct field *)
struct type *templ_type;
struct type *var_type;
- if (TYPE_CODE (var_type0) == TYPE_CODE_PTR)
+ if (var_type0->code () == TYPE_CODE_PTR)
var_type = TYPE_TARGET_TYPE (var_type0);
else
var_type = var_type0;
int n;
LONGEST lo, hi;
- gdb_assert (TYPE_CODE (range_type) == TYPE_CODE_RANGE);
+ gdb_assert (range_type->code () == TYPE_CODE_RANGE);
- if (TYPE_CODE (get_base_type (range_type))
- != TYPE_CODE (get_base_type (encoding_type)))
+ if (get_base_type (range_type)->code ()
+ != get_base_type (encoding_type)->code ())
{
/* The compiler probably used a simple base type to describe
the range type instead of the range's actual base type,
if (!HAVE_GNAT_AUX_INFO (type))
return type;
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
default:
return type;
only in that situation. But this seems unnecessary so far, probably
because we call check_typedef/ada_check_typedef pretty much everywhere.
*/
- if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF
+ if (type->code () == TYPE_CODE_TYPEDEF
&& (TYPE_MAIN_TYPE (ada_typedef_target_type (type))
== TYPE_MAIN_TYPE (fixed_type)))
return type;
type0 = ada_check_typedef (type0);
- switch (TYPE_CODE (type0))
+ switch (type0->code ())
{
default:
return type0;
return type;
type = check_typedef (type);
- if (type == NULL || TYPE_CODE (type) != TYPE_CODE_ENUM
+ if (type == NULL || type->code () != TYPE_CODE_ENUM
|| !TYPE_STUB (type)
|| TYPE_NAME (type) == NULL)
return type;
stubs pointing to arrays, as we don't create symbols for array
types, only for the typedef-to-array types). If that's the case,
strip the typedef layer. */
- if (TYPE_CODE (type1) == TYPE_CODE_TYPEDEF)
+ if (type1->code () == TYPE_CODE_TYPEDEF)
type1 = ada_check_typedef (type1);
return type1;
if (!integer_type_p (value_type (arg)))
error (_("'VAL requires integral argument"));
- if (TYPE_CODE (type) == TYPE_CODE_ENUM)
+ if (type->code () == TYPE_CODE_ENUM)
{
long pos = value_as_long (arg);
/* If the type code says it's a character, then assume it really is,
and don't check any further. */
- if (TYPE_CODE (type) == TYPE_CODE_CHAR)
+ if (type->code () == TYPE_CODE_CHAR)
return true;
/* Otherwise, assume it's a character type iff it is a discrete type
with a known character type name. */
name = ada_type_name (type);
return (name != NULL
- && (TYPE_CODE (type) == TYPE_CODE_INT
- || TYPE_CODE (type) == TYPE_CODE_RANGE)
+ && (type->code () == TYPE_CODE_INT
+ || type->code () == TYPE_CODE_RANGE)
&& (strcmp (name, "character") == 0
|| strcmp (name, "wide_character") == 0
|| strcmp (name, "wide_wide_character") == 0
{
type = ada_check_typedef (type);
if (type != NULL
- && TYPE_CODE (type) != TYPE_CODE_PTR
+ && type->code () != TYPE_CODE_PTR
&& (ada_is_simple_array_type (type)
|| ada_is_array_descriptor_type (type))
&& ada_array_arity (type) == 1)
if (!trust_pad_over_xvs && ada_find_parallel_type (type, "___XVS") != NULL)
return 0;
- return (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ return (type->code () == TYPE_CODE_STRUCT
&& TYPE_NFIELDS (type) == 1
&& strcmp (TYPE_FIELD_NAME (type, 0), "F") == 0);
}
struct type *real_type_namer;
struct type *raw_real_type;
- if (raw_type == NULL || TYPE_CODE (raw_type) != TYPE_CODE_STRUCT)
+ if (raw_type == NULL || raw_type->code () != TYPE_CODE_STRUCT)
return raw_type;
if (ada_is_aligner_type (raw_type))
real_type_namer = ada_find_parallel_type (raw_type, "___XVS");
if (real_type_namer == NULL
- || TYPE_CODE (real_type_namer) != TYPE_CODE_STRUCT
+ || real_type_namer->code () != TYPE_CODE_STRUCT
|| TYPE_NFIELDS (real_type_namer) != 1)
return raw_type;
- if (TYPE_CODE (TYPE_FIELD_TYPE (real_type_namer, 0)) != TYPE_CODE_REF)
+ if (TYPE_FIELD_TYPE (real_type_namer, 0)->code () != TYPE_CODE_REF)
{
/* This is an older encoding form where the base type needs to be
looked up by name. We prefer the newer encoding because it is
/* Verify that both val and type are arrays of scalars, and
that the size of val's elements is smaller than the size
of type's element. */
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_ARRAY);
+ gdb_assert (type->code () == TYPE_CODE_ARRAY);
gdb_assert (is_integral_type (TYPE_TARGET_TYPE (type)));
- gdb_assert (TYPE_CODE (value_type (val)) == TYPE_CODE_ARRAY);
+ gdb_assert (value_type (val)->code () == TYPE_CODE_ARRAY);
gdb_assert (is_integral_type (TYPE_TARGET_TYPE (value_type (val))));
gdb_assert (TYPE_LENGTH (TYPE_TARGET_TYPE (type))
> TYPE_LENGTH (TYPE_TARGET_TYPE (value_type (val))));
type2 = ada_check_typedef (type2);
type = ada_check_typedef (type);
- if (TYPE_CODE (type2) == TYPE_CODE_PTR
- && TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ if (type2->code () == TYPE_CODE_PTR
+ && type->code () == TYPE_CODE_ARRAY)
{
val = ada_value_ind (val);
type2 = value_type (val);
}
- if (TYPE_CODE (type2) == TYPE_CODE_ARRAY
- && TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ if (type2->code () == TYPE_CODE_ARRAY
+ && type->code () == TYPE_CODE_ARRAY)
{
if (!ada_same_array_size_p (type, type2))
error (_("cannot assign arrays of different length"));
type1 = get_base_type (ada_check_typedef (value_type (arg1)));
type2 = get_base_type (ada_check_typedef (value_type (arg2)));
- if (TYPE_CODE (type1) != TYPE_CODE_INT
- || TYPE_CODE (type2) != TYPE_CODE_INT)
+ if (type1->code () != TYPE_CODE_INT
+ || type2->code () != TYPE_CODE_INT)
return value_binop (arg1, arg2, op);
switch (op)
arg1_type = ada_check_typedef (value_type (arg1));
arg2_type = ada_check_typedef (value_type (arg2));
- if (TYPE_CODE (arg1_type) != TYPE_CODE_ARRAY
- || TYPE_CODE (arg2_type) != TYPE_CODE_ARRAY)
+ if (arg1_type->code () != TYPE_CODE_ARRAY
+ || arg2_type->code () != TYPE_CODE_ARRAY)
error (_("Attempt to compare array with non-array"));
/* FIXME: The following works only for types whose
representations use all bits (no padding or undefined bits)
struct value *elt;
struct type *lhs_type = check_typedef (value_type (lhs));
- if (TYPE_CODE (lhs_type) == TYPE_CODE_ARRAY)
+ if (lhs_type->code () == TYPE_CODE_ARRAY)
{
struct type *index_type = builtin_type (exp->gdbarch)->builtin_int;
struct value *index_val = value_from_longest (index_type, index);
low_index = TYPE_ARRAY_LOWER_BOUND_VALUE (lhs_type);
high_index = TYPE_ARRAY_UPPER_BOUND_VALUE (lhs_type);
}
- else if (TYPE_CODE (lhs_type) == TYPE_CODE_STRUCT)
+ else if (lhs_type->code () == TYPE_CODE_STRUCT)
{
low_index = 0;
high_index = num_visible_fields (lhs_type) - 1;
result = evaluate_subexp_standard (expect_type, exp, pos, noside);
/* The result type will have code OP_STRING, bashed there from
OP_ARRAY. Bash it back. */
- if (TYPE_CODE (value_type (result)) == TYPE_CODE_STRING)
+ if (value_type (result)->code () == TYPE_CODE_STRING)
value_type (result)->set_code (TYPE_CODE_ARRAY);
return result;
}
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
- if (TYPE_CODE (value_type (arg1)) == TYPE_CODE_PTR)
+ if (value_type (arg1)->code () == TYPE_CODE_PTR)
return (value_from_longest
(value_type (arg1),
value_as_long (arg1) + value_as_long (arg2)));
- if (TYPE_CODE (value_type (arg2)) == TYPE_CODE_PTR)
+ if (value_type (arg2)->code () == TYPE_CODE_PTR)
return (value_from_longest
(value_type (arg2),
value_as_long (arg1) + value_as_long (arg2)));
argument. We cannot cast the result to a reference type, so if
ARG1 is a reference type, find its underlying type. */
type = value_type (arg1);
- while (TYPE_CODE (type) == TYPE_CODE_REF)
+ while (type->code () == TYPE_CODE_REF)
type = TYPE_TARGET_TYPE (type);
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
return value_cast (type, value_binop (arg1, arg2, BINOP_ADD));
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
- if (TYPE_CODE (value_type (arg1)) == TYPE_CODE_PTR)
+ if (value_type (arg1)->code () == TYPE_CODE_PTR)
return (value_from_longest
(value_type (arg1),
value_as_long (arg1) - value_as_long (arg2)));
- if (TYPE_CODE (value_type (arg2)) == TYPE_CODE_PTR)
+ if (value_type (arg2)->code () == TYPE_CODE_PTR)
return (value_from_longest
(value_type (arg2),
value_as_long (arg1) - value_as_long (arg2)));
argument. We cannot cast the result to a reference type, so if
ARG1 is a reference type, find its underlying type. */
type = value_type (arg1);
- while (TYPE_CODE (type) == TYPE_CODE_REF)
+ while (type->code () == TYPE_CODE_REF)
type = TYPE_TARGET_TYPE (type);
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
return value_cast (type, value_binop (arg1, arg2, BINOP_SUB));
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)
- || (TYPE_CODE (type) == TYPE_CODE_REF
+ || (type->code () == TYPE_CODE_REF
&& ada_is_tagged_type (TYPE_TARGET_TYPE (type), 0)))
{
/* Tagged types are a little special in the fact that the real
type in the type description. */
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_NORMAL);
- if (TYPE_CODE (type) != TYPE_CODE_REF)
+ if (type->code () != TYPE_CODE_REF)
{
struct type *actual_type;
For instance, a case statement in a variant record would be
replaced by the relevant components based on the actual
value of the discriminants. */
- if ((TYPE_CODE (type) == TYPE_CODE_STRUCT
+ if ((type->code () == TYPE_CODE_STRUCT
&& dynamic_template_type (type) != NULL)
- || (TYPE_CODE (type) == TYPE_CODE_UNION
+ || (type->code () == TYPE_CODE_UNION
&& ada_find_parallel_type (type, "___XVU") != NULL))
{
*pos += 4;
if (ada_is_constrained_packed_array_type
(desc_base_type (value_type (argvec[0]))))
argvec[0] = ada_coerce_to_simple_array (argvec[0]);
- else if (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_ARRAY
+ else if (value_type (argvec[0])->code () == TYPE_CODE_ARRAY
&& TYPE_FIELD_BITSIZE (value_type (argvec[0]), 0) != 0)
/* This is a packed array that has already been fixed, and
therefore already coerced to a simple array. Nothing further
to do. */
;
- else if (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_REF)
+ else if (value_type (argvec[0])->code () == TYPE_CODE_REF)
{
/* Make sure we dereference references so that all the code below
feels like it's really handling the referenced value. Wrapping
well. */
argvec[0] = ada_to_fixed_value (coerce_ref (argvec[0]));
}
- else if (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_ARRAY
+ else if (value_type (argvec[0])->code () == TYPE_CODE_ARRAY
&& VALUE_LVAL (argvec[0]) == lval_memory)
argvec[0] = value_addr (argvec[0]);
/* Ada allows us to implicitly dereference arrays when subscripting
them. So, if this is an array typedef (encoding use for array
access types encoded as fat pointers), strip it now. */
- if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
+ if (type->code () == TYPE_CODE_TYPEDEF)
type = ada_typedef_target_type (type);
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ if (type->code () == TYPE_CODE_PTR)
{
- switch (TYPE_CODE (ada_check_typedef (TYPE_TARGET_TYPE (type))))
+ switch (ada_check_typedef (TYPE_TARGET_TYPE (type))->code ())
{
case TYPE_CODE_FUNC:
type = ada_check_typedef (TYPE_TARGET_TYPE (type));
}
}
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_FUNC:
if (noside == EVAL_AVOID_SIDE_EFFECTS)
/* If this is a reference to an aligner type, then remove all
the aligners. */
- if (TYPE_CODE (value_type (array)) == TYPE_CODE_REF
+ if (value_type (array)->code () == TYPE_CODE_REF
&& ada_is_aligner_type (TYPE_TARGET_TYPE (value_type (array))))
TYPE_TARGET_TYPE (value_type (array)) =
ada_aligned_type (TYPE_TARGET_TYPE (value_type (array)));
/* If this is a reference to an array or an array lvalue,
convert to a pointer. */
- if (TYPE_CODE (value_type (array)) == TYPE_CODE_REF
- || (TYPE_CODE (value_type (array)) == TYPE_CODE_ARRAY
+ if (value_type (array)->code () == TYPE_CODE_REF
+ || (value_type (array)->code () == TYPE_CODE_ARRAY
&& VALUE_LVAL (array) == lval_memory))
array = value_addr (array);
/* If we have more than one level of pointer indirection,
dereference the value until we get only one level. */
- while (TYPE_CODE (value_type (array)) == TYPE_CODE_PTR
- && (TYPE_CODE (TYPE_TARGET_TYPE (value_type (array)))
+ while (value_type (array)->code () == TYPE_CODE_PTR
+ && (TYPE_TARGET_TYPE (value_type (array))->code ()
== TYPE_CODE_PTR))
array = value_ind (array);
if (!ada_is_simple_array_type (value_type (array)))
error (_("cannot take slice of non-array"));
- if (TYPE_CODE (ada_check_typedef (value_type (array)))
+ if (ada_check_typedef (value_type (array))->code ()
== TYPE_CODE_PTR)
{
struct type *type0 = ada_check_typedef (value_type (array));
if (noside == EVAL_SKIP)
goto nosideret;
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
default:
lim_warning (_("Membership test incompletely implemented; "
const char *name = ada_type_name (type_arg);
range_type = NULL;
- if (name != NULL && TYPE_CODE (type_arg) != TYPE_CODE_ENUM)
+ if (name != NULL && type_arg->code () != TYPE_CODE_ENUM)
range_type = to_fixed_range_type (type_arg, NULL);
if (range_type == NULL)
range_type = type_arg;
error (_("the 'length attribute applies only to array types"));
}
}
- else if (TYPE_CODE (type_arg) == TYPE_CODE_FLT)
+ else if (type_arg->code () == TYPE_CODE_FLT)
error (_("unimplemented type attribute"));
else
{
/* If the argument is a reference, then dereference its type, since
the user is really asking for the size of the actual object,
not the size of the pointer. */
- if (TYPE_CODE (type) == TYPE_CODE_REF)
+ if (type->code () == TYPE_CODE_REF)
type = TYPE_TARGET_TYPE (type);
if (noside == EVAL_SKIP)
error (_("Attempt to dereference null array pointer."));
return value_at_lazy (arrType, 0);
}
- else if (TYPE_CODE (type) == TYPE_CODE_PTR
- || TYPE_CODE (type) == TYPE_CODE_REF
+ else if (type->code () == TYPE_CODE_PTR
+ || type->code () == TYPE_CODE_REF
/* In C you can dereference an array to get the 1st elt. */
- || TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ || type->code () == TYPE_CODE_ARRAY)
{
/* As mentioned in the OP_VAR_VALUE case, tagged types can
only be determined by inspecting the object's tag.
This means that we need to evaluate completely the
expression in order to get its type. */
- if ((TYPE_CODE (type) == TYPE_CODE_REF
- || TYPE_CODE (type) == TYPE_CODE_PTR)
+ if ((type->code () == TYPE_CODE_REF
+ || type->code () == TYPE_CODE_PTR)
&& ada_is_tagged_type (TYPE_TARGET_TYPE (type), 0))
{
arg1 = evaluate_subexp (NULL_TYPE, exp, &preeval_pos,
ada_ensure_varsize_limit (type);
return value_zero (type, lval_memory);
}
- else if (TYPE_CODE (type) == TYPE_CODE_INT)
+ else if (type->code () == TYPE_CODE_INT)
{
/* GDB allows dereferencing an int. */
if (expect_type == NULL)
arg1 = ada_coerce_ref (arg1); /* FIXME: What is this for?? */
type = ada_check_typedef (value_type (arg1));
- if (TYPE_CODE (type) == TYPE_CODE_INT)
+ if (type->code () == TYPE_CODE_INT)
/* GDB allows dereferencing an int. If we were given
the expect_type, then use that as the target type.
Otherwise, assume that the target type is an int. */
fixed_type_info (struct type *type)
{
const char *name = ada_type_name (type);
- enum type_code code = (type == NULL) ? TYPE_CODE_UNDEF : TYPE_CODE (type);
+ enum type_code code = (type == NULL) ? TYPE_CODE_UNDEF : type->code ();
if ((code == TYPE_CODE_INT || code == TYPE_CODE_RANGE) && name != NULL)
{
gdb_assert (raw_type != NULL);
gdb_assert (TYPE_NAME (raw_type) != NULL);
- if (TYPE_CODE (raw_type) == TYPE_CODE_RANGE)
+ if (raw_type->code () == TYPE_CODE_RANGE)
base_type = TYPE_TARGET_TYPE (raw_type);
else
base_type = raw_type;
{
struct type *subranged_type = get_base_type (type);
- return (subranged_type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE
- && TYPE_CODE (subranged_type) == TYPE_CODE_INT
+ return (subranged_type != NULL && type->code () == TYPE_CODE_RANGE
+ && subranged_type->code () == TYPE_CODE_INT
&& TYPE_UNSIGNED (subranged_type));
}
case OP_ATR_VAL:
if (exp->elts[*pos].opcode == OP_TYPE)
{
- if (TYPE_CODE (exp->elts[*pos + 1].type) != TYPE_CODE_VOID)
+ if (exp->elts[*pos + 1].type->code () != TYPE_CODE_VOID)
LA_PRINT_TYPE (exp->elts[*pos + 1].type, "", stream, 0, 0,
&type_print_raw_options);
*pos += 3;
bounds_fieldno = ada_get_field_index (type, "P_BOUNDS", 0);
bounds_type = TYPE_FIELD_TYPE (type, bounds_fieldno);
- if (TYPE_CODE (bounds_type) == TYPE_CODE_PTR)
+ if (bounds_type->code () == TYPE_CODE_PTR)
bounds_type = TYPE_TARGET_TYPE (bounds_type);
- if (TYPE_CODE (bounds_type) != TYPE_CODE_STRUCT)
+ if (bounds_type->code () != TYPE_CODE_STRUCT)
error (_("Unknown task name format. Aborting"));
upper_bound_fieldno = ada_get_field_index (bounds_type, "UB0", 0);
struct type *eltype = NULL;
struct type *idxtype = NULL;
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ if (type->code () == TYPE_CODE_ARRAY)
eltype = check_typedef (TYPE_TARGET_TYPE (type));
if (eltype != NULL
- && TYPE_CODE (eltype) == TYPE_CODE_PTR)
+ && eltype->code () == TYPE_CODE_PTR)
idxtype = check_typedef (TYPE_INDEX_TYPE (type));
if (idxtype != NULL
&& !TYPE_LOW_BOUND_UNDEFINED (idxtype)
/* Validate. */
struct type *type = check_typedef (SYMBOL_TYPE (sym));
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ if (type->code () == TYPE_CODE_PTR)
{
data->known_tasks_element = type;
return;
{
struct type *subtype;
- if (TYPE_CODE (type) != TYPE_CODE_RANGE)
+ if (type->code () != TYPE_CODE_RANGE)
return 0;
subtype = TYPE_TARGET_TYPE (type);
type = TYPE_TARGET_TYPE (type);
}
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_RANGE:
case TYPE_CODE_ENUM:
to indicate default output when we detect that the bound is negative,
and the type is a TYPE_CODE_INT. The bound is negative when
'm' is the last character of the number scanned in BOUNDS. */
- if (bounds[*n - 1] == 'm' && TYPE_CODE (type) == TYPE_CODE_INT)
+ if (bounds[*n - 1] == 'm' && type->code () == TYPE_CODE_INT)
type = NULL;
ada_print_scalar (type, B, stream);
if (bounds[*n] == '_')
name = TYPE_NAME (raw_type);
gdb_assert (name != NULL);
- if (TYPE_CODE (raw_type) == TYPE_CODE_RANGE)
+ if (raw_type->code () == TYPE_CODE_RANGE)
base_type = TYPE_TARGET_TYPE (raw_type);
else
base_type = raw_type;
bitsize = 0;
if (range_desc_type == NULL)
{
- for (arr_type = type; TYPE_CODE (arr_type) == TYPE_CODE_ARRAY;
+ for (arr_type = type; arr_type->code () == TYPE_CODE_ARRAY;
arr_type = TYPE_TARGET_TYPE (arr_type))
{
if (arr_type != type)
var_type = TYPE_FIELD_TYPE (type, field_num);
discr_type = ada_variant_discrim_type (var_type, outer_type);
- if (TYPE_CODE (var_type) == TYPE_CODE_PTR)
+ if (var_type->code () == TYPE_CODE_PTR)
{
var_type = TYPE_TARGET_TYPE (var_type);
- if (var_type == NULL || TYPE_CODE (var_type) != TYPE_CODE_UNION)
+ if (var_type == NULL || var_type->code () != TYPE_CODE_UNION)
return;
}
int i, len = TYPE_NFIELDS (type);
if (TYPE_TARGET_TYPE (type) != NULL
- && TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID)
+ && TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_VOID)
fprintf_filtered (stream, "procedure");
else
fprintf_filtered (stream, "function");
if (TYPE_TARGET_TYPE (type) == NULL)
fprintf_filtered (stream, " return <unknown return type>");
- else if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
+ else if (TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID)
{
fprintf_filtered (stream, " return ");
ada_print_type (TYPE_TARGET_TYPE (type), "", stream, 0, 0, flags);
if (show > 0)
type = ada_check_typedef (type);
- if (is_var_decl && TYPE_CODE (type) != TYPE_CODE_FUNC)
+ if (is_var_decl && type->code () != TYPE_CODE_FUNC)
fprintf_filtered (stream, "%.*s: ",
ada_name_prefix_len (varstring), varstring);
if (ada_is_aligner_type (type))
ada_print_type (ada_aligned_type (type), "", stream, show, level, flags);
else if (ada_is_constrained_packed_array_type (type)
- && TYPE_CODE (type) != TYPE_CODE_PTR)
+ && type->code () != TYPE_CODE_PTR)
print_array_type (type, stream, show, level, flags);
else
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
default:
fprintf_filtered (stream, "<");
static void
adjust_type_signedness (struct type *type)
{
- if (type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE
+ if (type != NULL && type->code () == TYPE_CODE_RANGE
&& TYPE_LOW_BOUND (type) >= 0)
TYPE_UNSIGNED (type) = 1;
}
index_type = TYPE_INDEX_TYPE (type);
- while (TYPE_CODE (index_type) == TYPE_CODE_RANGE)
+ while (index_type->code () == TYPE_CODE_RANGE)
{
/* We need to know what the base type is, in order to do the
appropriate check below. Otherwise, if this is a subrange
}
/* Don't print the lower bound if it's the default one. */
- switch (TYPE_CODE (index_type))
+ switch (index_type->code ())
{
case TYPE_CODE_BOOL:
case TYPE_CODE_CHAR:
else
len = high - low + 1;
- if (TYPE_CODE (index_type) == TYPE_CODE_RANGE)
+ if (index_type->code () == TYPE_CODE_RANGE)
base_index_type = TYPE_TARGET_TYPE (index_type);
else
base_index_type = index_type;
- if (TYPE_CODE (base_index_type) == TYPE_CODE_ENUM)
+ if (base_index_type->code () == TYPE_CODE_ENUM)
{
LONGEST low_pos, high_pos;
type = ada_check_typedef (type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_ENUM:
of the case where ADDRESS is meaningless because original_value
was not an lval. */
val = coerce_ref (val);
- if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF) /* array access type. */
+ if (type->code () == TYPE_CODE_TYPEDEF) /* array access type. */
val = ada_coerce_to_simple_array_ptr (val);
else
val = ada_coerce_to_simple_array (val);
if (val == NULL)
{
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_TYPEDEF);
+ gdb_assert (type->code () == TYPE_CODE_TYPEDEF);
fprintf_filtered (stream, "0x0");
}
else
fputs_filtered (str.c_str (), stream);
return;
}
- else if (TYPE_CODE (type) == TYPE_CODE_RANGE
- && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ENUM
- || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_BOOL
- || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CHAR))
+ else if (type->code () == TYPE_CODE_RANGE
+ && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ENUM
+ || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_BOOL
+ || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_CHAR))
{
/* For enum-valued ranges, we want to recurse, because we'll end
up printing the constant's name rather than its numeric
struct value *deref_val;
CORE_ADDR deref_val_int;
- if (TYPE_CODE (elttype) == TYPE_CODE_UNDEF)
+ if (elttype->code () == TYPE_CODE_UNDEF)
{
fputs_styled ("<ref to undefined type>", metadata_style.style (),
stream);
if (ada_is_array_descriptor_type (type)
|| (ada_is_constrained_packed_array_type (type)
- && TYPE_CODE (type) != TYPE_CODE_PTR))
+ && type->code () != TYPE_CODE_PTR))
{
ada_val_print_gnat_array (val, stream, recurse, options);
return;
deprecated_set_value_type (val, type);
}
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
default:
common_val_print (val, stream, recurse, options,
struct value_print_options opts;
/* If it is a pointer, indicate what it points to. */
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ if (type->code () == TYPE_CODE_PTR)
{
/* Hack: don't print (char *) for char strings. Their
type is indicated by the quoted string anyway. */
if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) != sizeof (char)
- || TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_INT
+ || TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_INT
|| TYPE_UNSIGNED (TYPE_TARGET_TYPE (type)))
{
fprintf_filtered (stream, "(");
/* We do not print the type description unless TYPE is an array
access type (this is encoded by the compiler as a typedef to
a fat pointer - hence the check against TYPE_CODE_TYPEDEF). */
- if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
+ if (type->code () == TYPE_CODE_TYPEDEF)
{
fprintf_filtered (stream, "(");
type_print (type, "", stream, -1);
ada_get_decoded_value would have transformed our parent_type
into a simple array pointer type. */
gdb_assert (parent_value == NULL);
- gdb_assert (TYPE_CODE (parent_type) == TYPE_CODE_TYPEDEF);
+ gdb_assert (parent_type->code () == TYPE_CODE_TYPEDEF);
/* Decode parent_type by the equivalent pointer to (decoded)
array. */
- while (TYPE_CODE (parent_type) == TYPE_CODE_TYPEDEF)
+ while (parent_type->code () == TYPE_CODE_TYPEDEF)
parent_type = TYPE_TARGET_TYPE (parent_type);
parent_type = ada_coerce_to_simple_array_type (parent_type);
parent_type = lookup_pointer_type (parent_type);
one child (the struct), their children are the components of
the struct/union type. We handle this situation by dereferencing
the (value, type) couple. */
- if (TYPE_CODE (*type) == TYPE_CODE_PTR
- && (TYPE_CODE (TYPE_TARGET_TYPE (*type)) == TYPE_CODE_STRUCT
- || TYPE_CODE (TYPE_TARGET_TYPE (*type)) == TYPE_CODE_UNION)
+ if ((*type)->code () == TYPE_CODE_PTR
+ && (TYPE_TARGET_TYPE (*type)->code () == TYPE_CODE_STRUCT
+ || TYPE_TARGET_TYPE (*type)->code () == TYPE_CODE_UNION)
&& !ada_is_array_descriptor_type (TYPE_TARGET_TYPE (*type))
&& !ada_is_constrained_packed_array_type (TYPE_TARGET_TYPE (*type)))
ada_varobj_ind (*value, *type, value, type);
int n_children = 0;
int i;
- gdb_assert (TYPE_CODE (parent_type) == TYPE_CODE_STRUCT
- || TYPE_CODE (parent_type) == TYPE_CODE_UNION);
+ gdb_assert (parent_type->code () == TYPE_CODE_STRUCT
+ || parent_type->code () == TYPE_CODE_UNION);
for (i = 0; i < TYPE_NFIELDS (parent_type); i++)
{
/* Pointer to functions and to void do not have a child, since
you cannot print what they point to. */
- if (TYPE_CODE (child_type) == TYPE_CODE_FUNC
- || TYPE_CODE (child_type) == TYPE_CODE_VOID)
+ if (child_type->code () == TYPE_CODE_FUNC
+ || child_type->code () == TYPE_CODE_VOID)
return 0;
/* All other types have 1 child. */
if (ada_is_access_to_unconstrained_array (parent_type))
return 1;
- if (TYPE_CODE (parent_type) == TYPE_CODE_ARRAY)
+ if (parent_type->code () == TYPE_CODE_ARRAY)
return ada_varobj_get_array_number_of_children (parent_value,
parent_type);
- if (TYPE_CODE (parent_type) == TYPE_CODE_STRUCT
- || TYPE_CODE (parent_type) == TYPE_CODE_UNION)
+ if (parent_type->code () == TYPE_CODE_STRUCT
+ || parent_type->code () == TYPE_CODE_UNION)
return ada_varobj_get_struct_number_of_children (parent_value,
parent_type);
- if (TYPE_CODE (parent_type) == TYPE_CODE_PTR)
+ if (parent_type->code () == TYPE_CODE_PTR)
return ada_varobj_get_ptr_number_of_children (parent_value,
parent_type);
int fieldno;
int childno = 0;
- gdb_assert (TYPE_CODE (parent_type) == TYPE_CODE_STRUCT
- || TYPE_CODE (parent_type) == TYPE_CODE_UNION);
+ gdb_assert (parent_type->code () == TYPE_CODE_STRUCT
+ || parent_type->code () == TYPE_CODE_UNION);
for (fieldno = 0; fieldno < TYPE_NFIELDS (parent_type); fieldno++)
{
struct type *index_type;
int real_index;
- gdb_assert (TYPE_CODE (parent_type) == TYPE_CODE_ARRAY);
+ gdb_assert (parent_type->code () == TYPE_CODE_ARRAY);
index_type = TYPE_INDEX_TYPE (parent_type);
real_index = child_index + ada_discrete_type_low_bound (index_type);
std::string decoded;
/* If the index type is a range type, find the base type. */
- while (TYPE_CODE (index_type) == TYPE_CODE_RANGE)
+ while (index_type->code () == TYPE_CODE_RANGE)
index_type = TYPE_TARGET_TYPE (index_type);
- if (TYPE_CODE (index_type) == TYPE_CODE_ENUM
- || TYPE_CODE (index_type) == TYPE_CODE_BOOL)
+ if (index_type->code () == TYPE_CODE_ENUM
+ || index_type->code () == TYPE_CODE_BOOL)
{
index_type_name = ada_type_name (index_type);
if (index_type_name)
return;
}
- if (TYPE_CODE (parent_type) == TYPE_CODE_ARRAY)
+ if (parent_type->code () == TYPE_CODE_ARRAY)
{
ada_varobj_describe_simple_array_child
(parent_value, parent_type, parent_name, parent_path_expr,
return;
}
- if (TYPE_CODE (parent_type) == TYPE_CODE_STRUCT
- || TYPE_CODE (parent_type) == TYPE_CODE_UNION)
+ if (parent_type->code () == TYPE_CODE_STRUCT
+ || parent_type->code () == TYPE_CODE_UNION)
{
ada_varobj_describe_struct_child (parent_value, parent_type,
parent_name, parent_path_expr,
return;
}
- if (TYPE_CODE (parent_type) == TYPE_CODE_PTR)
+ if (parent_type->code () == TYPE_CODE_PTR)
{
ada_varobj_describe_ptr_child (parent_value, parent_type,
parent_name, parent_path_expr,
{
ada_varobj_decode_var (&value, &type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
struct type *type = (var->value != nullptr
? value_type (var->value.get ()) : var->type);
- if (TYPE_CODE (type) == TYPE_CODE_REF)
+ if (type->code () == TYPE_CODE_REF)
type = TYPE_TARGET_TYPE (type);
if (ada_is_access_to_unconstrained_array (type))
struct type *arg_type = check_typedef (value_type (arg));
/* Cast argument to long if necessary as the compiler does it too. */
- switch (TYPE_CODE (arg_type))
+ switch (arg_type->code ())
{
case TYPE_CODE_INT:
case TYPE_CODE_BOOL:
gdb_byte raw_buffer[ALPHA_REGISTER_SIZE];
ULONGEST l;
- switch (TYPE_CODE (valtype))
+ switch (valtype->code ())
{
case TYPE_CODE_FLT:
switch (TYPE_LENGTH (valtype))
gdb_byte raw_buffer[ALPHA_REGISTER_SIZE];
ULONGEST l;
- switch (TYPE_CODE (valtype))
+ switch (valtype->code ())
{
case TYPE_CODE_FLT:
switch (TYPE_LENGTH (valtype))
struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
- enum type_code code = TYPE_CODE (type);
+ enum type_code code = type->code ();
if ((code == TYPE_CODE_STRUCT
|| code == TYPE_CODE_UNION
static bool
amd64_has_unaligned_fields (struct type *type)
{
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION)
+ if (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION)
{
for (int i = 0; i < TYPE_NFIELDS (type); i++)
{
if (field_is_static (&TYPE_FIELD (type, i)) || bitsize == 0)
return;
- if (TYPE_CODE (subtype) == TYPE_CODE_STRUCT
- || TYPE_CODE (subtype) == TYPE_CODE_UNION)
+ if (subtype->code () == TYPE_CODE_STRUCT
+ || subtype->code () == TYPE_CODE_UNION)
{
/* Each field of an object is classified recursively. */
int j;
calculated according to the classes of the fields in the
eightbyte: */
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ if (type->code () == TYPE_CODE_ARRAY)
{
struct type *subtype = check_typedef (TYPE_TARGET_TYPE (type));
int i;
/* Structure or union. */
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION);
+ gdb_assert (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION);
for (i = 0; i < TYPE_NFIELDS (type); i++)
amd64_classify_aggregate_field (type, i, theclass, 0);
static void
amd64_classify (struct type *type, enum amd64_reg_class theclass[2])
{
- enum type_code code = TYPE_CODE (type);
+ enum type_code code = type->code ();
int len = TYPE_LENGTH (type);
theclass[0] = theclass[1] = AMD64_NO_CLASS;
static int
amd64_windows_passed_by_integer_register (struct type *type)
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_INT:
case TYPE_CODE_ENUM:
static int
amd64_windows_passed_by_xmm_register (struct type *type)
{
- return ((TYPE_CODE (type) == TYPE_CODE_FLT
- || TYPE_CODE (type) == TYPE_CODE_DECFLOAT)
+ return ((type->code () == TYPE_CODE_FLT
+ || type->code () == TYPE_CODE_DECFLOAT)
&& (TYPE_LENGTH (type) == 4 || TYPE_LENGTH (type) == 8));
}
/* See if our value is returned through a register. If it is, then
store the associated register number in REGNUM. */
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_FLT:
case TYPE_CODE_DECFLOAT:
function passes a hidden first parameter to the callee (in R0). That
parameter is the address at which the value being returned should be
stored. Otherwise, the result is returned in registers. */
- int is_struct_return = (TYPE_CODE (valtype) == TYPE_CODE_STRUCT
- || TYPE_CODE (valtype) == TYPE_CODE_UNION
+ int is_struct_return = (valtype->code () == TYPE_CODE_STRUCT
+ || valtype->code () == TYPE_CODE_UNION
|| TYPE_LENGTH (valtype) > 2 * ARC_REGISTER_SIZE);
if (arc_debug)
static ULONGEST
arc_type_align (struct gdbarch *gdbarch, struct type *type)
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_PTR:
case TYPE_CODE_FUNC:
arm_type_align (gdbarch *gdbarch, struct type *t)
{
t = check_typedef (t);
- if (TYPE_CODE (t) == TYPE_CODE_ARRAY && TYPE_VECTOR (t))
+ if (t->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (t))
{
/* Use the natural alignment for vector types (the same for
scalar type), but the maximum alignment is 64-bit. */
enum arm_vfp_cprc_base_type *base_type)
{
t = check_typedef (t);
- switch (TYPE_CODE (t))
+ switch (t->code ())
{
case TYPE_CODE_FLT:
switch (TYPE_LENGTH (t))
/* Determine the type of this function and whether the VFP ABI
applies. */
ftype = check_typedef (value_type (function));
- if (TYPE_CODE (ftype) == TYPE_CODE_PTR)
+ if (ftype->code () == TYPE_CODE_PTR)
ftype = check_typedef (TYPE_TARGET_TYPE (ftype));
use_vfp_abi = arm_vfp_abi_for_function (gdbarch, ftype);
arg_type = check_typedef (value_type (args[argnum]));
len = TYPE_LENGTH (arg_type);
target_type = TYPE_TARGET_TYPE (arg_type);
- typecode = TYPE_CODE (arg_type);
+ typecode = arg_type->code ();
val = value_contents (args[argnum]);
align = type_align (arg_type);
the THUMB bit in it. */
if (TYPE_CODE_PTR == typecode
&& target_type != NULL
- && TYPE_CODE_FUNC == TYPE_CODE (check_typedef (target_type)))
+ && TYPE_CODE_FUNC == check_typedef (target_type)->code ())
{
CORE_ADDR regval = extract_unsigned_integer (val, len, byte_order);
if (arm_pc_is_thumb (gdbarch, regval))
struct type *t = tdesc_register_type (gdbarch, regnum);
if (regnum >= ARM_D0_REGNUM && regnum < ARM_D0_REGNUM + 32
- && TYPE_CODE (t) == TYPE_CODE_FLT
+ && t->code () == TYPE_CODE_FLT
&& gdbarch_tdep (gdbarch)->have_neon)
return arm_neon_double_type (gdbarch);
else
struct gdbarch *gdbarch = regs->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- if (TYPE_CODE_FLT == TYPE_CODE (type))
+ if (TYPE_CODE_FLT == type->code ())
{
switch (gdbarch_tdep (gdbarch)->fp_model)
{
break;
}
}
- else if (TYPE_CODE (type) == TYPE_CODE_INT
- || TYPE_CODE (type) == TYPE_CODE_CHAR
- || TYPE_CODE (type) == TYPE_CODE_BOOL
- || TYPE_CODE (type) == TYPE_CODE_PTR
+ else if (type->code () == TYPE_CODE_INT
+ || type->code () == TYPE_CODE_CHAR
+ || type->code () == TYPE_CODE_BOOL
+ || type->code () == TYPE_CODE_PTR
|| TYPE_IS_REFERENCE (type)
- || TYPE_CODE (type) == TYPE_CODE_ENUM)
+ || type->code () == TYPE_CODE_ENUM)
{
/* If the type is a plain integer, then the access is
straight-forward. Otherwise we have to play around a bit
/* Simple, non-aggregate types (ie not including vectors and
complex) are always returned in a register (or registers). */
- code = TYPE_CODE (type);
+ code = type->code ();
if (TYPE_CODE_STRUCT != code && TYPE_CODE_UNION != code
&& TYPE_CODE_ARRAY != code && TYPE_CODE_COMPLEX != code)
return 0;
enum type_code field_type_code;
field_type_code
- = TYPE_CODE (check_typedef (TYPE_FIELD_TYPE (type,
- i)));
+ = check_typedef (TYPE_FIELD_TYPE (type, i))->code ();
/* Is it a floating point type field? */
if (field_type_code == TYPE_CODE_FLT)
struct gdbarch *gdbarch = regs->arch ();
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ if (type->code () == TYPE_CODE_FLT)
{
gdb_byte buf[ARM_FP_REGISTER_SIZE];
break;
}
}
- else if (TYPE_CODE (type) == TYPE_CODE_INT
- || TYPE_CODE (type) == TYPE_CODE_CHAR
- || TYPE_CODE (type) == TYPE_CODE_BOOL
- || TYPE_CODE (type) == TYPE_CODE_PTR
+ else if (type->code () == TYPE_CODE_INT
+ || type->code () == TYPE_CODE_CHAR
+ || type->code () == TYPE_CODE_BOOL
+ || type->code () == TYPE_CODE_PTR
|| TYPE_IS_REFERENCE (type)
- || TYPE_CODE (type) == TYPE_CODE_ENUM)
+ || type->code () == TYPE_CODE_ENUM)
{
if (TYPE_LENGTH (type) <= 4)
{
return RETURN_VALUE_REGISTER_CONVENTION;
}
- if (TYPE_CODE (valtype) == TYPE_CODE_STRUCT
- || TYPE_CODE (valtype) == TYPE_CODE_UNION
- || TYPE_CODE (valtype) == TYPE_CODE_ARRAY)
+ if (valtype->code () == TYPE_CODE_STRUCT
+ || valtype->code () == TYPE_CODE_UNION
+ || valtype->code () == TYPE_CODE_ARRAY)
{
if (tdep->struct_return == pcc_struct_return
|| arm_return_in_memory (gdbarch, valtype))
return RETURN_VALUE_STRUCT_CONVENTION;
}
- else if (TYPE_CODE (valtype) == TYPE_CODE_COMPLEX)
+ else if (valtype->code () == TYPE_CODE_COMPLEX)
{
if (arm_return_in_memory (gdbarch, valtype))
return RETURN_VALUE_STRUCT_CONVENTION;
avr_convert_iaddr_to_raw (addr));
}
/* Is it a code address? */
- else if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
- || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD)
+ else if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC
+ || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_METHOD)
{
/* A code pointer is word (16 bits) addressed. We shift the address down
by 1 bit to convert it to a pointer. */
return avr_make_iaddr (addr);
}
/* Is it a code address? */
- else if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
- || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD
+ else if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC
+ || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_METHOD
|| TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type)))
{
/* A code pointer is word (16 bits) addressed so we shift it up
register holds the LSB. */
int lsb_reg;
- if ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT
- || TYPE_CODE (valtype) == TYPE_CODE_UNION
- || TYPE_CODE (valtype) == TYPE_CODE_ARRAY)
+ if ((valtype->code () == TYPE_CODE_STRUCT
+ || valtype->code () == TYPE_CODE_UNION
+ || valtype->code () == TYPE_CODE_ARRAY)
&& TYPE_LENGTH (valtype) > 8)
return RETURN_VALUE_STRUCT_CONVENTION;
{
int string_trace = 0;
if (ax->trace_string
- && TYPE_CODE (value->type) == TYPE_CODE_PTR
+ && value->type->code () == TYPE_CODE_PTR
&& c_textual_element_type (check_typedef (TYPE_TARGET_TYPE (value->type)),
's'))
string_trace = 1;
/* To trace C++ classes with static fields stored elsewhere. */
if (ax->tracing
- && (TYPE_CODE (value->type) == TYPE_CODE_STRUCT
- || TYPE_CODE (value->type) == TYPE_CODE_UNION))
+ && (value->type->code () == TYPE_CODE_STRUCT
+ || value->type->code () == TYPE_CODE_UNION))
gen_trace_static_fields (ax, value->type);
}
\f
ax_trace_quick (ax, TYPE_LENGTH (type));
}
- if (TYPE_CODE (type) == TYPE_CODE_RANGE)
+ if (type->code () == TYPE_CODE_RANGE)
type = TYPE_TARGET_TYPE (type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_PTR:
case TYPE_CODE_REF:
/* Only deal with scalars, structs and such may be too large
to fit in a stack entry. */
value->type = check_typedef (value->type);
- if (TYPE_CODE (value->type) == TYPE_CODE_ARRAY
- || TYPE_CODE (value->type) == TYPE_CODE_STRUCT
- || TYPE_CODE (value->type) == TYPE_CODE_UNION
- || TYPE_CODE (value->type) == TYPE_CODE_FUNC)
+ if (value->type->code () == TYPE_CODE_ARRAY
+ || value->type->code () == TYPE_CODE_STRUCT
+ || value->type->code () == TYPE_CODE_UNION
+ || value->type->code () == TYPE_CODE_FUNC)
error (_("Value not scalar: cannot be an rvalue."));
switch (value->kind)
the stack. Should we tweak the type? */
/* Some types require special handling. */
- switch (TYPE_CODE (value->type))
+ switch (value->type->code ())
{
/* Functions get converted to a pointer to the function. */
case TYPE_CODE_FUNC:
struct axs_value *value2)
{
/* Do the usual binary conversions. */
- if (TYPE_CODE (value1->type) == TYPE_CODE_INT
- && TYPE_CODE (value2->type) == TYPE_CODE_INT)
+ if (value1->type->code () == TYPE_CODE_INT
+ && value2->type->code () == TYPE_CODE_INT)
{
/* The ANSI integral promotions seem to work this way: Order the
integer types by size, and then by signedness: an n-bit
/* Dereference typedefs. */
type = check_typedef (type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_PTR:
case TYPE_CODE_REF:
struct axs_value *value1, struct axs_value *value2)
{
gdb_assert (pointer_type (value1->type));
- gdb_assert (TYPE_CODE (value2->type) == TYPE_CODE_INT);
+ gdb_assert (value2->type->code () == TYPE_CODE_INT);
gen_scale (ax, aop_mul, value1->type);
ax_simple (ax, aop_add);
struct axs_value *value1, struct axs_value *value2)
{
gdb_assert (pointer_type (value1->type));
- gdb_assert (TYPE_CODE (value2->type) == TYPE_CODE_INT);
+ gdb_assert (value2->type->code () == TYPE_CODE_INT);
gen_scale (ax, aop_mul, value1->type);
ax_simple (ax, aop_sub);
int may_carry, const char *name)
{
/* We only handle INT op INT. */
- if ((TYPE_CODE (value1->type) != TYPE_CODE_INT)
- || (TYPE_CODE (value2->type) != TYPE_CODE_INT))
+ if ((value1->type->code () != TYPE_CODE_INT)
+ || (value2->type->code () != TYPE_CODE_INT))
error (_("Invalid combination of types in %s."), name);
ax_simple (ax,
gen_logical_not (struct agent_expr *ax, struct axs_value *value,
struct type *result_type)
{
- if (TYPE_CODE (value->type) != TYPE_CODE_INT
- && TYPE_CODE (value->type) != TYPE_CODE_PTR)
+ if (value->type->code () != TYPE_CODE_INT
+ && value->type->code () != TYPE_CODE_PTR)
error (_("Invalid type of operand to `!'."));
ax_simple (ax, aop_log_not);
static void
gen_complement (struct agent_expr *ax, struct axs_value *value)
{
- if (TYPE_CODE (value->type) != TYPE_CODE_INT)
+ if (value->type->code () != TYPE_CODE_INT)
error (_("Invalid type of operand to `~'."));
ax_simple (ax, aop_bit_not);
T" to "T", and mark the value as an lvalue in memory. Leave it
to the consumer to actually dereference it. */
value->type = check_typedef (TYPE_TARGET_TYPE (value->type));
- if (TYPE_CODE (value->type) == TYPE_CODE_VOID)
+ if (value->type->code () == TYPE_CODE_VOID)
error (_("Attempt to dereference a generic pointer."));
- value->kind = ((TYPE_CODE (value->type) == TYPE_CODE_FUNC)
+ value->kind = ((value->type->code () == TYPE_CODE_FUNC)
? axs_rvalue : axs_lvalue_memory);
}
/* Special case for taking the address of a function. The ANSI
standard describes this as a special case, too, so this
arrangement is not without motivation. */
- if (TYPE_CODE (value->type) == TYPE_CODE_FUNC)
+ if (value->type->code () == TYPE_CODE_FUNC)
/* The value's already an rvalue on the stack, so we just need to
change the type. */
value->type = lookup_pointer_type (value->type);
type = check_typedef (value->type);
/* This must yield a structure or a union. */
- if (TYPE_CODE (type) != TYPE_CODE_STRUCT
- && TYPE_CODE (type) != TYPE_CODE_UNION)
+ if (type->code () != TYPE_CODE_STRUCT
+ && type->code () != TYPE_CODE_UNION)
error (_("The left operand of `%s' is not a %s."),
operator_name, operand_name);
struct type *t = type;
int i;
- if (TYPE_CODE (t) != TYPE_CODE_STRUCT
- && TYPE_CODE (t) != TYPE_CODE_UNION)
+ if (t->code () != TYPE_CODE_STRUCT
+ && t->code () != TYPE_CODE_UNION)
internal_error (__FILE__, __LINE__,
_("non-aggregate type to gen_struct_elt_for_reference"));
gen_aggregate_elt_ref (struct agent_expr *ax, struct axs_value *value,
struct type *type, char *field)
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
if (!v)
error (_("Right operand of `@' must be a "
"constant, in agent expressions."));
- if (TYPE_CODE (value_type (v)) != TYPE_CODE_INT)
+ if (value_type (v)->code () != TYPE_CODE_INT)
error (_("Right operand of `@' must be an integer."));
length = value_as_long (v);
if (length <= 0)
}
else
gen_msym_var_ref (ax, value, (*pc)[2].msymbol, (*pc)[1].objfile);
- if (TYPE_CODE (value->type) == TYPE_CODE_ERROR)
+ if (value->type->code () == TYPE_CODE_ERROR)
value->type = to_type;
(*pc) += 4;
}
error (_("`%s' has been optimized out, cannot use"),
(*pc)[2].symbol->print_name ());
- if (TYPE_CODE (value->type) == TYPE_CODE_ERROR)
+ if (value->type->code () == TYPE_CODE_ERROR)
error_unknown_type ((*pc)[2].symbol->print_name ());
(*pc) += 4;
case OP_VAR_MSYM_VALUE:
gen_msym_var_ref (ax, value, (*pc)[2].msymbol, (*pc)[1].objfile);
- if (TYPE_CODE (value->type) == TYPE_CODE_ERROR)
+ if (value->type->code () == TYPE_CODE_ERROR)
error_unknown_type ((*pc)[2].msymbol->linkage_name ());
(*pc) += 4;
switch (op)
{
case BINOP_ADD:
- if (TYPE_CODE (value1->type) == TYPE_CODE_INT
+ if (value1->type->code () == TYPE_CODE_INT
&& pointer_type (value2->type))
{
/* Swap the values and proceed normally. */
gen_ptradd (ax, value, value2, value1);
}
else if (pointer_type (value1->type)
- && TYPE_CODE (value2->type) == TYPE_CODE_INT)
+ && value2->type->code () == TYPE_CODE_INT)
gen_ptradd (ax, value, value1, value2);
else
gen_binop (ax, value, value1, value2,
break;
case BINOP_SUB:
if (pointer_type (value1->type)
- && TYPE_CODE (value2->type) == TYPE_CODE_INT)
+ && value2->type->code () == TYPE_CODE_INT)
gen_ptrsub (ax,value, value1, value2);
else if (pointer_type (value1->type)
&& pointer_type (value2->type))
an array or pointer type (like a plain int variable for
example), then report this as an error. */
type = check_typedef (value1->type);
- if (TYPE_CODE (type) != TYPE_CODE_ARRAY
- && TYPE_CODE (type) != TYPE_CODE_PTR)
+ if (type->code () != TYPE_CODE_ARRAY
+ && type->code () != TYPE_CODE_PTR)
{
if (TYPE_NAME (type))
error (_("cannot subscript something of type `%s'"),
/* If we found a pointer to function, then the resolved type
is the type of the pointed-to function. */
- if (TYPE_CODE (resolver_ret_type) == TYPE_CODE_PTR)
+ if (resolver_ret_type->code () == TYPE_CODE_PTR)
{
struct type *resolved_type
= TYPE_TARGET_TYPE (resolver_ret_type);
- if (TYPE_CODE (check_typedef (resolved_type)) == TYPE_CODE_FUNC)
+ if (check_typedef (resolved_type)->code () == TYPE_CODE_FUNC)
return resolved_type;
}
}
for it explicitly, never if they just happen to
appear in the middle of some value chain. */
if (v == result
- || (TYPE_CODE (vtype) != TYPE_CODE_STRUCT
- && TYPE_CODE (vtype) != TYPE_CODE_ARRAY))
+ || (vtype->code () != TYPE_CODE_STRUCT
+ && vtype->code () != TYPE_CODE_ARRAY))
{
CORE_ADDR addr;
enum target_hw_bp_type type;
explicitly, never if they just happen to appear in a
middle of some value chain. */
if (v == head
- || (TYPE_CODE (vtype) != TYPE_CODE_STRUCT
- && TYPE_CODE (vtype) != TYPE_CODE_ARRAY))
+ || (vtype->code () != TYPE_CODE_STRUCT
+ && vtype->code () != TYPE_CODE_ARRAY))
{
CORE_ADDR vaddr = value_address (v);
int len;
static int
type_aggregate_p (struct type *type)
{
- return (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION
- || TYPE_CODE (type) == TYPE_CODE_NAMESPACE
- || (TYPE_CODE (type) == TYPE_CODE_ENUM
+ return (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION
+ || type->code () == TYPE_CODE_NAMESPACE
+ || (type->code () == TYPE_CODE_ENUM
&& TYPE_DECLARED_CLASS (type)));
}
for (ix = 0; ix < params->size (); ++ix)
{
type = (*params)[ix];
- if (type != NULL && TYPE_CODE (check_typedef (type)) == TYPE_CODE_VOID)
+ if (type != NULL && check_typedef (type)->code () == TYPE_CODE_VOID)
{
if (ix == 0)
{
{
const char *name = TYPE_NAME (elttype);
- if (TYPE_CODE (elttype) == TYPE_CODE_CHAR || !name)
+ if (elttype->code () == TYPE_CODE_CHAR || !name)
{
result = C_CHAR;
goto done;
goto done;
}
- if (TYPE_CODE (elttype) != TYPE_CODE_TYPEDEF)
+ if (elttype->code () != TYPE_CODE_TYPEDEF)
break;
/* Call for side effects. */
if (element_type == NULL)
goto error;
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ if (type->code () == TYPE_CODE_ARRAY)
{
/* If we know the size of the array, we can use it as a limit on
the number of characters to be fetched. */
if (TYPE_NFIELDS (type) == 1
- && TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_RANGE)
+ && TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_RANGE)
{
LONGEST low_bound, high_bound;
else
fetchlimit = UINT_MAX;
}
- else if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ else if (type->code () == TYPE_CODE_PTR)
fetchlimit = UINT_MAX;
else
/* We work only with arrays and pointers. */
avoids running off the end of the value's contents. */
if ((VALUE_LVAL (value) == not_lval
|| VALUE_LVAL (value) == lval_internalvar
- || TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ || type->code () == TYPE_CODE_ARRAY)
&& fetchlimit != UINT_MAX
&& (*length < 0 || *length <= fetchlimit))
{
c_style_arrays is false, so we handle that specially
here. */
CORE_ADDR addr;
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ if (type->code () == TYPE_CODE_ARRAY)
{
if (VALUE_LVAL (value) != lval_memory)
error (_("Attempt to take address of value "
/* If the caller expects an array of some integral type,
satisfy them. If something odder is expected, rely on the
caller to cast. */
- if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_ARRAY)
+ if (expect_type && expect_type->code () == TYPE_CODE_ARRAY)
{
struct type *element_type
= check_typedef (TYPE_TARGET_TYPE (expect_type));
- if (TYPE_CODE (element_type) == TYPE_CODE_INT
- || TYPE_CODE (element_type) == TYPE_CODE_CHAR)
+ if (element_type->code () == TYPE_CODE_INT
+ || element_type->code () == TYPE_CODE_CHAR)
{
type = element_type;
satisfy_expected = 1;
c_is_string_type_p (struct type *type)
{
type = check_typedef (type);
- while (TYPE_CODE (type) == TYPE_CODE_REF)
+ while (type->code () == TYPE_CODE_REF)
{
type = TYPE_TARGET_TYPE (type);
type = check_typedef (type);
}
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_ARRAY:
{
type = check_typedef (type);
local_name = typedef_hash_table::find_typedef (flags, type);
- code = TYPE_CODE (type);
+ code = type->code ();
if (local_name != NULL)
{
fputs_filtered (local_name, stream);
if (TYPE_NAME ((SYMBOL_TYPE (new_symbol))) == 0
|| strcmp (TYPE_NAME ((SYMBOL_TYPE (new_symbol))),
new_symbol->linkage_name ()) != 0
- || TYPE_CODE (SYMBOL_TYPE (new_symbol)) == TYPE_CODE_TYPEDEF)
+ || SYMBOL_TYPE (new_symbol)->code () == TYPE_CODE_TYPEDEF)
fprintf_filtered (stream, " %s", new_symbol->print_name ());
fprintf_filtered (stream, ";");
}
struct type *domain;
gdb_assert (nargs > 0);
- gdb_assert (TYPE_CODE (args[0].type) == TYPE_CODE_PTR);
+ gdb_assert (args[0].type->code () == TYPE_CODE_PTR);
domain = TYPE_TARGET_TYPE (args[0].type);
if (TYPE_CONST (domain))
QUIT;
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_PTR:
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
stream, show, 1, 0, language, flags,
podata);
- fprintf_filtered (stream, TYPE_CODE(type) == TYPE_CODE_REF ? "&" : "&&");
+ fprintf_filtered (stream, type->code () == TYPE_CODE_REF ? "&" : "&&");
c_type_print_modifier (type, stream, 1, need_post_space, language);
break;
QUIT;
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_ARRAY:
{
}
c_type_print_modifier (type, stream, 0, 1, language);
- if (TYPE_CODE (type) == TYPE_CODE_UNION)
+ if (type->code () == TYPE_CODE_UNION)
fprintf_filtered (stream, "union ");
else if (TYPE_DECLARED_CLASS (type))
fprintf_filtered (stream, "class ");
int newshow = show - 1;
if (!is_static && flags->print_offsets
- && (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_STRUCT
- || TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_UNION))
+ && (TYPE_FIELD_TYPE (type, i)->code () == TYPE_CODE_STRUCT
+ || TYPE_FIELD_TYPE (type, i)->code () == TYPE_CODE_UNION))
{
/* If we're printing offsets and this field's type is
either a struct or an union, then we're interested in
struct type *target = TYPE_TYPEDEF_FIELD_TYPE (type, i);
/* Dereference the typedef declaration itself. */
- gdb_assert (TYPE_CODE (target) == TYPE_CODE_TYPEDEF);
+ gdb_assert (target->code () == TYPE_CODE_TYPEDEF);
target = TYPE_TARGET_TYPE (target);
if (need_access_label)
way. */
if (language == language_c || language == language_minimal)
{
- if (TYPE_CODE (type) == TYPE_CODE_UNION)
+ if (type->code () == TYPE_CODE_UNION)
fprintf_filtered (stream, "union ");
- else if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ else if (type->code () == TYPE_CODE_STRUCT)
{
if (TYPE_DECLARED_CLASS (type))
fprintf_filtered (stream, "class ");
else
fprintf_filtered (stream, "struct ");
}
- else if (TYPE_CODE (type) == TYPE_CODE_ENUM)
+ else if (type->code () == TYPE_CODE_ENUM)
fprintf_filtered (stream, "enum ");
}
type = check_typedef (type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_TYPEDEF:
/* If we get here, the typedef doesn't have a name, and we
/* At least for dump_symtab, it is important that this not
be an error (). */
fprintf_styled (stream, metadata_style.style (),
- _("<invalid type code %d>"), TYPE_CODE (type));
+ _("<invalid type code %d>"), type->code ());
}
break;
}
true_type = check_typedef (type);
/* TYPE_CODE_CHAR is always textual. */
- if (TYPE_CODE (true_type) == TYPE_CODE_CHAR)
+ if (true_type->code () == TYPE_CODE_CHAR)
return 1;
/* Any other character-like types must be integral. */
- if (TYPE_CODE (true_type) != TYPE_CODE_INT)
+ if (true_type->code () != TYPE_CODE_INT)
return 0;
/* We peel typedefs one by one, looking for a match. */
if (TYPE_NAME (iter_type) && textual_name (TYPE_NAME (iter_type)))
return 1;
- if (TYPE_CODE (iter_type) != TYPE_CODE_TYPEDEF)
+ if (iter_type->code () != TYPE_CODE_TYPEDEF)
break;
/* Peel a single typedef. If the typedef doesn't have a target
{
/* Print this as a string if we can manage it. For now, no wide
character support. */
- if (TYPE_CODE (true_type) == TYPE_CODE_INT
+ if (true_type->code () == TYPE_CODE_INT
&& TYPE_LENGTH (true_type) == 1)
return 1;
}
/* If a one-byte TYPE_CODE_INT is missing the not-a-character
flag, then we treat it as text; otherwise, we assume it's
being used as data. */
- if (TYPE_CODE (true_type) == TYPE_CODE_INT
+ if (true_type->code () == TYPE_CODE_INT
&& TYPE_LENGTH (true_type) == 1
&& !TYPE_NOTTEXT (true_type))
return 1;
int want_space = 0;
struct gdbarch *gdbarch = get_type_arch (type);
- if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
+ if (elttype->code () == TYPE_CODE_FUNC)
{
/* Try to print what function it points to. */
print_function_pointer_address (options, gdbarch, address, stream);
{
struct type *type = check_typedef (value_type (val));
- if (TYPE_CODE (type) == TYPE_CODE_UNION && recurse && !options->unionprint)
+ if (type->code () == TYPE_CODE_UNION && recurse && !options->unionprint)
fprintf_filtered (stream, "{...}");
else if (options->vtblprint && cp_is_vtbl_ptr_type (type))
{
const gdb_byte *valaddr = value_contents_for_printing (val);
type = check_typedef (type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_ARRAY:
c_value_print_array (val, stream, recurse, options);
type = check_typedef (value_type (val));
- if (TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type))
+ if (type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type))
{
struct type *original_type = value_type (val);
type is indicated by the quoted string anyway.
(Don't use c_textual_element_type here; quoted strings
are always exactly (char *), (wchar_t *), or the like. */
- if (TYPE_CODE (original_type) == TYPE_CODE_PTR
+ if (original_type->code () == TYPE_CODE_PTR
&& TYPE_NAME (original_type) == NULL
&& TYPE_NAME (TYPE_TARGET_TYPE (original_type)) != NULL
&& (strcmp (TYPE_NAME (TYPE_TARGET_TYPE (original_type)),
/* Print nothing. */
}
else if (options->objectprint
- && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT))
+ && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRUCT))
{
int is_ref = TYPE_IS_REFERENCE (type);
enum type_code refcode = TYPE_CODE_UNDEF;
if (is_ref)
{
val = value_addr (val);
- refcode = TYPE_CODE (type);
+ refcode = type->code ();
}
/* Pointer to class, check real type of object. */
if (!value_initialized (val))
fprintf_filtered (stream, " [uninitialized] ");
- if (options->objectprint && (TYPE_CODE (type) == TYPE_CODE_STRUCT))
+ if (options->objectprint && (type->code () == TYPE_CODE_STRUCT))
{
/* Attempt to determine real type of object. */
real_type = value_rtti_type (val, &full, &top, &using_enc);
/* Pointers to structures are treated just like
structures when accessing children. Don't
dereference pointers to other types. */
- if (TYPE_CODE (*type) == TYPE_CODE_PTR)
+ if ((*type)->code () == TYPE_CODE_PTR)
{
struct type *target_type = get_target_type (*type);
- if (TYPE_CODE (target_type) == TYPE_CODE_STRUCT
- || TYPE_CODE (target_type) == TYPE_CODE_UNION)
+ if (target_type->code () == TYPE_CODE_STRUCT
+ || target_type->code () == TYPE_CODE_UNION)
{
if (value && *value)
{
type = varobj_get_gdb_type (var);
/* Anonymous unions and structs are also not path_expr parents. */
- if ((TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION)
+ if ((type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION)
&& TYPE_NAME (type) == NULL)
{
const struct varobj *parent = var->parent;
parent_type = varobj_get_value_type (parent);
adjust_value_for_child_access (NULL, &parent_type, &was_ptr, 0);
- if (TYPE_CODE (parent_type) == TYPE_CODE_STRUCT
- || TYPE_CODE (parent_type) == TYPE_CODE_UNION)
+ if (parent_type->code () == TYPE_CODE_STRUCT
+ || parent_type->code () == TYPE_CODE_UNION)
{
const char *field_name;
adjust_value_for_child_access (NULL, &type, NULL, 0);
target = get_target_type (type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_ARRAY:
if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (target) > 0
to test for it, please mind that a little magic is necessary to
properly identify it: char* has TYPE_CODE == TYPE_CODE_INT and
TYPE_NAME == "char". */
- if (TYPE_CODE (target) == TYPE_CODE_FUNC
- || TYPE_CODE (target) == TYPE_CODE_VOID)
+ if (target->code () == TYPE_CODE_FUNC
+ || target->code () == TYPE_CODE_VOID)
children = 0;
else
children = 1;
type = check_typedef (type);
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION);
+ gdb_assert (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION);
try
{
}
adjust_value_for_child_access (&value, &type, &was_ptr, 0);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_ARRAY:
if (cname)
{
if (cname)
{
- if (TYPE_CODE (TYPE_FIELD_TYPE (type, index))
+ if (TYPE_FIELD_TYPE (type, index)->code ()
== TYPE_CODE_STRUCT)
*cname = ANONYMOUS_STRUCT_NAME;
else
while (TYPE_IS_REFERENCE (type))
type = check_typedef (TYPE_TARGET_TYPE (type));
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
{
value = var->value.get ();
lookup_actual_type = (TYPE_IS_REFERENCE (var->type)
- || TYPE_CODE (var->type) == TYPE_CODE_PTR);
+ || var->type->code () == TYPE_CODE_PTR);
}
adjust_value_for_child_access (&value, &type, NULL, lookup_actual_type);
- if (((TYPE_CODE (type)) == TYPE_CODE_STRUCT)
- || ((TYPE_CODE (type)) == TYPE_CODE_UNION))
+ if (((type->code ()) == TYPE_CODE_STRUCT)
+ || ((type->code ()) == TYPE_CODE_UNION))
{
int kids[3];
value = parent->value.get ();
lookup_actual_type = (TYPE_IS_REFERENCE (parent->type)
- || TYPE_CODE (parent->type) == TYPE_CODE_PTR);
+ || parent->type->code () == TYPE_CODE_PTR);
}
adjust_value_for_child_access (&value, &type, NULL, lookup_actual_type);
var = (CPLUS_FAKE_CHILD (parent)) ? parent->parent : parent;
if (opts.objectprint)
lookup_actual_type = (TYPE_IS_REFERENCE (var->type)
- || TYPE_CODE (var->type) == TYPE_CODE_PTR);
+ || var->type->code () == TYPE_CODE_PTR);
value = var->value.get ();
type = varobj_get_value_type (var);
if (cfull_expression)
adjust_value_for_child_access (&value, &type, &was_ptr, lookup_actual_type);
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION)
+ if (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION)
{
const char *join = was_ptr ? "->" : ".";
{
if (cname)
{
- if (TYPE_CODE (TYPE_FIELD_TYPE (type, type_index))
+ if (TYPE_FIELD_TYPE (type, type_index)->code ()
== TYPE_CODE_STRUCT)
*cname = ANONYMOUS_STRUCT_NAME;
- else if (TYPE_CODE (TYPE_FIELD_TYPE (type, type_index))
+ else if (TYPE_FIELD_TYPE (type, type_index)->code ()
== TYPE_CODE_UNION)
*cname = ANONYMOUS_UNION_NAME;
}
struct type *type0 = check_typedef (value_type (argv[0]));
- if (TYPE_CODE (type0) != TYPE_CODE_ARRAY
- && TYPE_CODE (type0) != TYPE_CODE_STRING)
+ if (type0->code () != TYPE_CODE_ARRAY
+ && type0->code () != TYPE_CODE_STRING)
error (_("First argument of %s must be a string."), fnname);
const char *a0 = (const char *) value_contents (argv[0]);
if (val != NULL) /* Value history reference */
{
- if (TYPE_CODE (value_type (val)) == TYPE_CODE_INT)
+ if (value_type (val)->code () == TYPE_CODE_INT)
retval = value_as_long (val);
else
error (_("History value must have integer type."));
if (val) /* Value history reference */
{
- if (TYPE_CODE (value_type (val)) == TYPE_CODE_INT)
+ if (value_type (val)->code () == TYPE_CODE_INT)
retval = value_as_long (val);
else
{
from different files with the same name. */
if (SYMBOL_CLASS (real_sym) == LOC_TYPEDEF
&& SYMBOL_DOMAIN (real_sym) == VAR_DOMAIN
- && TYPE_CODE (SYMBOL_TYPE (real_sym)) == TYPE_CODE_PTR
+ && SYMBOL_TYPE (real_sym)->code () == TYPE_CODE_PTR
&& TYPE_LENGTH (TYPE_TARGET_TYPE (SYMBOL_TYPE (real_sym))) != 0)
{
const char *name = real_sym->linkage_name ();
/* If type has no name, give it one. */
if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
{
- if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_PTR
- || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_FUNC)
+ if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_PTR
+ || SYMBOL_TYPE (sym)->code () == TYPE_CODE_FUNC)
{
/* If we are giving a name to a type such as
"pointer to foo" or "function returning foo", we
not an empty structured type, though; the forward
references work themselves out via the magic of
coff_lookup_type. */
- if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_PTR
+ if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_PTR
&& TYPE_LENGTH (TYPE_TARGET_TYPE (SYMBOL_TYPE (sym))) == 0
- && TYPE_CODE (TYPE_TARGET_TYPE (SYMBOL_TYPE (sym)))
- != TYPE_CODE_UNDEF)
+ && TYPE_TARGET_TYPE (SYMBOL_TYPE (sym))->code ()
+ != TYPE_CODE_UNDEF)
{
int i = hashname (sym->linkage_name ());
maximally-aligned array of the correct size. */
fputs_unfiltered (" ", stream);
- switch (TYPE_CODE (regtype))
+ switch (regtype->code ())
{
case TYPE_CODE_PTR:
fprintf_filtered (stream, "__gdb_uintptr %s",
break;
case LOC_CONST:
- if (TYPE_CODE (SYMBOL_TYPE (sym.symbol)) == TYPE_CODE_ENUM)
+ if (SYMBOL_TYPE (sym.symbol)->code () == TYPE_CODE_ENUM)
{
/* Already handled by convert_enum. */
return;
if (TYPE_IS_REFERENCE (type))
type = check_typedef (TYPE_TARGET_TYPE (type));
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_RANGE:
{
/* First we create the resulting type and enter it into our hash
table. This lets recursive types work. */
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
result = context->plugin ().build_record_type ();
else
{
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_UNION);
+ gdb_assert (type->code () == TYPE_CODE_UNION);
result = context->plugin ().build_union_type ();
}
context->insert_type (type, result);
| TYPE_INSTANCE_FLAG_RESTRICT)) != 0)
return convert_qualified (context, type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_PTR:
return convert_pointer (context, type);
switch (SYMBOL_CLASS (sym.symbol))
{
case LOC_TYPEDEF:
- if (TYPE_CODE (SYMBOL_TYPE (sym.symbol)) == TYPE_CODE_TYPEDEF)
+ if (SYMBOL_TYPE (sym.symbol)->code () == TYPE_CODE_TYPEDEF)
kind = GCC_CP_SYMBOL_TYPEDEF;
- else if (TYPE_CODE (SYMBOL_TYPE (sym.symbol)) == TYPE_CODE_NAMESPACE)
+ else if (SYMBOL_TYPE (sym.symbol)->code () == TYPE_CODE_NAMESPACE)
return;
break;
break;
case LOC_CONST:
- if (TYPE_CODE (SYMBOL_TYPE (sym.symbol)) == TYPE_CODE_ENUM)
+ if (SYMBOL_TYPE (sym.symbol)->code () == TYPE_CODE_ENUM)
{
/* Already handled by convert_enum. */
return;
enum gcc_cp_symbol_kind
get_method_access_flag (const struct type *type, int fni, int num)
{
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT);
+ gdb_assert (type->code () == TYPE_CODE_STRUCT);
/* If this type was not declared a class, everything is public. */
if (!TYPE_DECLARED_CLASS (type))
scope.push_back (comp);
- if (TYPE_CODE (SYMBOL_TYPE (bsymbol.symbol)) != TYPE_CODE_NAMESPACE)
+ if (SYMBOL_TYPE (bsymbol.symbol)->code () != TYPE_CODE_NAMESPACE)
{
/* We're done. */
break;
(m_scopes.back ().begin (), m_scopes.back ().end () - 1,
[this] (const scope_component &comp)
{
- gdb_assert (TYPE_CODE (SYMBOL_TYPE (comp.bsymbol.symbol))
+ gdb_assert (SYMBOL_TYPE (comp.bsymbol.symbol)->code ()
== TYPE_CODE_NAMESPACE);
const char *ns = (comp.name == CP_ANONYMOUS_NAMESPACE_STR ? nullptr
std::for_each
(current.begin (),current.end () - 1,
[this] (const scope_component &comp) {
- gdb_assert (TYPE_CODE (SYMBOL_TYPE (comp.bsymbol.symbol))
+ gdb_assert (SYMBOL_TYPE (comp.bsymbol.symbol)->code ()
== TYPE_CODE_NAMESPACE);
this->plugin ().pop_binding_level (comp.name.c_str ());
});
gcc_type target = instance->convert_type (TYPE_TARGET_TYPE (type));
enum gcc_cp_ref_qualifiers quals = GCC_CP_REF_QUAL_NONE;
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_REF:
quals = GCC_CP_REF_QUAL_LVALUE;
table. This lets recursive types work. */
gcc_decl resuld;
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
{
const char *what = TYPE_DECLARED_CLASS (type) ? "struct" : "class";
}
else
{
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_UNION);
+ gdb_assert (type->code () == TYPE_CODE_UNION);
resuld = instance->plugin ().build_decl
("union", name.get (), GCC_CP_SYMBOL_UNION | nested_access,
0, nullptr, 0, filename, line);
}
gcc_type result;
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
{
struct gcc_vbase_array bases;
int num_baseclasses = TYPE_N_BASECLASSES (type);
}
else
{
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_UNION);
+ gdb_assert (type->code () == TYPE_CODE_UNION);
result = instance->plugin ().start_class_type
(name.get (), resuld, nullptr, filename, line);
}
| TYPE_INSTANCE_FLAG_RESTRICT)) != 0)
return compile_cplus_convert_qualified (instance, type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF:
}
std::string s = string_printf (_("unhandled TYPE_CODE %d"),
- TYPE_CODE (type));
+ type->code ());
return instance->plugin ().error (s.c_str ());
}
error (_("No \"%s\" symbol found"), COMPILE_I_EXPR_PTR_TYPE);
gdb_ptr_type = SYMBOL_TYPE (gdb_ptr_type_sym);
gdb_ptr_type = check_typedef (gdb_ptr_type);
- if (TYPE_CODE (gdb_ptr_type) != TYPE_CODE_PTR)
+ if (gdb_ptr_type->code () != TYPE_CODE_PTR)
error (_("Type of \"%s\" is not a pointer"), COMPILE_I_EXPR_PTR_TYPE);
gdb_type_from_ptr = check_typedef (TYPE_TARGET_TYPE (gdb_ptr_type));
return gdb_type;
}
- if (TYPE_CODE (gdb_type) != TYPE_CODE_PTR)
+ if (gdb_type->code () != TYPE_CODE_PTR)
error (_("Invalid type code %d of symbol \"%s\" "
"in compiled module \"%s\"."),
- TYPE_CODE (gdb_type_from_ptr), COMPILE_I_EXPR_VAL,
+ gdb_type_from_ptr->code (), COMPILE_I_EXPR_VAL,
objfile_name (objfile));
retval = gdb_type_from_ptr;
- switch (TYPE_CODE (gdb_type_from_ptr))
+ switch (gdb_type_from_ptr->code ())
{
case TYPE_CODE_ARRAY:
gdb_type_from_ptr = TYPE_TARGET_TYPE (gdb_type_from_ptr);
default:
error (_("Invalid type code %d of symbol \"%s\" "
"in compiled module \"%s\"."),
- TYPE_CODE (gdb_type_from_ptr), COMPILE_I_EXPR_PTR_TYPE,
+ gdb_type_from_ptr->code (), COMPILE_I_EXPR_PTR_TYPE,
objfile_name (objfile));
}
if (!types_deeply_equal (gdb_type_from_ptr,
return NULL;
regsp_type = check_typedef (TYPE_FIELD_TYPE (func_type, 0));
- if (TYPE_CODE (regsp_type) != TYPE_CODE_PTR)
+ if (regsp_type->code () != TYPE_CODE_PTR)
error (_("Invalid type code %d of first parameter of function \"%s\" "
"in compiled module \"%s\"."),
- TYPE_CODE (regsp_type), GCC_FE_WRAPPER_FUNCTION,
+ regsp_type->code (), GCC_FE_WRAPPER_FUNCTION,
objfile_name (objfile));
regs_type = check_typedef (TYPE_TARGET_TYPE (regsp_type));
- if (TYPE_CODE (regs_type) != TYPE_CODE_STRUCT)
+ if (regs_type->code () != TYPE_CODE_STRUCT)
error (_("Invalid type code %d of dereferenced first parameter "
"of function \"%s\" in compiled module \"%s\"."),
- TYPE_CODE (regs_type), GCC_FE_WRAPPER_FUNCTION,
+ regs_type->code (), GCC_FE_WRAPPER_FUNCTION,
objfile_name (objfile));
return regs_type;
reg_name, pulongest (reg_bitpos), pulongest (reg_bitsize));
reg_offset = reg_bitpos / 8;
- if (TYPE_CODE (reg_type) != TYPE_CODE_INT
- && TYPE_CODE (reg_type) != TYPE_CODE_PTR)
+ if (reg_type->code () != TYPE_CODE_INT
+ && reg_type->code () != TYPE_CODE_PTR)
error (_("Invalid register \"%s\" type code %d"), reg_name,
- TYPE_CODE (reg_type));
+ reg_type->code ());
regnum = compile_register_name_demangle (gdbarch, reg_name);
error (_("Cannot find function \"%s\" in compiled module \"%s\"."),
GCC_FE_WRAPPER_FUNCTION, objfile_name (objfile));
func_type = SYMBOL_TYPE (func_sym);
- if (TYPE_CODE (func_type) != TYPE_CODE_FUNC)
+ if (func_type->code () != TYPE_CODE_FUNC)
error (_("Invalid type code %d of function \"%s\" in compiled "
"module \"%s\"."),
- TYPE_CODE (func_type), GCC_FE_WRAPPER_FUNCTION,
+ func_type->code (), GCC_FE_WRAPPER_FUNCTION,
objfile_name (objfile));
switch (scope)
func_type = copy_type_recursive (objfile, func_type, copied_types);
htab_delete (copied_types);
- gdb_assert (TYPE_CODE (func_type) == TYPE_CODE_FUNC);
+ gdb_assert (func_type->code () == TYPE_CODE_FUNC);
func_val = value_from_pointer (lookup_pointer_type (func_type),
BLOCK_ENTRY_PC (SYMBOL_BLOCK_VALUE (func_sym)));
fieldname, namelen))
output.emplace_back (xstrdup (TYPE_FIELD_NAME (type, i)));
}
- else if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_UNION)
+ else if (TYPE_FIELD_TYPE (type, i)->code () == TYPE_CODE_UNION)
{
/* Recurse into anonymous unions. */
add_struct_fields (TYPE_FIELD_TYPE (type, i),
for (;;)
{
type = check_typedef (type);
- if (TYPE_CODE (type) != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type))
+ if (type->code () != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type))
break;
type = TYPE_TARGET_TYPE (type);
}
- if (TYPE_CODE (type) == TYPE_CODE_UNION
- || TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_UNION
+ || type->code () == TYPE_CODE_STRUCT)
{
completion_list result;
/* If the scope is a function/method, then look up NESTED as a local
static variable. E.g., "print 'function()::static_var'". */
- if ((TYPE_CODE (scope_type) == TYPE_CODE_FUNC
- || TYPE_CODE (scope_type) == TYPE_CODE_METHOD)
+ if ((scope_type->code () == TYPE_CODE_FUNC
+ || scope_type->code () == TYPE_CODE_METHOD)
&& domain == VAR_DOMAIN)
return lookup_symbol (nested, SYMBOL_BLOCK_VALUE (scope_sym.symbol),
VAR_DOMAIN, NULL);
domain_name (domain));
}
- switch (TYPE_CODE (parent_type))
+ switch (parent_type->code ())
{
case TYPE_CODE_STRUCT:
case TYPE_CODE_NAMESPACE:
}
/* If the type is a typedef or namespace alias, replace it. */
- if (TYPE_CODE (otype) == TYPE_CODE_TYPEDEF
- || TYPE_CODE (otype) == TYPE_CODE_NAMESPACE)
+ if (otype->code () == TYPE_CODE_TYPEDEF
+ || otype->code () == TYPE_CODE_NAMESPACE)
{
long len;
int is_anon;
return 0;
is_anon = (TYPE_NAME (type) == NULL
- && (TYPE_CODE (type) == TYPE_CODE_ENUM
- || TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION));
+ && (type->code () == TYPE_CODE_ENUM
+ || type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION));
if (is_anon)
{
struct type *last = otype;
/* Find the last typedef for the type. */
while (TYPE_TARGET_TYPE (last) != NULL
- && (TYPE_CODE (TYPE_TARGET_TYPE (last))
+ && (TYPE_TARGET_TYPE (last)->code ()
== TYPE_CODE_TYPEDEF))
last = TYPE_TARGET_TYPE (last);
const char *type_name;
int i, prefix_len;
- while (TYPE_CODE (type) == TYPE_CODE_PTR
+ while (type->code () == TYPE_CODE_PTR
|| TYPE_IS_REFERENCE (type)
- || TYPE_CODE (type) == TYPE_CODE_ARRAY
- || TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
+ || type->code () == TYPE_CODE_ARRAY
+ || type->code () == TYPE_CODE_TYPEDEF)
{
- if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
- type = check_typedef(type);
+ if (type->code () == TYPE_CODE_TYPEDEF)
+ type = check_typedef (type);
else
type = TYPE_TARGET_TYPE (type);
}
}
/* Check public base type */
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
for (i = 0; i < TYPE_N_BASECLASSES (type); i++)
{
if (BASETYPE_VIA_PUBLIC (type, i))
rtti_type = check_typedef (SYMBOL_TYPE (rtti_sym));
- switch (TYPE_CODE (rtti_type))
+ switch (rtti_type->code ())
{
case TYPE_CODE_STRUCT:
break;
{
/* With older versions of g++, the vtbl field pointed to an array of
structures. Nowadays it points directly to the structure. */
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ if (type->code () == TYPE_CODE_PTR)
{
type = TYPE_TARGET_TYPE (type);
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ if (type->code () == TYPE_CODE_ARRAY)
{
type = TYPE_TARGET_TYPE (type);
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT /* if not using thunks */
- || TYPE_CODE (type) == TYPE_CODE_PTR) /* if using thunks */
+ if (type->code () == TYPE_CODE_STRUCT /* if not using thunks */
+ || type->code () == TYPE_CODE_PTR) /* if using thunks */
{
/* Virtual functions tables are full of pointers
to virtual functions. */
return cp_is_vtbl_ptr_type (type);
}
}
- else if (TYPE_CODE (type) == TYPE_CODE_STRUCT) /* if not using thunks */
+ else if (type->code () == TYPE_CODE_STRUCT) /* if not using thunks */
{
return cp_is_vtbl_ptr_type (type);
}
- else if (TYPE_CODE (type) == TYPE_CODE_PTR) /* if using thunks */
+ else if (type->code () == TYPE_CODE_PTR) /* if using thunks */
{
/* The type name of the thunk pointer is NULL when using
dwarf2. We could test for a pointer to a function, but
}
struct type *real_type = check_typedef (type);
- if (TYPE_CODE (real_type) == TYPE_CODE_STRUCT)
+ if (real_type->code () == TYPE_CODE_STRUCT)
{
CORE_ADDR *first_dont_print;
CORE_ADDR addr = value_address (val);
return;
}
- if (TYPE_CODE (real_type) == TYPE_CODE_ARRAY)
+ if (real_type->code () == TYPE_CODE_ARRAY)
{
struct type **first_dont_print;
int i;
struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION
+ if (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION
|| TYPE_LENGTH (type) > 8)
/* Structs, unions, and anything larger than 8 bytes (2 registers)
goes on the stack. */
SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC;
break;
case CTF_K_CONST:
- if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_VOID)
+ if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_VOID)
SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_int;
break;
case CTF_K_TYPEDEF:
base_type = copy_type (base_type);
inner_array = base_type;
- while (TYPE_CODE (TYPE_TARGET_TYPE (inner_array)) == TYPE_CODE_ARRAY)
+ while (TYPE_TARGET_TYPE (inner_array)->code () == TYPE_CODE_ARRAY)
{
TYPE_TARGET_TYPE (inner_array)
= copy_type (TYPE_TARGET_TYPE (inner_array));
/* Check if the qualified name is in the global
context. However if the symbol has not already
been resolved, it's not likely to be found. */
- if (TYPE_CODE (type) == TYPE_CODE_MODULE)
+ if (type->code () == TYPE_CODE_MODULE)
{
struct bound_minimal_symbol msymbol;
struct block_symbol sym;
static int
type_aggregate_p (struct type *type)
{
- return (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION
- || TYPE_CODE (type) == TYPE_CODE_MODULE
- || (TYPE_CODE (type) == TYPE_CODE_ENUM
+ return (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION
+ || type->code () == TYPE_CODE_MODULE
+ || (type->code () == TYPE_CODE_ENUM
&& TYPE_DECLARED_CLASS (type)));
}
parent_type = check_typedef (parent_type);
- switch (TYPE_CODE (parent_type))
+ switch (parent_type->code ())
{
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
const struct value_print_options *options)
{
if (TYPE_NFIELDS (type) == 2
- && TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_INT
+ && TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_INT
&& strcmp (TYPE_FIELD_NAME (type, 0), "length") == 0
&& strcmp (TYPE_FIELD_NAME (type, 1), "ptr") == 0
&& !value_bits_any_optimized_out (val,
int ret;
struct type *type = check_typedef (value_type (val));
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_STRUCT:
ret = dynamic_array_type (type, value_embedded_offset (val),
static void
dwarf_require_integral (struct type *type)
{
- if (TYPE_CODE (type) != TYPE_CODE_INT
- && TYPE_CODE (type) != TYPE_CODE_CHAR
- && TYPE_CODE (type) != TYPE_CODE_BOOL)
+ if (type->code () != TYPE_CODE_INT
+ && type->code () != TYPE_CODE_CHAR
+ && type->code () != TYPE_CODE_BOOL)
error (_("integral type expected in DWARF expression"));
}
static int
base_types_equal_p (struct type *t1, struct type *t2)
{
- if (TYPE_CODE (t1) != TYPE_CODE (t2))
+ if (t1->code () != t2->code ())
return 0;
if (TYPE_UNSIGNED (t1) != TYPE_UNSIGNED (t2))
return 0;
/* Note: Things still work when the following test is removed. This
test and error is here to conform to the proposed specification. */
- if (TYPE_CODE (die_type) != TYPE_CODE_INT
- && TYPE_CODE (die_type) != TYPE_CODE_PTR)
+ if (die_type->code () != TYPE_CODE_INT
+ && die_type->code () != TYPE_CODE_PTR)
error (_("Type of DW_OP_GNU_variable_value DIE must be an integer or pointer."));
struct type *type = lookup_pointer_type (die_type);
paddress (gdbarch, addr));
type = SYMBOL_TYPE (sym);
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_FUNC);
+ gdb_assert (type->code () == TYPE_CODE_FUNC);
gdb_assert (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_FUNC);
return sym;
enum bfd_endian byte_order;
type = check_typedef (value_type (value));
- if (TYPE_CODE (type) != TYPE_CODE_PTR)
+ if (type->code () != TYPE_CODE_PTR)
return NULL;
bit_length = 8 * TYPE_LENGTH (type);
the operation. Therefore, we do the conversion here
since the type is readily available. */
- switch (TYPE_CODE (subobj_type))
+ switch (subobj_type->code ())
{
case TYPE_CODE_FUNC:
case TYPE_CODE_METHOD:
static void
quirk_rust_enum (struct type *type, struct objfile *objfile)
{
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_UNION);
+ gdb_assert (type->code () == TYPE_CODE_UNION);
/* We don't need to deal with empty enums. */
if (TYPE_NFIELDS (type) == 0)
{
disr_type = TYPE_FIELD_TYPE (type, i);
- if (TYPE_CODE (disr_type) != TYPE_CODE_STRUCT)
+ if (disr_type->code () != TYPE_CODE_STRUCT)
{
/* All fields of a true enum will be structs. */
return;
the two cases. */
if (TYPE_NFIELDS (type) > 0
&& TYPE_FIELD_ARTIFICIAL (type, 0)
- && TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_PTR
+ && TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_PTR
&& TYPE_CONST (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type,
0))))
buf.puts (" const");
sect_offset sect_off = attr->get_ref_die_offset ();
type = get_die_type_at_offset (sect_off, cu->per_cu);
- if (type != NULL && TYPE_CODE (type) == TYPE_CODE_NAMESPACE)
+ if (type != NULL && type->code () == TYPE_CODE_NAMESPACE)
{
/* This declaration is a global namespace alias. Add
a symbol for it whose type is the aliased namespace. */
func_type = get_die_type (func_die, cu);
if (func_type != NULL)
{
- gdb_assert (TYPE_CODE (func_type) == TYPE_CODE_FUNC);
+ gdb_assert (func_type->code () == TYPE_CODE_FUNC);
/* Enlist this call site to the function. */
call_site->tail_call_next = TYPE_TAIL_CALL_LIST (func_type);
fnp->type = alloc_type (objfile);
this_type = read_type_die (die, cu);
- if (this_type && TYPE_CODE (this_type) == TYPE_CODE_FUNC)
+ if (this_type && this_type->code () == TYPE_CODE_FUNC)
{
int nparams = TYPE_NFIELDS (this_type);
struct type *pfn_type, *self_type, *new_type;
/* Check for a structure with no name and two children. */
- if (TYPE_CODE (type) != TYPE_CODE_STRUCT || TYPE_NFIELDS (type) != 2)
+ if (type->code () != TYPE_CODE_STRUCT || TYPE_NFIELDS (type) != 2)
return;
/* Check for __pfn and __delta members. */
/* Find the type of the method. */
pfn_type = TYPE_FIELD_TYPE (type, 0);
if (pfn_type == NULL
- || TYPE_CODE (pfn_type) != TYPE_CODE_PTR
- || TYPE_CODE (TYPE_TARGET_TYPE (pfn_type)) != TYPE_CODE_FUNC)
+ || pfn_type->code () != TYPE_CODE_PTR
+ || TYPE_TARGET_TYPE (pfn_type)->code () != TYPE_CODE_FUNC)
return;
/* Look for the "this" argument. */
pfn_type = TYPE_TARGET_TYPE (pfn_type);
if (TYPE_NFIELDS (pfn_type) == 0
/* || TYPE_FIELD_TYPE (pfn_type, 0) == NULL */
- || TYPE_CODE (TYPE_FIELD_TYPE (pfn_type, 0)) != TYPE_CODE_PTR)
+ || TYPE_FIELD_TYPE (pfn_type, 0)->code () != TYPE_CODE_PTR)
return;
self_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (pfn_type, 0));
if (type)
return type;
- if (TYPE_CODE (check_typedef (to_type)) == TYPE_CODE_METHOD)
+ if (check_typedef (to_type)->code () == TYPE_CODE_METHOD)
type = lookup_methodptr_type (to_type);
- else if (TYPE_CODE (check_typedef (to_type)) == TYPE_CODE_FUNC)
+ else if (check_typedef (to_type)->code () == TYPE_CODE_FUNC)
{
struct type *new_type
= alloc_type (cu->per_cu->dwarf2_per_objfile->objfile);
base_type = copy_type (base_type);
inner_array = base_type;
- while (TYPE_CODE (TYPE_TARGET_TYPE (inner_array)) == TYPE_CODE_ARRAY)
+ while (TYPE_TARGET_TYPE (inner_array)->code () == TYPE_CODE_ARRAY)
{
TYPE_TARGET_TYPE (inner_array) =
copy_type (TYPE_TARGET_TYPE (inner_array));
/* In case the const qualifier is applied to an array type, the element type
is so qualified, not the array type (section 6.7.3 of C99). */
- if (TYPE_CODE (base_type) == TYPE_CODE_ARRAY)
+ if (base_type->code () == TYPE_CODE_ARRAY)
return add_array_cv_type (die, cu, base_type, 1, 0);
cv_type = make_cv_type (1, TYPE_VOLATILE (base_type), base_type, 0);
/* In case the volatile qualifier is applied to an array type, the
element type is so qualified, not the array type (section 6.7.3
of C99). */
- if (TYPE_CODE (base_type) == TYPE_CODE_ARRAY)
+ 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, 0);
case DW_ATE_complex_float:
type = dwarf2_init_complex_target_type (cu, objfile, bits / 2, name,
byte_order);
- if (TYPE_CODE (type) == TYPE_CODE_ERROR)
+ if (type->code () == TYPE_CODE_ERROR)
{
if (name == nullptr)
{
GCC produces an empty range DIE.
FIXME: muller/2010-05-28: Possible references to object for low bound,
high bound or count are not yet handled by this code. */
- if (TYPE_CODE (index_type) == TYPE_CODE_VOID)
+ if (index_type->code () == TYPE_CODE_VOID)
index_type = cu->per_cu->addr_sized_int_type (false);
return index_type;
/* Compilation with minimal debug info may result in
variables with missing type entries. Change the
misleading `void' type to something sensible. */
- if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_VOID)
+ if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_VOID)
SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_int;
attr = dwarf2_attr (die, DW_AT_const_value, cu);
But this is not a problem, because the gnat-specific information
is actually not needed for these types. */
if (need_gnat_info (cu)
- && TYPE_CODE (type) != TYPE_CODE_FUNC
- && TYPE_CODE (type) != TYPE_CODE_FLT
- && TYPE_CODE (type) != TYPE_CODE_METHODPTR
- && TYPE_CODE (type) != TYPE_CODE_MEMBERPTR
- && TYPE_CODE (type) != TYPE_CODE_METHOD
+ && type->code () != TYPE_CODE_FUNC
+ && type->code () != TYPE_CODE_FLT
+ && type->code () != TYPE_CODE_METHODPTR
+ && type->code () != TYPE_CODE_MEMBERPTR
+ && type->code () != TYPE_CODE_METHOD
&& !HAVE_GNAT_AUX_INFO (type))
INIT_GNAT_SPECIFIC (type);
if (fieldno >= TYPE_NFIELDS (struct_type))
error (_("too many initializers"));
field_type = TYPE_FIELD_TYPE (struct_type, fieldno);
- if (TYPE_CODE (field_type) == TYPE_CODE_UNION
+ if (field_type->code () == TYPE_CODE_UNION
&& TYPE_FIELD_NAME (struct_type, fieldno)[0] == '0')
error (_("don't know which variant you want to set"));
type1 = check_typedef (value_type (*arg1));
type2 = check_typedef (value_type (*arg2));
- if ((TYPE_CODE (type1) != TYPE_CODE_FLT
- && TYPE_CODE (type1) != TYPE_CODE_DECFLOAT
+ if ((type1->code () != TYPE_CODE_FLT
+ && type1->code () != TYPE_CODE_DECFLOAT
&& !is_integral_type (type1))
- || (TYPE_CODE (type2) != TYPE_CODE_FLT
- && TYPE_CODE (type2) != TYPE_CODE_DECFLOAT
+ || (type2->code () != TYPE_CODE_FLT
+ && type2->code () != TYPE_CODE_DECFLOAT
&& !is_integral_type (type2)))
return;
- if (TYPE_CODE (type1) == TYPE_CODE_DECFLOAT
- || TYPE_CODE (type2) == TYPE_CODE_DECFLOAT)
+ if (type1->code () == TYPE_CODE_DECFLOAT
+ || type2->code () == TYPE_CODE_DECFLOAT)
{
/* No promotion required. */
}
- else if (TYPE_CODE (type1) == TYPE_CODE_FLT
- || TYPE_CODE (type2) == TYPE_CODE_FLT)
+ else if (type1->code () == TYPE_CODE_FLT
+ || type2->code () == TYPE_CODE_FLT)
{
switch (language->la_language)
{
break;
}
}
- else if (TYPE_CODE (type1) == TYPE_CODE_BOOL
- && TYPE_CODE (type2) == TYPE_CODE_BOOL)
+ else if (type1->code () == TYPE_CODE_BOOL
+ && type2->code () == TYPE_CODE_BOOL)
{
/* No promotion required. */
}
if (TYPE_IS_REFERENCE (type))
type = TYPE_TARGET_TYPE (type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_PTR:
case TYPE_CODE_FUNC:
--num_types;
TYPE_VARARGS (type) = 1;
}
- else if (TYPE_CODE (check_typedef (param_types[num_types - 1]))
+ else if (check_typedef (param_types[num_types - 1])->code ()
== TYPE_CODE_VOID)
{
--num_types;
type *ftype = value_type (argvec[0]);
- if (TYPE_CODE (ftype) == TYPE_CODE_INTERNAL_FUNCTION)
+ if (ftype->code () == TYPE_CODE_INTERNAL_FUNCTION)
{
/* We don't know anything about what the internal
function might return, but we have to return
return value_zero (builtin_type (exp->gdbarch)->builtin_int,
not_lval);
}
- else if (TYPE_CODE (ftype) == TYPE_CODE_XMETHOD)
+ else if (ftype->code () == TYPE_CODE_XMETHOD)
{
type *return_type
= result_type_of_xmethod (argvec[0],
error (_("Xmethod is missing return type."));
return value_zero (return_type, not_lval);
}
- else if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
- || TYPE_CODE (ftype) == TYPE_CODE_METHOD)
+ else if (ftype->code () == TYPE_CODE_FUNC
+ || ftype->code () == TYPE_CODE_METHOD)
{
if (TYPE_GNU_IFUNC (ftype))
{
error (_("Expression of type other than "
"\"Function returning ...\" used as function"));
}
- switch (TYPE_CODE (value_type (argvec[0])))
+ switch (value_type (argvec[0])->code ())
{
case TYPE_CODE_INTERNAL_FUNCTION:
return call_internal_function (exp->gdbarch, exp->language_defn,
if (noside == EVAL_SKIP)
tem = 1; /* Set it to the right arg index so that all
arguments can also be skipped. */
- else if (TYPE_CODE (a1_type) == TYPE_CODE_METHODPTR)
+ else if (a1_type->code () == TYPE_CODE_METHODPTR)
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
arg1 = value_zero (TYPE_TARGET_TYPE (a1_type), not_lval);
tem = 2;
argvec[1] = arg2;
}
- else if (TYPE_CODE (a1_type) == TYPE_CODE_MEMBERPTR)
+ else if (a1_type->code () == TYPE_CODE_MEMBERPTR)
{
struct type *type_ptr
= lookup_pointer_type (TYPE_SELF_TYPE (a1_type));
function = NULL;
function_name = NULL;
- if (TYPE_CODE (type) == TYPE_CODE_NAMESPACE)
+ if (type->code () == TYPE_CODE_NAMESPACE)
{
function = cp_lookup_symbol_namespace (TYPE_NAME (type),
name,
}
else
{
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION);
+ gdb_assert (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION);
function_name = name;
/* We need a properly typed value for method lookup. For
argvec[0] = evaluate_subexp_with_coercion (exp, pos, noside);
type *type = value_type (argvec[0]);
- if (type && TYPE_CODE (type) == TYPE_CODE_PTR)
+ if (type && type->code () == TYPE_CODE_PTR)
type = TYPE_TARGET_TYPE (type);
- if (type && TYPE_CODE (type) == TYPE_CODE_FUNC)
+ if (type && type->code () == TYPE_CODE_FUNC)
{
for (; tem <= nargs && tem <= TYPE_NFIELDS (type); tem++)
{
{
(*pos) += 3;
symbol *var = exp->elts[pc + 2].symbol;
- if (TYPE_CODE (SYMBOL_TYPE (var)) == TYPE_CODE_ERROR)
+ if (SYMBOL_TYPE (var)->code () == TYPE_CODE_ERROR)
error_unknown_type (var->print_name ());
if (noside != EVAL_SKIP)
return evaluate_var_value (noside, exp->elts[pc + 1].block, var);
msymbol);
type = value_type (val);
- if (TYPE_CODE (type) == TYPE_CODE_ERROR
+ if (type->code () == TYPE_CODE_ERROR
&& (noside != EVAL_AVOID_SIDE_EFFECTS || pc != 0))
error_unknown_type (msymbol->print_name ());
return val;
type = expect_type ? check_typedef (expect_type) : NULL_TYPE;
if (expect_type != NULL_TYPE && noside != EVAL_SKIP
- && TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ && type->code () == TYPE_CODE_STRUCT)
{
struct value *rec = allocate_value (expect_type);
}
if (expect_type != NULL_TYPE && noside != EVAL_SKIP
- && TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ && type->code () == TYPE_CODE_ARRAY)
{
struct type *range_type = TYPE_INDEX_TYPE (type);
struct type *element_type = TYPE_TARGET_TYPE (type);
}
if (expect_type != NULL_TYPE && noside != EVAL_SKIP
- && TYPE_CODE (type) == TYPE_CODE_SET)
+ && type->code () == TYPE_CODE_SET)
{
struct value *set = allocate_value (expect_type);
gdb_byte *valaddr = value_contents_raw (set);
LONGEST low_bound, high_bound;
/* Get targettype of elementtype. */
- while (TYPE_CODE (check_type) == TYPE_CODE_RANGE
- || TYPE_CODE (check_type) == TYPE_CODE_TYPEDEF)
+ while (check_type->code () == TYPE_CODE_RANGE
+ || check_type->code () == TYPE_CODE_TYPEDEF)
check_type = TYPE_TARGET_TYPE (check_type);
if (get_discrete_bounds (element_type, &low_bound, &high_bound) < 0)
/* Check types of elements to avoid mixture of elements from
different types. Also check if type of element is "compatible"
with element type of powerset. */
- if (TYPE_CODE (range_low_type) == TYPE_CODE_RANGE)
+ if (range_low_type->code () == TYPE_CODE_RANGE)
range_low_type = TYPE_TARGET_TYPE (range_low_type);
- if (TYPE_CODE (range_high_type) == TYPE_CODE_RANGE)
+ if (range_high_type->code () == TYPE_CODE_RANGE)
range_high_type = TYPE_TARGET_TYPE (range_high_type);
- if ((TYPE_CODE (range_low_type) != TYPE_CODE (range_high_type))
- || (TYPE_CODE (range_low_type) == TYPE_CODE_ENUM
+ if ((range_low_type->code () != range_high_type->code ())
+ || (range_low_type->code () == TYPE_CODE_ENUM
&& (range_low_type != range_high_type)))
/* different element modes. */
error (_("POWERSET tuple elements of different mode"));
- if ((TYPE_CODE (check_type) != TYPE_CODE (range_low_type))
- || (TYPE_CODE (check_type) == TYPE_CODE_ENUM
+ if ((check_type->code () != range_low_type->code ())
+ || (check_type->code () == TYPE_CODE_ENUM
&& range_low_type != check_type))
error (_("incompatible POWERSET tuple elements"));
if (range_low > range_high)
block_for_pc (funaddr);
val_type = check_typedef (val_type);
-
- if ((val_type == NULL)
- || (TYPE_CODE(val_type) == TYPE_CODE_ERROR))
+
+ if ((val_type == NULL)
+ || (val_type->code () == TYPE_CODE_ERROR))
{
if (expect_type != NULL)
val_type = expect_type;
struct_return = using_struct_return (exp->gdbarch, NULL,
check_typedef (expect_type));
}
-
+
/* Found a function symbol. Now we will substitute its
value in place of the message dispatcher (obj_msgSend),
so that we call the method directly instead of thru
if (method)
{
- if (TYPE_CODE (value_type (method)) != TYPE_CODE_FUNC)
+ if (value_type (method)->code () != TYPE_CODE_FUNC)
error (_("method address has symbol information "
"with non-function type; skipping"));
struct type *callee_type = value_type (called_method);
- if (callee_type && TYPE_CODE (callee_type) == TYPE_CODE_PTR)
+ if (callee_type && callee_type->code () == TYPE_CODE_PTR)
callee_type = TYPE_TARGET_TYPE (callee_type);
callee_type = TYPE_TARGET_TYPE (callee_type);
if (callee_type)
{
- if ((TYPE_CODE (callee_type) == TYPE_CODE_ERROR) && expect_type)
+ if ((callee_type->code () == TYPE_CODE_ERROR) && expect_type)
return allocate_value (expect_type);
else
return allocate_value (callee_type);
/* First determine the type code we are dealing with. */
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
type = check_typedef (value_type (arg1));
- code = TYPE_CODE (type);
+ code = type->code ();
if (code == TYPE_CODE_PTR)
{
to the target value the original one points to. */
struct type *target_type = check_typedef (TYPE_TARGET_TYPE (type));
- if (TYPE_CODE (target_type) == TYPE_CODE_ARRAY
- || TYPE_CODE (target_type) == TYPE_CODE_STRING
- || TYPE_CODE (target_type) == TYPE_CODE_FUNC)
+ if (target_type->code () == TYPE_CODE_ARRAY
+ || target_type->code () == TYPE_CODE_STRING
+ || target_type->code () == TYPE_CODE_FUNC)
{
arg1 = value_ind (arg1);
type = check_typedef (value_type (arg1));
- code = TYPE_CODE (type);
+ code = type->code ();
}
}
get_user_print_options (&opts);
if (opts.objectprint && TYPE_TARGET_TYPE (arg_type)
- && (TYPE_CODE (TYPE_TARGET_TYPE (arg_type)) == TYPE_CODE_STRUCT))
+ && (TYPE_TARGET_TYPE (arg_type)->code () == TYPE_CODE_STRUCT))
{
real_type = value_rtti_indirect_type (arg1, &full, &top,
&using_enc);
return eval_skip_value (exp);
type = check_typedef (value_type (arg2));
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_METHODPTR:
if (noside == EVAL_AVOID_SIDE_EFFECTS)
else
{
arg2 = cplus_method_ptr_to_value (&arg1, arg2);
- gdb_assert (TYPE_CODE (value_type (arg2)) == TYPE_CODE_PTR);
+ gdb_assert (value_type (arg2)->code () == TYPE_CODE_PTR);
return value_ind (arg2);
}
arg1 = coerce_ref (arg1);
type = check_typedef (value_type (arg1));
- if (TYPE_CODE (type) != TYPE_CODE_ARRAY
- && TYPE_CODE (type) != TYPE_CODE_PTR)
+ if (type->code () != TYPE_CODE_ARRAY
+ && type->code () != TYPE_CODE_PTR)
{
if (TYPE_NAME (type))
error (_("cannot subscript something of type `%s'"),
arg1 = coerce_ref (arg1);
type = check_typedef (value_type (arg1));
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_PTR:
case TYPE_CODE_ARRAY:
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
type = check_typedef (value_type (arg2));
- if (TYPE_CODE (type) != TYPE_CODE_INT
- && TYPE_CODE (type) != TYPE_CODE_ENUM)
+ if (type->code () != TYPE_CODE_INT
+ && type->code () != TYPE_CODE_ENUM)
error (_("Non-integral right operand for \"@\" operator."));
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
}
case UNOP_IND:
- if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_PTR)
+ if (expect_type && expect_type->code () == TYPE_CODE_PTR)
expect_type = TYPE_TARGET_TYPE (check_typedef (expect_type));
arg1 = evaluate_subexp (expect_type, exp, pos, noside);
type = check_typedef (value_type (arg1));
- if (TYPE_CODE (type) == TYPE_CODE_METHODPTR
- || TYPE_CODE (type) == TYPE_CODE_MEMBERPTR)
+ if (type->code () == TYPE_CODE_METHODPTR
+ || type->code () == TYPE_CODE_MEMBERPTR)
error (_("Attempt to dereference pointer "
"to member without an object"));
if (noside == EVAL_SKIP)
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
type = check_typedef (value_type (arg1));
- if (TYPE_CODE (type) == TYPE_CODE_PTR
+ if (type->code () == TYPE_CODE_PTR
|| TYPE_IS_REFERENCE (type)
/* In C you can dereference an array to get the 1st elt. */
- || TYPE_CODE (type) == TYPE_CODE_ARRAY
+ || type->code () == TYPE_CODE_ARRAY
)
return value_zero (TYPE_TARGET_TYPE (type),
lval_memory);
- else if (TYPE_CODE (type) == TYPE_CODE_INT)
+ else if (type->code () == TYPE_CODE_INT)
/* GDB allows dereferencing an int. */
return value_zero (builtin_type (exp->gdbarch)->builtin_int,
lval_memory);
This returns an int, which seems like the most C-like thing to
do. "long long" variables are rare enough that
BUILTIN_TYPE_LONGEST would seem to be a mistake. */
- if (TYPE_CODE (type) == TYPE_CODE_INT)
+ if (type->code () == TYPE_CODE_INT)
return value_at_lazy (builtin_type (exp->gdbarch)->builtin_int,
(CORE_ADDR) value_as_address (arg1));
return value_ind (arg1);
case OP_VAR_VALUE:
var = exp->elts[pc + 2].symbol;
type = check_typedef (SYMBOL_TYPE (var));
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY
+ if (type->code () == TYPE_CODE_ARRAY
&& !TYPE_VECTOR (type)
&& CAST_IS_CONVERSION (exp->language_defn))
{
(*pos)++;
val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
type = check_typedef (value_type (val));
- if (TYPE_CODE (type) != TYPE_CODE_PTR
+ if (type->code () != TYPE_CODE_PTR
&& !TYPE_IS_REFERENCE (type)
- && TYPE_CODE (type) != TYPE_CODE_ARRAY)
+ && type->code () != TYPE_CODE_ARRAY)
error (_("Attempt to take contents of a non-pointer value."));
type = TYPE_TARGET_TYPE (type);
if (is_dynamic_type (type))
{
val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_NORMAL);
type = value_type (val);
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY
+ if (type->code () == TYPE_CODE_ARRAY
&& is_dynamic_type (TYPE_INDEX_TYPE (type))
&& TYPE_HIGH_BOUND_UNDEFINED (TYPE_INDEX_TYPE (type)))
return allocate_optimized_out_value (size_type);
msymbol);
type = value_type (mval);
- if (TYPE_CODE (type) == TYPE_CODE_ERROR)
+ if (type->code () == TYPE_CODE_ERROR)
error_unknown_type (msymbol->print_name ());
return value_from_longest (size_type, TYPE_LENGTH (type));
val = evaluate_subexp (NULL_TYPE, exp, &npc, EVAL_AVOID_SIDE_EFFECTS);
type = check_typedef (value_type (val));
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ if (type->code () == TYPE_CODE_ARRAY)
{
type = check_typedef (TYPE_TARGET_TYPE (type));
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ if (type->code () == TYPE_CODE_ARRAY)
{
type = TYPE_INDEX_TYPE (type);
/* Only re-evaluate the right hand side if the resulting type
int ndimen = 1;
struct type *tmp_type;
- if ((TYPE_CODE (array_type) != TYPE_CODE_ARRAY))
+ if ((array_type->code () != TYPE_CODE_ARRAY))
error (_("Can't get dimensions for a non-array type"));
tmp_type = array_type;
while ((tmp_type = TYPE_TARGET_TYPE (tmp_type)))
{
- if (TYPE_CODE (tmp_type) == TYPE_CODE_ARRAY)
+ if (tmp_type->code () == TYPE_CODE_ARRAY)
++ndimen;
}
return ndimen;
(*pos) += 2;
if ((int) prec > (int) PREC_PREFIX)
fputs_filtered ("(", stream);
- if (TYPE_CODE (exp->elts[pc + 1].type) == TYPE_CODE_FUNC
+ if (exp->elts[pc + 1].type->code () == TYPE_CODE_FUNC
&& exp->elts[pc + 3].opcode == OP_LONG)
{
struct value_print_options opts;
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
type = value_type (arg1);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_FLT:
{
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
type = value_type (arg1);
- if (TYPE_CODE (type) != TYPE_CODE (value_type (arg2)))
+ if (type->code () != value_type (arg2)->code ())
error (_("non-matching types for parameters to MOD ()"));
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_FLT:
{
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
type = value_type (arg1);
- if (TYPE_CODE (type) != TYPE_CODE_FLT)
+ if (type->code () != TYPE_CODE_FLT)
error (_("argument to CEILING must be of type float"));
double val
= target_float_to_host_double (value_contents (arg1),
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
type = value_type (arg1);
- if (TYPE_CODE (type) != TYPE_CODE_FLT)
+ if (type->code () != TYPE_CODE_FLT)
error (_("argument to FLOOR must be of type float"));
double val
= target_float_to_host_double (value_contents (arg1),
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
type = value_type (arg1);
- if (TYPE_CODE (type) != TYPE_CODE (value_type (arg2)))
+ if (type->code () != value_type (arg2)->code ())
error (_("non-matching types for parameters to MODULO ()"));
/* MODULO(A, P) = A - FLOOR (A / P) * P */
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_INT:
{
arg1 = evaluate_subexp (NULL, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
type = value_type (arg1);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
return value_from_longest (builtin_type (exp->gdbarch)->builtin_int,
TYPE_LENGTH (type));
return value_from_longest (builtin_type (exp->gdbarch)->builtin_int,
- TYPE_LENGTH (TYPE_TARGET_TYPE(type)));
+ TYPE_LENGTH (TYPE_TARGET_TYPE (type)));
}
/* Should be unreachable. */
f_is_string_type_p (struct type *type)
{
type = check_typedef (type);
- return (TYPE_CODE (type) == TYPE_CODE_STRING
- || (TYPE_CODE (type) == TYPE_CODE_ARRAY
- && TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CHAR));
+ return (type->code () == TYPE_CODE_STRING
+ || (type->code () == TYPE_CODE_ARRAY
+ && TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_CHAR));
}
/* Special expression lengths for Fortran. */
builtin_f_type->builtin_complex_s16
= init_complex_type ("complex*16", builtin_f_type->builtin_real_s8);
- if (TYPE_CODE (builtin_f_type->builtin_real_s16) == TYPE_CODE_ERROR)
+ if (builtin_f_type->builtin_real_s16->code () == TYPE_CODE_ERROR)
builtin_f_type->builtin_complex_s32
= arch_type (gdbarch, TYPE_CODE_ERROR, 256, "complex*32");
else
struct type *
fortran_preserve_arg_pointer (struct value *arg, struct type *type)
{
- if (TYPE_CODE (value_type (arg)) == TYPE_CODE_PTR)
+ if (value_type (arg)->code () == TYPE_CODE_PTR)
return value_type (arg);
return type;
}
enum type_code code;
f_type_print_base (type, stream, show, level);
- code = TYPE_CODE (type);
+ code = type->code ();
if ((varstring != NULL && *varstring != '\0')
/* Need a space if going to print stars or brackets; but not if we
will print just a type name. */
|| code == TYPE_CODE_ARRAY
|| ((code == TYPE_CODE_PTR
|| code == TYPE_CODE_REF)
- && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
- || (TYPE_CODE (TYPE_TARGET_TYPE (type))
+ && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC
+ || (TYPE_TARGET_TYPE (type)->code ()
== TYPE_CODE_METHOD)
- || (TYPE_CODE (TYPE_TARGET_TYPE (type))
+ || (TYPE_TARGET_TYPE (type)->code ()
== TYPE_CODE_ARRAY))))))
fputs_filtered (" ", stream);
f_type_print_varspec_prefix (type, stream, show, 0);
QUIT;
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_PTR:
f_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 1);
QUIT;
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_ARRAY:
arrayprint_recurse_level++;
print_rank_only = true;
}
- if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY)
+ if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ARRAY)
f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
0, 0, arrayprint_recurse_level,
print_rank_only);
}
}
- if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_ARRAY)
+ if (TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_ARRAY)
f_type_print_varspec_suffix (TYPE_TARGET_TYPE (type), stream, 0,
0, 0, arrayprint_recurse_level,
print_rank_only);
if ((show <= 0) && (TYPE_NAME (type) != NULL))
{
const char *prefix = "";
- if (TYPE_CODE (type) == TYPE_CODE_UNION)
+ if (type->code () == TYPE_CODE_UNION)
prefix = "Type, C_Union :: ";
- else if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ else if (type->code () == TYPE_CODE_STRUCT)
prefix = "Type ";
fprintfi_filtered (level, stream, "%s%s", prefix, TYPE_NAME (type));
return;
}
- if (TYPE_CODE (type) != TYPE_CODE_TYPEDEF)
+ if (type->code () != TYPE_CODE_TYPEDEF)
type = check_typedef (type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_TYPEDEF:
f_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
- if (TYPE_CODE (type) == TYPE_CODE_UNION)
+ if (type->code () == TYPE_CODE_UNION)
fprintfi_filtered (level, stream, "Type, C_Union :: ");
else
fprintfi_filtered (level, stream, "Type ");
if (TYPE_NAME (type) != NULL)
fprintfi_filtered (level, stream, "%s", TYPE_NAME (type));
else
- error (_("Invalid type code (%d) in symbol table."), TYPE_CODE (type));
+ error (_("Invalid type code (%d) in symbol table."), type->code ());
break;
}
This function also works for strings which behave very
similarly to arrays. */
- if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY
- || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRING)
+ if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ARRAY
+ || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRING)
f77_get_dynamic_length_of_aggregate (TYPE_TARGET_TYPE (type));
/* Recursion ends here, start setting up lengths. */
const gdb_byte *valaddr = value_contents_for_printing (val);
const CORE_ADDR address = value_address (val);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_STRING:
f77_get_dynamic_length_of_aggregate (type);
break;
case TYPE_CODE_ARRAY:
- if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_CHAR)
+ if (TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_CHAR)
{
fprintf_filtered (stream, "(");
f77_print_array (type, valaddr, 0,
addr = unpack_pointer (type, valaddr);
elttype = check_typedef (TYPE_TARGET_TYPE (type));
- if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
+ if (elttype->code () == TYPE_CODE_FUNC)
{
/* Try to print what function it points to. */
print_function_pointer_address (options, gdbarch, addr, stream);
/* For a pointer to char or unsigned char, also print the string
pointed to, unless pointer is null. */
if (TYPE_LENGTH (elttype) == 1
- && TYPE_CODE (elttype) == TYPE_CODE_INT
+ && elttype->code () == TYPE_CODE_INT
&& (options->format == 0 || options->format == 's')
&& addr != 0)
{
struct type *field_type = check_typedef (TYPE_FIELD_TYPE (type, index));
- if (TYPE_CODE (field_type) != TYPE_CODE_FUNC)
+ if (field_type->code () != TYPE_CODE_FUNC)
{
const char *field_name;
language_c, NULL).symbol;
if (obj_entry_sym == NULL)
error (_("Unable to find Struct_Obj_Entry symbol"));
- data->off_linkmap = lookup_struct_elt (SYMBOL_TYPE(obj_entry_sym),
+ data->off_linkmap = lookup_struct_elt (SYMBOL_TYPE (obj_entry_sym),
"linkmap", 0).offset / 8;
- data->off_tlsindex = lookup_struct_elt (SYMBOL_TYPE(obj_entry_sym),
+ data->off_tlsindex = lookup_struct_elt (SYMBOL_TYPE (obj_entry_sym),
"tlsindex", 0).offset / 8;
data->rtld_offsets_valid = true;
return;
CORE_ADDR
extract_typed_address (const gdb_byte *buf, struct type *type)
{
- if (TYPE_CODE (type) != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type))
+ if (type->code () != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type))
internal_error (__FILE__, __LINE__,
_("extract_typed_address: "
"type is not a pointer or reference"));
void
store_typed_address (gdb_byte *buf, struct type *type, CORE_ADDR addr)
{
- if (TYPE_CODE (type) != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type))
+ if (type->code () != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type))
internal_error (__FILE__, __LINE__,
_("store_typed_address: "
"type is not a pointer or reference"));
/* Return a `value' with the contents of (virtual or cooked) register
REGNUM as found in the specified FRAME. The register's type is
- determined by register_type(). */
+ determined by register_type (). */
struct value *
value_of_register (int regnum, struct frame_info *frame)
/* Return a `value' with the contents of (virtual or cooked) register
REGNUM as found in the specified FRAME. The register's type is
- determined by register_type(). The value is not fetched. */
+ determined by register_type (). The value is not fetched. */
struct value *
value_of_register_lazy (struct frame_info *frame, int regnum)
arg = args[argnum];
arg_type = check_typedef (value_type (arg));
len = TYPE_LENGTH (arg_type);
- typecode = TYPE_CODE (arg_type);
+ typecode = arg_type->code ();
if (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)
{
else if (abi == FRV_ABI_FDPIC
&& len == 4
&& typecode == TYPE_CODE_PTR
- && TYPE_CODE (TYPE_TARGET_TYPE (arg_type)) == TYPE_CODE_FUNC)
+ && TYPE_TARGET_TYPE (arg_type)->code () == TYPE_CODE_FUNC)
{
/* The FDPIC ABI requires function descriptors to be passed instead
of entry points. */
struct type *valtype, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
- int struct_return = TYPE_CODE (valtype) == TYPE_CODE_STRUCT
- || TYPE_CODE (valtype) == TYPE_CODE_UNION
- || TYPE_CODE (valtype) == TYPE_CODE_ARRAY;
+ int struct_return = valtype->code () == TYPE_CODE_STRUCT
+ || valtype->code () == TYPE_CODE_UNION
+ || valtype->code () == TYPE_CODE_ARRAY;
if (writebuf != NULL)
{
{
std::vector<gdb_byte> expected (TYPE_LENGTH (type), 0);
- if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ if (type->code () == TYPE_CODE_FLT)
{
/* Generate valid float format. */
target_float_from_string (expected.data (), type, "1.25");
--nparams;
TYPE_VARARGS (fn) = 1;
}
- else if (TYPE_CODE (check_typedef (param_types[nparams - 1]))
+ else if (check_typedef (param_types[nparams - 1])->code ()
== TYPE_CODE_VOID)
{
--nparams;
{
/* The INDEX_TYPE should be a type capable of holding the upper and lower
bounds, as such a zero sized, or void type makes no sense. */
- gdb_assert (TYPE_CODE (index_type) != TYPE_CODE_VOID);
+ gdb_assert (index_type->code () != TYPE_CODE_VOID);
gdb_assert (TYPE_LENGTH (index_type) > 0);
if (result_type == NULL)
get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
{
type = check_typedef (type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_RANGE:
*lowp = TYPE_LOW_BOUND (type);
int
discrete_position (struct type *type, LONGEST val, LONGEST *pos)
{
- if (TYPE_CODE (type) == TYPE_CODE_ENUM)
+ if (type->code () == TYPE_CODE_ENUM)
{
int i;
static bool
update_static_array_size (struct type *type)
{
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_ARRAY);
+ gdb_assert (type->code () == TYPE_CODE_ARRAY);
struct type *range_type = TYPE_INDEX_TYPE (type);
/* Find the innermost array type, in case the array is
multi-dimensional. */
inner_array = array_type;
- while (TYPE_CODE (TYPE_TARGET_TYPE (inner_array)) == TYPE_CODE_ARRAY)
+ while (TYPE_TARGET_TYPE (inner_array)->code () == TYPE_CODE_ARRAY)
inner_array = TYPE_TARGET_TYPE (inner_array);
elt_type = TYPE_TARGET_TYPE (inner_array);
- if (TYPE_CODE (elt_type) == TYPE_CODE_INT)
+ if (elt_type->code () == TYPE_CODE_INT)
{
flags = TYPE_INSTANCE_FLAGS (elt_type) | TYPE_INSTANCE_FLAG_NOTTEXT;
elt_type = make_qualified_type (elt_type, flags, NULL);
struct type *
internal_type_self_type (struct type *type)
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_METHODPTR:
case TYPE_CODE_MEMBERPTR:
void
set_type_self_type (struct type *type, struct type *self_type)
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_METHODPTR:
case TYPE_CODE_MEMBERPTR:
{
error (_("No struct type named %s."), name);
}
- if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_STRUCT)
+ if (SYMBOL_TYPE (sym)->code () != TYPE_CODE_STRUCT)
{
error (_("This context has class, union or enum %s, not a struct."),
name);
t = SYMBOL_TYPE (sym);
- if (TYPE_CODE (t) == TYPE_CODE_UNION)
+ if (t->code () == TYPE_CODE_UNION)
return t;
/* If we get here, it's not a union. */
{
error (_("No enum type named %s."), name);
}
- if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_ENUM)
+ if (SYMBOL_TYPE (sym)->code () != TYPE_CODE_ENUM)
{
error (_("This context has class, struct or union %s, not an enum."),
name);
{
error (_("No template type named %s."), name);
}
- if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_STRUCT)
+ if (SYMBOL_TYPE (sym)->code () != TYPE_CODE_STRUCT)
{
error (_("This context has class, union or enum %s, not a struct."),
name);
for (;;)
{
type = check_typedef (type);
- if (TYPE_CODE (type) != TYPE_CODE_PTR
- && TYPE_CODE (type) != TYPE_CODE_REF)
+ if (type->code () != TYPE_CODE_PTR
+ && type->code () != TYPE_CODE_REF)
break;
type = TYPE_TARGET_TYPE (type);
}
- if (TYPE_CODE (type) != TYPE_CODE_STRUCT
- && TYPE_CODE (type) != TYPE_CODE_UNION)
+ if (type->code () != TYPE_CODE_STRUCT
+ && type->code () != TYPE_CODE_UNION)
{
std::string type_name = type_to_string (type);
error (_("Type %s is not a structure or union type."),
unsigned int n;
type = check_typedef (type);
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_INT && TYPE_UNSIGNED (type));
+ gdb_assert (type->code () == TYPE_CODE_INT && TYPE_UNSIGNED (type));
gdb_assert (TYPE_LENGTH (type) <= sizeof (ULONGEST));
/* Written this way to avoid overflow. */
unsigned int n;
type = check_typedef (type);
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_INT && !TYPE_UNSIGNED (type));
+ gdb_assert (type->code () == TYPE_CODE_INT && !TYPE_UNSIGNED (type));
gdb_assert (TYPE_LENGTH (type) <= sizeof (LONGEST));
n = TYPE_LENGTH (type) * TARGET_CHAR_BIT;
internal_type_vptr_fieldno (struct type *type)
{
type = check_typedef (type);
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION);
+ gdb_assert (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION);
if (!HAVE_CPLUS_STRUCT (type))
return -1;
return TYPE_RAW_CPLUS_SPECIFIC (type)->vptr_fieldno;
set_type_vptr_fieldno (struct type *type, int fieldno)
{
type = check_typedef (type);
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION);
+ gdb_assert (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION);
if (!HAVE_CPLUS_STRUCT (type))
ALLOCATE_CPLUS_STRUCT_TYPE (type);
TYPE_RAW_CPLUS_SPECIFIC (type)->vptr_fieldno = fieldno;
internal_type_vptr_basetype (struct type *type)
{
type = check_typedef (type);
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION);
+ gdb_assert (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION);
gdb_assert (TYPE_SPECIFIC_FIELD (type) == TYPE_SPECIFIC_CPLUS_STUFF);
return TYPE_RAW_CPLUS_SPECIFIC (type)->vptr_basetype;
}
set_type_vptr_basetype (struct type *type, struct type *basetype)
{
type = check_typedef (type);
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION);
+ gdb_assert (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION);
if (!HAVE_CPLUS_STRUCT (type))
ALLOCATE_CPLUS_STRUCT_TYPE (type);
TYPE_RAW_CPLUS_SPECIFIC (type)->vptr_basetype = basetype;
type = check_typedef (type);
/* We only want to recognize references at the outermost level. */
- if (top_level && TYPE_CODE (type) == TYPE_CODE_REF)
+ if (top_level && type->code () == TYPE_CODE_REF)
type = check_typedef (TYPE_TARGET_TYPE (type));
/* Types that have a dynamic TYPE_DATA_LOCATION are considered
if (TYPE_HAS_DYNAMIC_LENGTH (type))
return 1;
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_RANGE:
{
const struct dynamic_prop *prop;
struct dynamic_prop low_bound, high_bound, stride;
- gdb_assert (TYPE_CODE (dyn_range_type) == TYPE_CODE_RANGE);
+ gdb_assert (dyn_range_type->code () == TYPE_CODE_RANGE);
prop = &TYPE_RANGE_DATA (dyn_range_type)->low;
if (dwarf2_evaluate_property (prop, NULL, addr_stack, &value))
/* For dynamic type resolution strings can be treated like arrays of
characters. */
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_ARRAY
- || TYPE_CODE (type) == TYPE_CODE_STRING);
+ gdb_assert (type->code () == TYPE_CODE_ARRAY
+ || type->code () == TYPE_CODE_STRING);
type = copy_type (type);
ary_dim = check_typedef (TYPE_TARGET_TYPE (elt_type));
- if (ary_dim != NULL && TYPE_CODE (ary_dim) == TYPE_CODE_ARRAY)
+ if (ary_dim != NULL && ary_dim->code () == TYPE_CODE_ARRAY)
elt_type = resolve_dynamic_array_or_string (ary_dim, addr_stack);
else
elt_type = TYPE_TARGET_TYPE (type);
int i;
unsigned int max_len = 0;
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_UNION);
+ gdb_assert (type->code () == TYPE_CODE_UNION);
resolved_type = copy_type (type);
TYPE_FIELDS (resolved_type)
int i;
unsigned resolved_type_bit_length = 0;
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT);
+ gdb_assert (type->code () == TYPE_CODE_STRUCT);
gdb_assert (TYPE_NFIELDS (type) > 0);
resolved_type = copy_type (type);
&& dwarf2_evaluate_property (prop, NULL, addr_stack, &value))
type_length = value;
- if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
+ if (type->code () == TYPE_CODE_TYPEDEF)
{
resolved_type = copy_type (type);
TYPE_TARGET_TYPE (resolved_type)
/* Before trying to resolve TYPE, make sure it is not a stub. */
type = real_type;
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_REF:
{
gdb_assert (type);
- while (TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
+ while (type->code () == TYPE_CODE_TYPEDEF)
{
if (!TYPE_TARGET_TYPE (type))
{
/* Same as above for opaque types, we can replace the stub
with the complete type only if they are in the same
objfile. */
- if (TYPE_OBJFILE (SYMBOL_TYPE(sym)) == TYPE_OBJFILE (type))
+ if (TYPE_OBJFILE (SYMBOL_TYPE (sym)) == TYPE_OBJFILE (type))
type = make_qualified_type (SYMBOL_TYPE (sym),
TYPE_INSTANCE_FLAGS (type),
type);
{
/* Nothing we can do. */
}
- else if (TYPE_CODE (type) == TYPE_CODE_RANGE)
+ else if (type->code () == TYPE_CODE_RANGE)
{
TYPE_LENGTH (type) = TYPE_LENGTH (target_type);
TYPE_TARGET_STUB (type) = 0;
}
- else if (TYPE_CODE (type) == TYPE_CODE_ARRAY
+ else if (type->code () == TYPE_CODE_ARRAY
&& update_static_array_size (type))
TYPE_TARGET_STUB (type) = 0;
}
const struct floatformat *
floatformat_from_type (const struct type *type)
{
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
+ gdb_assert (type->code () == TYPE_CODE_FLT);
gdb_assert (TYPE_FLOATFORMAT (type));
return TYPE_FLOATFORMAT (type);
}
{
struct type *t;
- gdb_assert (TYPE_CODE (target_type) == TYPE_CODE_INT
- || TYPE_CODE (target_type) == TYPE_CODE_FLT);
+ gdb_assert (target_type->code () == TYPE_CODE_INT
+ || target_type->code () == TYPE_CODE_FLT);
if (TYPE_MAIN_TYPE (target_type)->flds_bnds.complex_type == nullptr)
{
if (align != 0)
return align;
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_PTR:
case TYPE_CODE_FUNC:
t = check_typedef (t);
return
(t != NULL
- && TYPE_CODE (t) == TYPE_CODE_PTR
- && TYPE_CODE (TYPE_TARGET_TYPE (t)) != TYPE_CODE_VOID);
+ && t->code () == TYPE_CODE_PTR
+ && TYPE_TARGET_TYPE (t)->code () != TYPE_CODE_VOID);
}
int
t = check_typedef (t);
return
((t != NULL)
- && ((TYPE_CODE (t) == TYPE_CODE_INT)
- || (TYPE_CODE (t) == TYPE_CODE_ENUM)
- || (TYPE_CODE (t) == TYPE_CODE_FLAGS)
- || (TYPE_CODE (t) == TYPE_CODE_CHAR)
- || (TYPE_CODE (t) == TYPE_CODE_RANGE)
- || (TYPE_CODE (t) == TYPE_CODE_BOOL)));
+ && ((t->code () == TYPE_CODE_INT)
+ || (t->code () == TYPE_CODE_ENUM)
+ || (t->code () == TYPE_CODE_FLAGS)
+ || (t->code () == TYPE_CODE_CHAR)
+ || (t->code () == TYPE_CODE_RANGE)
+ || (t->code () == TYPE_CODE_BOOL)));
}
int
t = check_typedef (t);
return
((t != NULL)
- && ((TYPE_CODE (t) == TYPE_CODE_FLT)
- || (TYPE_CODE (t) == TYPE_CODE_DECFLOAT)));
+ && ((t->code () == TYPE_CODE_FLT)
+ || (t->code () == TYPE_CODE_DECFLOAT)));
}
/* Return true if TYPE is scalar. */
{
type = check_typedef (type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_ARRAY:
case TYPE_CODE_STRUCT:
if (is_scalar_type (t))
return 1;
/* Are we dealing with an array or string of known dimensions? */
- else if ((TYPE_CODE (t) == TYPE_CODE_ARRAY
- || TYPE_CODE (t) == TYPE_CODE_STRING) && TYPE_NFIELDS (t) == 1
- && TYPE_CODE (TYPE_INDEX_TYPE (t)) == TYPE_CODE_RANGE)
+ else if ((t->code () == TYPE_CODE_ARRAY
+ || t->code () == TYPE_CODE_STRING) && TYPE_NFIELDS (t) == 1
+ && TYPE_INDEX_TYPE(t)->code () == TYPE_CODE_RANGE)
{
LONGEST low_bound, high_bound;
struct type *elt_type = check_typedef (TYPE_TARGET_TYPE (t));
return high_bound == low_bound && is_scalar_type_recursive (elt_type);
}
/* Are we dealing with a struct with one element? */
- else if (TYPE_CODE (t) == TYPE_CODE_STRUCT && TYPE_NFIELDS (t) == 1)
+ else if (t->code () == TYPE_CODE_STRUCT && TYPE_NFIELDS (t) == 1)
return is_scalar_type_recursive (TYPE_FIELD_TYPE (t, 0));
- else if (TYPE_CODE (t) == TYPE_CODE_UNION)
+ else if (t->code () == TYPE_CODE_UNION)
{
int i, n = TYPE_NFIELDS (t);
int
class_or_union_p (const struct type *t)
{
- return (TYPE_CODE (t) == TYPE_CODE_STRUCT
- || TYPE_CODE (t) == TYPE_CODE_UNION);
+ return (t->code () == TYPE_CODE_STRUCT
+ || t->code () == TYPE_CODE_UNION);
}
/* A helper function which returns true if types A and B represent the
return true;
/* Resolve typedefs */
- if (TYPE_CODE (a) == TYPE_CODE_TYPEDEF)
+ if (a->code () == TYPE_CODE_TYPEDEF)
a = check_typedef (a);
- if (TYPE_CODE (b) == TYPE_CODE_TYPEDEF)
+ if (b->code () == TYPE_CODE_TYPEDEF)
b = check_typedef (b);
/* If after resolving typedefs a and b are not of the same type
code then they are not equal. */
- if (TYPE_CODE (a) != TYPE_CODE (b))
+ if (a->code () != b->code ())
return false;
/* If a and b are both pointers types or both reference types then
they are equal of the same type iff the objects they refer to are
of the same type. */
- if (TYPE_CODE (a) == TYPE_CODE_PTR
- || TYPE_CODE (a) == TYPE_CODE_REF)
+ if (a->code () == TYPE_CODE_PTR
+ || a->code () == TYPE_CODE_REF)
return types_equal (TYPE_TARGET_TYPE (a),
TYPE_TARGET_TYPE (b));
/* Two function types are equal if their argument and return types
are equal. */
- if (TYPE_CODE (a) == TYPE_CODE_FUNC)
+ if (a->code () == TYPE_CODE_FUNC)
{
int i;
if (type1 == type2)
return true;
- if (TYPE_CODE (type1) != TYPE_CODE (type2)
+ if (type1->code () != type2->code ()
|| TYPE_LENGTH (type1) != TYPE_LENGTH (type2)
|| TYPE_UNSIGNED (type1) != TYPE_UNSIGNED (type2)
|| TYPE_NOSIGN (type1) != TYPE_NOSIGN (type2)
if (!compare_maybe_null_strings (TYPE_NAME (type1), TYPE_NAME (type2)))
return false;
- if (TYPE_CODE (type1) == TYPE_CODE_RANGE)
+ if (type1->code () == TYPE_CODE_RANGE)
{
if (*TYPE_RANGE_DATA (type1) != *TYPE_RANGE_DATA (type2))
return false;
{
struct rank rank = {0,0};
- switch (TYPE_CODE (arg))
+ switch (arg->code ())
{
case TYPE_CODE_PTR:
/* Allowed pointer conversions are:
(a) pointer to void-pointer conversion. */
- if (TYPE_CODE (TYPE_TARGET_TYPE (parm)) == TYPE_CODE_VOID)
+ if (TYPE_TARGET_TYPE (parm)->code () == TYPE_CODE_VOID)
return VOID_PTR_CONVERSION_BADNESS;
/* (b) pointer to ancestor-pointer conversion. */
case TYPE_CODE_FUNC:
return rank_one_type (TYPE_TARGET_TYPE (parm), arg, NULL);
case TYPE_CODE_INT:
- if (value != NULL && TYPE_CODE (value_type (value)) == TYPE_CODE_INT)
+ if (value != NULL && value_type (value)->code () == TYPE_CODE_INT)
{
if (value_as_long (value) == 0)
{
static struct rank
rank_one_type_parm_array (struct type *parm, struct type *arg, struct value *value)
{
- switch (TYPE_CODE (arg))
+ switch (arg->code ())
{
case TYPE_CODE_PTR:
case TYPE_CODE_ARRAY:
static struct rank
rank_one_type_parm_func (struct type *parm, struct type *arg, struct value *value)
{
- switch (TYPE_CODE (arg))
+ switch (arg->code ())
{
case TYPE_CODE_PTR: /* funcptr -> func */
return rank_one_type (parm, TYPE_TARGET_TYPE (arg), NULL);
static struct rank
rank_one_type_parm_int (struct type *parm, struct type *arg, struct value *value)
{
- switch (TYPE_CODE (arg))
+ switch (arg->code ())
{
case TYPE_CODE_INT:
if (TYPE_LENGTH (arg) == TYPE_LENGTH (parm))
static struct rank
rank_one_type_parm_enum (struct type *parm, struct type *arg, struct value *value)
{
- switch (TYPE_CODE (arg))
+ switch (arg->code ())
{
case TYPE_CODE_INT:
case TYPE_CODE_CHAR:
static struct rank
rank_one_type_parm_char (struct type *parm, struct type *arg, struct value *value)
{
- switch (TYPE_CODE (arg))
+ switch (arg->code ())
{
case TYPE_CODE_RANGE:
case TYPE_CODE_BOOL:
static struct rank
rank_one_type_parm_range (struct type *parm, struct type *arg, struct value *value)
{
- switch (TYPE_CODE (arg))
+ switch (arg->code ())
{
case TYPE_CODE_INT:
case TYPE_CODE_CHAR:
static struct rank
rank_one_type_parm_bool (struct type *parm, struct type *arg, struct value *value)
{
- switch (TYPE_CODE (arg))
+ switch (arg->code ())
{
/* n3290 draft, section 4.12.1 (conv.bool):
static struct rank
rank_one_type_parm_float (struct type *parm, struct type *arg, struct value *value)
{
- switch (TYPE_CODE (arg))
+ switch (arg->code ())
{
case TYPE_CODE_FLT:
if (TYPE_LENGTH (arg) < TYPE_LENGTH (parm))
static struct rank
rank_one_type_parm_complex (struct type *parm, struct type *arg, struct value *value)
{
- switch (TYPE_CODE (arg))
+ switch (arg->code ())
{ /* Strictly not needed for C++, but... */
case TYPE_CODE_FLT:
return FLOAT_PROMOTION_BADNESS;
{
struct rank rank = {0, 0};
- switch (TYPE_CODE (arg))
+ switch (arg->code ())
{
case TYPE_CODE_STRUCT:
/* Check for derivation */
static struct rank
rank_one_type_parm_set (struct type *parm, struct type *arg, struct value *value)
{
- switch (TYPE_CODE (arg))
+ switch (arg->code ())
{
/* Not in C++ */
case TYPE_CODE_SET:
struct rank rank = {0,0};
/* Resolve typedefs */
- if (TYPE_CODE (parm) == TYPE_CODE_TYPEDEF)
+ if (parm->code () == TYPE_CODE_TYPEDEF)
parm = check_typedef (parm);
- if (TYPE_CODE (arg) == TYPE_CODE_TYPEDEF)
+ if (arg->code () == TYPE_CODE_TYPEDEF)
arg = check_typedef (arg);
if (TYPE_IS_REFERENCE (parm) && value != NULL)
{
/* Rvalues should preferably bind to rvalue references or const
lvalue references. */
- if (TYPE_CODE (parm) == TYPE_CODE_RVALUE_REF)
+ if (parm->code () == TYPE_CODE_RVALUE_REF)
rank.subrank = REFERENCE_CONVERSION_RVALUE;
else if (TYPE_CONST (TYPE_TARGET_TYPE (parm)))
rank.subrank = REFERENCE_CONVERSION_CONST_LVALUE;
else
{
/* It's illegal to pass an lvalue as an rvalue. */
- if (TYPE_CODE (parm) == TYPE_CODE_RVALUE_REF)
+ if (parm->code () == TYPE_CODE_RVALUE_REF)
return INCOMPATIBLE_TYPE_BADNESS;
}
}
struct type *t2 = arg;
/* For pointers and references, compare target type. */
- if (TYPE_CODE (parm) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (parm))
+ if (parm->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (parm))
{
t1 = TYPE_TARGET_TYPE (parm);
t2 = TYPE_TARGET_TYPE (arg);
REFERENCE_SEE_THROUGH_BADNESS));
if (overload_debug)
/* Debugging only. */
- fprintf_filtered (gdb_stderr,
+ fprintf_filtered (gdb_stderr,
"------ Arg is %s [%d], parm is %s [%d]\n",
- TYPE_NAME (arg), TYPE_CODE (arg),
- TYPE_NAME (parm), TYPE_CODE (parm));
+ TYPE_NAME (arg), arg->code (),
+ TYPE_NAME (parm), parm->code ());
/* x -> y means arg of type x being supplied for parameter of type y. */
- switch (TYPE_CODE (parm))
+ switch (parm->code ())
{
case TYPE_CODE_PTR:
return rank_one_type_parm_ptr (parm, arg, value);
return rank_one_type_parm_set (parm, arg, value);
default:
return INCOMPATIBLE_TYPE_BADNESS;
- } /* switch (TYPE_CODE (arg)) */
+ } /* switch (arg->code ()) */
}
/* End of functions for overload resolution. */
TYPE_NAME (type) ? TYPE_NAME (type) : "<NULL>");
gdb_print_host_address (TYPE_NAME (type), gdb_stdout);
printf_filtered (")\n");
- printfi_filtered (spaces, "code 0x%x ", TYPE_CODE (type));
- switch (TYPE_CODE (type))
+ printfi_filtered (spaces, "code 0x%x ", type->code ());
+ switch (type->code ())
{
case TYPE_CODE_UNDEF:
printf_filtered ("(TYPE_CODE_UNDEF)");
puts_filtered ("\n");
for (idx = 0; idx < TYPE_NFIELDS (type); idx++)
{
- if (TYPE_CODE (type) == TYPE_CODE_ENUM)
+ if (type->code () == TYPE_CODE_ENUM)
printfi_filtered (spaces + 2,
"[%d] enumval %s type ",
idx, plongest (TYPE_FIELD_ENUMVAL (type, idx)));
recursive_dump_type (TYPE_FIELD_TYPE (type, idx), spaces + 4);
}
}
- if (TYPE_CODE (type) == TYPE_CODE_RANGE)
+ if (type->code () == TYPE_CODE_RANGE)
{
printfi_filtered (spaces, "low %s%s high %s%s\n",
plongest (TYPE_LOW_BOUND (type)),
}
/* For range types, copy the bounds information. */
- if (TYPE_CODE (type) == TYPE_CODE_RANGE)
+ if (type->code () == TYPE_CODE_RANGE)
{
TYPE_RANGE_DATA (new_type) = (struct range_bounds *)
TYPE_ALLOC (new_type, sizeof (struct range_bounds));
int type_bitsize = TYPE_LENGTH (type) * TARGET_CHAR_BIT;
int field_nr = TYPE_NFIELDS (type);
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLAGS);
+ gdb_assert (type->code () == TYPE_CODE_FLAGS);
gdb_assert (TYPE_NFIELDS (type) + 1 <= type_bitsize);
gdb_assert (start_bitpos >= 0 && start_bitpos < type_bitsize);
gdb_assert (nr_bits >= 1 && nr_bits <= type_bitsize);
{
struct field *f = append_composite_type_field_raw (t, name, field);
- if (TYPE_CODE (t) == TYPE_CODE_UNION)
+ if (t->code () == TYPE_CODE_UNION)
{
if (TYPE_LENGTH (t) < TYPE_LENGTH (field))
TYPE_LENGTH (t) = TYPE_LENGTH (field);
}
- else if (TYPE_CODE (t) == TYPE_CODE_STRUCT)
+ else if (t->code () == TYPE_CODE_STRUCT)
{
TYPE_LENGTH (t) = TYPE_LENGTH (t) + TYPE_LENGTH (field);
if (TYPE_NFIELDS (t) > 1)
/* * True if this type represents either an lvalue or lvalue reference type. */
#define TYPE_IS_REFERENCE(t) \
- (TYPE_CODE (t) == TYPE_CODE_REF || TYPE_CODE (t) == TYPE_CODE_RVALUE_REF)
+ ((t)->code () == TYPE_CODE_REF || (t)->code () == TYPE_CODE_RVALUE_REF)
/* * True if this type is allocatable. */
#define TYPE_IS_ALLOCATABLE(t) \
space in struct type. */
extern bool set_type_align (struct type *, ULONGEST);
-#define TYPE_CODE(thistype) ((thistype)->code ())
#define TYPE_NFIELDS(thistype) TYPE_MAIN_TYPE(thistype)->nfields
#define TYPE_FIELDS(thistype) TYPE_MAIN_TYPE(thistype)->flds_bnds.fields
TYPE_NESTED_TYPES_FIELD (thistype, n).is_private
#define TYPE_IS_OPAQUE(thistype) \
- (((TYPE_CODE (thistype) == TYPE_CODE_STRUCT) \
- || (TYPE_CODE (thistype) == TYPE_CODE_UNION)) \
+ ((((thistype)->code () == TYPE_CODE_STRUCT) \
+ || ((thistype)->code () == TYPE_CODE_UNION)) \
&& (TYPE_NFIELDS (thistype) == 0) \
&& (!HAVE_CPLUS_STRUCT (thistype) \
|| TYPE_NFN_FIELDS (thistype) == 0) \
/* With older versions of g++, the vtbl field pointed to an array
of structures. Nowadays it points directly to the structure. */
- if (TYPE_CODE (value_type (vtbl)) == TYPE_CODE_PTR
- && TYPE_CODE (TYPE_TARGET_TYPE (value_type (vtbl))) == TYPE_CODE_ARRAY)
+ if (value_type (vtbl)->code () == TYPE_CODE_PTR
+ && TYPE_TARGET_TYPE (value_type (vtbl))->code () == TYPE_CODE_ARRAY)
{
/* Handle the case where the vtbl field points to an
array of structures. */
entry_type = check_typedef (value_type (entry));
- if (TYPE_CODE (entry_type) == TYPE_CODE_STRUCT)
+ if (entry_type->code () == TYPE_CODE_STRUCT)
{
/* Move the `this' pointer according to the virtual function table. */
set_value_offset (arg1, value_offset (arg1)
vfn = value_field (entry, 2);
}
- else if (TYPE_CODE (entry_type) == TYPE_CODE_PTR)
+ else if (entry_type->code () == TYPE_CODE_PTR)
vfn = entry;
else
error (_("I'm confused: virtual function table has bad type"));
known_type = value_type (v);
known_type = check_typedef (known_type);
/* RTTI works only or class objects. */
- if (TYPE_CODE (known_type) != TYPE_CODE_STRUCT)
+ if (known_type->code () != TYPE_CODE_STRUCT)
return NULL;
/* Plan on this changing in the future as i get around to setting
it is for this baseclass. */
fieldtype = TYPE_FIELD_TYPE (type, index);
if (fieldtype == NULL
- || TYPE_CODE (fieldtype) != TYPE_CODE_PTR)
+ || fieldtype->code () != TYPE_CODE_PTR)
/* "Can't happen". */
return 0;
int fieldnum, fieldelem;
type = check_typedef (type);
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION);
+ gdb_assert (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION);
- if (TYPE_CODE (type) == TYPE_CODE_UNION)
+ if (type->code () == TYPE_CODE_UNION)
return 0;
if (TYPE_CPLUS_DYNAMIC (type))
CORE_ADDR vtable_address;
container_type = check_typedef (container_type);
- gdb_assert (TYPE_CODE (container_type) == TYPE_CODE_STRUCT);
+ gdb_assert (container_type->code () == TYPE_CODE_STRUCT);
/* If this type does not have a virtual table, don't read the first
field. */
const char *atsign;
/* We only have RTTI for dynamic class objects. */
- if (TYPE_CODE (values_type) != TYPE_CODE_STRUCT
+ if (values_type->code () != TYPE_CODE_STRUCT
|| !gnuv3_dynamic_class (values_type))
return NULL;
struct gdbarch *gdbarch;
/* Some simple sanity checks. */
- if (TYPE_CODE (values_type) != TYPE_CODE_STRUCT)
+ if (values_type->code () != TYPE_CODE_STRUCT)
error (_("Only classes can have virtual functions."));
/* Determine architecture. */
void **slot;
struct value_and_voffset search_vo, *current_vo;
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_STRUCT);
+ gdb_assert (type->code () == TYPE_CODE_STRUCT);
/* If the object is not dynamic, then we are done; as it cannot have
dynamic base types either. */
value = coerce_ref (value);
type = check_typedef (value_type (value));
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ if (type->code () == TYPE_CODE_PTR)
{
value = value_ind (value);
type = check_typedef (value_type (value));
gdbarch = get_type_arch (type);
vtable = NULL;
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
vtable = gnuv3_get_vtable (gdbarch, type,
value_as_address (value_addr (value)));
/* In the non_lvalue case, a reference might have slipped through
here. */
- if (TYPE_CODE (type) == TYPE_CODE_REF)
+ if (type->code () == TYPE_CODE_REF)
type = check_typedef (TYPE_TARGET_TYPE (type));
/* Ignore top-level cv-qualifiers. */
/* We check for lval_memory because in the "typeid (type-id)" case,
the type is passed via a not_lval value object. */
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ if (type->code () == TYPE_CODE_STRUCT
&& value_lval_const (value) == lval_memory
&& gnuv3_dynamic_class (type))
{
type, with the expected type code... */
struct type *arg_type = TYPE_FIELD_TYPE (method_type, 1);
- if (TYPE_CODE (arg_type) != expected)
+ if (arg_type->code () != expected)
return false;
struct type *target = check_typedef (TYPE_TARGET_TYPE (arg_type));
definition_style mctor_def = DOES_NOT_EXIST_IN_SOURCE;
/* We're only interested in things that can have methods. */
- if (TYPE_CODE (type) != TYPE_CODE_STRUCT
- && TYPE_CODE (type) != TYPE_CODE_UNION)
+ if (type->code () != TYPE_CODE_STRUCT
+ && type->code () != TYPE_CODE_UNION)
return info;
/* The compiler may have emitted the calling convention attribute.
struct type *field_type = TYPE_FIELD_TYPE (type, fieldnum);
/* For arrays, make the decision based on the element type. */
- if (TYPE_CODE (field_type) == TYPE_CODE_ARRAY)
+ if (field_type->code () == TYPE_CODE_ARRAY)
field_type = check_typedef (TYPE_TARGET_TYPE (field_type));
struct language_pass_by_ref_info field_info
if (sym
&& SYMBOL_CLASS (sym) == LOC_TYPEDEF
- && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_MODULE)
+ && SYMBOL_TYPE (sym)->code () == TYPE_CODE_MODULE)
return 1;
return 0;
type0 = check_typedef (type0);
type1 = check_typedef (type1);
- if (TYPE_CODE (type0) == TYPE_CODE_PTR
+ if (type0->code () == TYPE_CODE_PTR
&& strcmp (TYPE_FIELD_NAME (type, 0), "__data") == 0
- && TYPE_CODE (type1) == TYPE_CODE_INT
+ && type1->code () == TYPE_CODE_INT
&& strcmp (TYPE_FIELD_NAME (type, 1), "__length") == 0)
{
struct type *target_type = TYPE_TARGET_TYPE (type0);
target_type = check_typedef (target_type);
- if (TYPE_CODE (target_type) == TYPE_CODE_INT
+ if (target_type->code () == TYPE_CODE_INT
&& TYPE_LENGTH (target_type) == 1
&& strcmp (TYPE_NAME (target_type), "uint8") == 0)
return 1;
go_is_string_type_p (struct type *type)
{
type = check_typedef (type);
- return (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ return (type->code () == TYPE_CODE_STRUCT
&& go_classify_struct_type (type) == GO_TYPE_STRING);
}
type = check_typedef (type);
/* Print the type of "abc" as "string", not char[4]. */
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY
- && TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CHAR)
+ if (type->code () == TYPE_CODE_ARRAY
+ && TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_CHAR)
{
fputs_filtered ("string", stream);
return;
{
struct type *type = check_typedef (value_type (val));
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_STRUCT:
{
realtype = check_typedef (type);
- switch (TYPE_CODE (realtype))
+ switch (realtype->code ())
{
case TYPE_CODE_PTR:
case TYPE_CODE_ARRAY:
struct type *type = tyscm_scm_to_type (ls_smob->type);
struct type *realtype = check_typedef (type);
- switch (TYPE_CODE (realtype))
+ switch (realtype->code ())
{
case TYPE_CODE_PTR:
/* If a length is specified we need to convert this to an array
/* If TYPE is a reference, return the target; otherwise return TYPE. */
#define STRIP_REFERENCE(TYPE) \
- ((TYPE_CODE (TYPE) == TYPE_CODE_REF) ? (TYPE_TARGET_TYPE (TYPE)) : (TYPE))
+ ((TYPE->code () == TYPE_CODE_REF) ? (TYPE_TARGET_TYPE (TYPE)) : (TYPE))
/* Helper for vlscm_unop. Contains all the code that may throw a GDB
exception. */
rtype = check_typedef (rtype);
rtype = STRIP_REFERENCE (rtype);
- if (TYPE_CODE (ltype) == TYPE_CODE_PTR
+ if (ltype->code () == TYPE_CODE_PTR
&& is_integral_type (rtype))
res_val = value_ptradd (arg1, value_as_long (arg2));
- else if (TYPE_CODE (rtype) == TYPE_CODE_PTR
+ else if (rtype->code () == TYPE_CODE_PTR
&& is_integral_type (ltype))
res_val = value_ptradd (arg2, value_as_long (arg1));
else
rtype = check_typedef (rtype);
rtype = STRIP_REFERENCE (rtype);
- if (TYPE_CODE (ltype) == TYPE_CODE_PTR
- && TYPE_CODE (rtype) == TYPE_CODE_PTR)
+ if (ltype->code () == TYPE_CODE_PTR
+ && rtype->code () == TYPE_CODE_PTR)
{
/* A ptrdiff_t for the target would be preferable here. */
res_val
= value_from_longest (builtin_type (gdbarch)->builtin_long,
value_ptrdiff (arg1, arg2));
}
- else if (TYPE_CODE (ltype) == TYPE_CODE_PTR
+ else if (ltype->code () == TYPE_CODE_PTR
&& is_integral_type (rtype))
res_val = value_ptradd (arg1, - value_as_long (arg2));
else
struct gdbarch *gdbarch, SCM *except_scmp)
{
if (is_integral_type (type)
- || TYPE_CODE (type) == TYPE_CODE_PTR)
+ || type->code () == TYPE_CODE_PTR)
{
if (TYPE_UNSIGNED (type))
{
return value_from_longest (type, gdbscm_scm_to_longest (obj));
}
}
- else if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ else if (type->code () == TYPE_CODE_FLT)
return value_from_host_double (type, scm_to_double (obj));
else
{
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
- return scm_from_int (TYPE_CODE (type));
+ return scm_from_int (type->code ());
}
/* (type-fields <gdb:type>) -> list
struct type *type = t_smob->type;
const char *tagname = nullptr;
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION
- || TYPE_CODE (type) == TYPE_CODE_ENUM)
+ if (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION
+ || type->code () == TYPE_CODE_ENUM)
tagname = TYPE_NAME (type);
if (tagname == nullptr)
}
GDBSCM_HANDLE_GDB_EXCEPTION (exc);
- if (TYPE_CODE (type) != TYPE_CODE_PTR
- && TYPE_CODE (type) != TYPE_CODE_REF)
+ if (type->code () != TYPE_CODE_PTR
+ && type->code () != TYPE_CODE_REF)
break;
type = TYPE_TARGET_TYPE (type);
}
/* If this is not a struct, union, or enum type, raise TypeError
exception. */
- if (TYPE_CODE (type) != TYPE_CODE_STRUCT
- && TYPE_CODE (type) != TYPE_CODE_UNION
- && TYPE_CODE (type) != TYPE_CODE_ENUM)
+ if (type->code () != TYPE_CODE_STRUCT
+ && type->code () != TYPE_CODE_UNION
+ && type->code () != TYPE_CODE_ENUM)
return NULL;
return type;
/* Initialize these to appease GCC warnings. */
LONGEST low = 0, high = 0;
- SCM_ASSERT_TYPE (TYPE_CODE (type) == TYPE_CODE_ARRAY
- || TYPE_CODE (type) == TYPE_CODE_STRING
- || TYPE_CODE (type) == TYPE_CODE_RANGE,
+ SCM_ASSERT_TYPE (type->code () == TYPE_CODE_ARRAY
+ || type->code () == TYPE_CODE_STRING
+ || type->code () == TYPE_CODE_RANGE,
self, SCM_ARG1, FUNC_NAME, _("ranged type"));
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_ARRAY:
case TYPE_CODE_STRING:
struct field *field = tyscm_field_smob_to_field (f_smob);
struct type *type = tyscm_field_smob_containing_type (f_smob);
- SCM_ASSERT_TYPE (TYPE_CODE (type) == TYPE_CODE_ENUM,
+ SCM_ASSERT_TYPE (type->code () == TYPE_CODE_ENUM,
self, SCM_ARG1, FUNC_NAME, _("enum type"));
return scm_from_long (FIELD_ENUMVAL (*field));
struct field *field = tyscm_field_smob_to_field (f_smob);
struct type *type = tyscm_field_smob_containing_type (f_smob);
- SCM_ASSERT_TYPE (TYPE_CODE (type) != TYPE_CODE_ENUM,
+ SCM_ASSERT_TYPE (type->code () != TYPE_CODE_ENUM,
self, SCM_ARG1, FUNC_NAME, _("non-enum type"));
return scm_from_long (FIELD_BITPOS (*field));
= tyscm_get_field_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = tyscm_field_smob_containing_type (f_smob);
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
return scm_from_bool (f_smob->field_num < TYPE_N_BASECLASSES (type));
return SCM_BOOL_F;
}
struct value *res_val;
- switch (TYPE_CODE (check_typedef (value_type (value))))
+ switch (check_typedef (value_type (value))->code ())
{
case TYPE_CODE_PTR:
res_val = value_ind (value);
type = value_type (value);
type = check_typedef (type);
- if (((TYPE_CODE (type) == TYPE_CODE_PTR)
- || (TYPE_CODE (type) == TYPE_CODE_REF))
- && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT))
+ if (((type->code () == TYPE_CODE_PTR)
+ || (type->code () == TYPE_CODE_REF))
+ && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRUCT))
{
struct value *target;
- int was_pointer = TYPE_CODE (type) == TYPE_CODE_PTR;
+ int was_pointer = type->code () == TYPE_CODE_PTR;
if (was_pointer)
target = value_ind (value);
type = lookup_lvalue_reference_type (type);
}
}
- else if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ else if (type->code () == TYPE_CODE_STRUCT)
type = value_rtti_type (value, NULL, NULL, NULL);
else
{
a subscript. */
struct value *tmp = coerce_ref (value);
struct type *tmp_type = check_typedef (value_type (tmp));
- if (TYPE_CODE (tmp_type) != TYPE_CODE_ARRAY
- && TYPE_CODE (tmp_type) != TYPE_CODE_PTR)
+ if (tmp_type->code () != TYPE_CODE_ARRAY
+ && tmp_type->code () != TYPE_CODE_PTR)
error (_("Cannot subscript requested type"));
struct value *res_val = value_subscript (tmp, value_as_long (index));
}
GDBSCM_HANDLE_GDB_EXCEPTION (exc);
- SCM_ASSERT_TYPE (TYPE_CODE (ftype) == TYPE_CODE_FUNC, self,
+ SCM_ASSERT_TYPE (ftype->code () == TYPE_CODE_FUNC, self,
SCM_ARG1, FUNC_NAME,
_("function (value of TYPE_CODE_FUNC)"));
static int
is_intlike (struct type *type, int ptr_ok)
{
- return (TYPE_CODE (type) == TYPE_CODE_INT
- || TYPE_CODE (type) == TYPE_CODE_ENUM
- || TYPE_CODE (type) == TYPE_CODE_BOOL
- || TYPE_CODE (type) == TYPE_CODE_CHAR
- || (ptr_ok && TYPE_CODE (type) == TYPE_CODE_PTR));
+ return (type->code () == TYPE_CODE_INT
+ || type->code () == TYPE_CODE_ENUM
+ || type->code () == TYPE_CODE_BOOL
+ || type->code () == TYPE_CODE_CHAR
+ || (ptr_ok && type->code () == TYPE_CODE_PTR));
}
/* (value->bool <gdb:value>) -> boolean
try
{
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ if (type->code () == TYPE_CODE_PTR)
l = value_as_address (value);
else
l = value_as_long (value);
try
{
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ if (type->code () == TYPE_CODE_PTR)
l = value_as_address (value);
else
l = value_as_long (value);
}
GDBSCM_HANDLE_GDB_EXCEPTION (exc);
- SCM_ASSERT_TYPE (is_intlike (type, 0) || TYPE_CODE (type) == TYPE_CODE_FLT,
+ SCM_ASSERT_TYPE (is_intlike (type, 0) || type->code () == TYPE_CODE_FLT,
self, SCM_ARG1, FUNC_NAME, _("number"));
try
type = value_type (value);
realtype = check_typedef (type);
- switch (TYPE_CODE (realtype))
+ switch (realtype->code ())
{
case TYPE_CODE_ARRAY:
{
store_unsigned_integer (valbuf + 2, 2, byte_order, c);
break;
case 8: /* long long is now 8 bytes. */
- if (TYPE_CODE (type) == TYPE_CODE_INT)
+ if (type->code () == TYPE_CODE_INT)
{
regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &addr);
c = read_memory_unsigned_integer ((CORE_ADDR) addr, len, byte_order);
store_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order, c);
break;
case 8: /* long long is now 8 bytes. */
- if (TYPE_CODE (type) == TYPE_CODE_INT)
+ if (type->code () == TYPE_CODE_INT)
{
regcache_cooked_read_unsigned (regcache, E_RET0_REGNUM, &c);
store_unsigned_integer (valbuf, 4, byte_order, c);
/* Types of 1, 2 or 4 bytes are returned in R0/R1, everything else on the
stack. */
- if (TYPE_CODE (value_type) == TYPE_CODE_STRUCT
- || TYPE_CODE (value_type) == TYPE_CODE_UNION)
+ if (value_type->code () == TYPE_CODE_STRUCT
+ || value_type->code () == TYPE_CODE_UNION)
return 1;
return !(TYPE_LENGTH (value_type) == 1
|| TYPE_LENGTH (value_type) == 2
{
/* Types of 1, 2 or 4 bytes are returned in R0, INT types of 8 bytes are
returned in R0/R1, everything else on the stack. */
- if (TYPE_CODE (value_type) == TYPE_CODE_STRUCT
- || TYPE_CODE (value_type) == TYPE_CODE_UNION)
+ if (value_type->code () == TYPE_CODE_STRUCT
+ || value_type->code () == TYPE_CODE_UNION)
return 1;
return !(TYPE_LENGTH (value_type) == 1
|| TYPE_LENGTH (value_type) == 2
|| TYPE_LENGTH (value_type) == 4
|| (TYPE_LENGTH (value_type) == 8
- && TYPE_CODE (value_type) == TYPE_CODE_INT));
+ && value_type->code () == TYPE_CODE_INT));
}
/* Function: store_return_value
store_unsigned_integer (param_val, 4, byte_order,
struct_end - struct_ptr);
}
- else if (TYPE_CODE (type) == TYPE_CODE_INT
- || TYPE_CODE (type) == TYPE_CODE_ENUM)
+ else if (type->code () == TYPE_CODE_INT
+ || type->code () == TYPE_CODE_ENUM)
{
/* Integer value store, right aligned. "unpack_long"
takes care of any sign-extension problems. */
unpack_long (type,
value_contents (arg)));
}
- else if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ else if (type->code () == TYPE_CODE_FLT)
{
/* Floating point value store, right aligned. */
param_len = align_up (TYPE_LENGTH (type), 4);
static int
hppa64_integral_or_pointer_p (const struct type *type)
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_INT:
case TYPE_CODE_BOOL:
static int
hppa64_floating_p (const struct type *type)
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_FLT:
{
/* If we are passing a function pointer, make sure we pass a function
descriptor instead of the function entry address. */
- if (TYPE_CODE (type) == TYPE_CODE_PTR
- && TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC)
+ if (type->code () == TYPE_CODE_PTR
+ && TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC)
{
ULONGEST codeptr, fptr;
/* The value always lives in the right hand end of the register
(or register pair)? */
int b;
- int reg = TYPE_CODE (type) == TYPE_CODE_FLT ? HPPA_FP4_REGNUM : 28;
+ int reg = type->code () == TYPE_CODE_FLT ? HPPA_FP4_REGNUM : 28;
int part = TYPE_LENGTH (type) % 4;
/* The left hand register contains only part of the value,
transfer that first so that the rest can be xfered as entire
static int
i386_m128_p (struct type *type)
{
- return (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type)
+ return (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)
&& TYPE_LENGTH (type) == 16);
}
aligned to 8-byte boundaries.
7. [...] The caller aligns 128-bit vectors in the parameter area to
16-byte boundaries. */
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type))
+ if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type))
return TYPE_LENGTH (type);
/* 4. The caller places all the fields of structures (or unions) with no
vector elements in the parameter area. These structures are 4-byte
aligned.
5. The caller places structures with vector elements on the stack,
16-byte aligned. */
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION)
+ if (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION)
{
int i;
int res = 4;
i386_16_byte_align_p (struct type *type)
{
type = check_typedef (type);
- if ((TYPE_CODE (type) == TYPE_CODE_DECFLOAT
- || (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type)))
+ if ((type->code () == TYPE_CODE_DECFLOAT
+ || (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)))
&& TYPE_LENGTH (type) == 16)
return 1;
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ if (type->code () == TYPE_CODE_ARRAY)
return i386_16_byte_align_p (TYPE_TARGET_TYPE (type));
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION)
+ if (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION)
{
int i;
for (i = 0; i < TYPE_NFIELDS (type); i++)
int len = TYPE_LENGTH (type);
gdb_byte buf[I386_MAX_REGISTER_SIZE];
- if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ if (type->code () == TYPE_CODE_FLT)
{
if (tdep->st0_regnum < 0)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
int len = TYPE_LENGTH (type);
- if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ if (type->code () == TYPE_CODE_FLT)
{
ULONGEST fstat;
gdb_byte buf[I386_MAX_REGISTER_SIZE];
i386_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- enum type_code code = TYPE_CODE (type);
+ enum type_code code = type->code ();
int len = TYPE_LENGTH (type);
gdb_assert (code == TYPE_CODE_STRUCT
if (code == TYPE_CODE_STRUCT && TYPE_NFIELDS (type) == 1)
{
type = check_typedef (TYPE_FIELD_TYPE (type, 0));
- if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ if (type->code () == TYPE_CODE_FLT)
return (len == 4 || len == 8 || len == 12);
}
struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
- enum type_code code = TYPE_CODE (type);
+ enum type_code code = type->code ();
if (((code == TYPE_CODE_STRUCT
|| code == TYPE_CODE_UNION
if (gdbarch_ptr_bit (gdbarch) == 32)
{
- if ((TYPE_CODE (type) == TYPE_CODE_INT
- || TYPE_CODE (type) == TYPE_CODE_FLT)
+ if ((type->code () == TYPE_CODE_INT
+ || type->code () == TYPE_CODE_FLT)
&& TYPE_LENGTH (type) > 4)
return 4;
/* Handle x86's funny long double. */
- if (TYPE_CODE (type) == TYPE_CODE_FLT
+ if (type->code () == TYPE_CODE_FLT
&& gdbarch_long_double_bit (gdbarch) == TYPE_LENGTH (type) * 8)
return 4;
}
bool thiscall = false;
struct type *type = check_typedef (value_type (function));
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ if (type->code () == TYPE_CODE_PTR)
type = check_typedef (TYPE_TARGET_TYPE (type));
/* read_subroutine_type sets for non-static member functions the
artificial flag of the first parameter ('this' pointer). */
- if (TYPE_CODE (type) == TYPE_CODE_METHOD
+ if (type->code () == TYPE_CODE_METHOD
&& TYPE_NFIELDS (type) > 0
&& TYPE_FIELD_ARTIFICIAL (type, 0)
- && TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_PTR)
+ && TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_PTR)
thiscall = 1;
return i386_thiscall_push_dummy_call (gdbarch, function, regcache, bp_addr,
/* Floating point registers must be converted unless we are
accessing them in their hardware type or TYPE is not float. */
if (type == i387_ext_type (gdbarch)
- || TYPE_CODE (type) != TYPE_CODE_FLT)
+ || type->code () != TYPE_CODE_FLT)
return 0;
else
return 1;
gdb_assert (i386_fp_regnum_p (gdbarch, regnum));
/* We only support floating-point values. */
- if (TYPE_CODE (type) != TYPE_CODE_FLT)
+ if (type->code () != TYPE_CODE_FLT)
{
warning (_("Cannot convert floating-point register value "
"to non-floating-point type."));
gdb_assert (i386_fp_regnum_p (gdbarch, regnum));
/* We only support floating-point values. */
- if (TYPE_CODE (type) != TYPE_CODE_FLT)
+ if (type->code () != TYPE_CODE_FLT)
{
warning (_("Cannot convert non-floating-point type "
"to floating-point register value."));
if (group == all_reggroup)
return 1;
vector_p = TYPE_VECTOR (register_type (gdbarch, regnum));
- float_p = TYPE_CODE (register_type (gdbarch, regnum)) == TYPE_CODE_FLT;
+ float_p = register_type (gdbarch, regnum)->code () == TYPE_CODE_FLT;
raw_p = regnum < NUM_IA64_RAW_REGS;
if (group == float_reggroup)
return float_p;
ia64_convert_register_p (struct gdbarch *gdbarch, int regno, struct type *type)
{
return (regno >= IA64_FR0_REGNUM && regno <= IA64_FR127_REGNUM
- && TYPE_CODE (type) == TYPE_CODE_FLT
+ && type->code () == TYPE_CODE_FLT
&& type != ia64_ext_type (gdbarch));
}
/* Don't use the struct convention for anything but structure,
union, or array types. */
- if (!(TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION
- || TYPE_CODE (type) == TYPE_CODE_ARRAY))
+ if (!(type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION
+ || type->code () == TYPE_CODE_ARRAY))
return 0;
/* HFAs are structures (or arrays) consisting entirely of floating
static int
ia64_struct_type_p (const struct type *type)
{
- return (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION);
+ return (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION);
}
static void
static int
is_float_or_hfa_type_recurse (struct type *t, struct type **etp)
{
- switch (TYPE_CODE (t))
+ switch (t->code ())
{
case TYPE_CODE_FLT:
if (*etp)
static int
slot_alignment_is_next_even (struct type *t)
{
- switch (TYPE_CODE (t))
+ switch (t->code ())
{
case TYPE_CODE_INT:
case TYPE_CODE_FLT:
if ((nslots & 1) && slot_alignment_is_next_even (type))
nslots++;
- if (TYPE_CODE (type) == TYPE_CODE_FUNC)
+ if (type->code () == TYPE_CODE_FUNC)
nfuncargs++;
nslots += (len + 7) / 8;
len = TYPE_LENGTH (type);
/* Special handling for function parameters. */
- if (len == 8
- && TYPE_CODE (type) == TYPE_CODE_PTR
- && TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC)
+ if (len == 8
+ && type->code () == TYPE_CODE_PTR
+ && TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC)
{
gdb_byte val_buf[8];
ULONGEST faddr = extract_unsigned_integer (value_contents (arg),
saved by the called function. */
arg = value_coerce_to_target (arg);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_REF:
case TYPE_CODE_RVALUE_REF:
if the value was not previously in memory - in some cases
we should clearly be allowing this, but how? */
new_value = value_cast (TYPE_TARGET_TYPE (type), arg);
- new_value = value_ref (new_value, TYPE_CODE (type));
+ new_value = value_ref (new_value, type->code ());
return new_value;
}
case TYPE_CODE_INT:
part of it. */
/* Determine address to call. */
- if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
- || TYPE_CODE (ftype) == TYPE_CODE_METHOD)
+ if (ftype->code () == TYPE_CODE_FUNC
+ || ftype->code () == TYPE_CODE_METHOD)
funaddr = value_address (function);
- else if (TYPE_CODE (ftype) == TYPE_CODE_PTR)
+ else if (ftype->code () == TYPE_CODE_PTR)
{
funaddr = value_as_address (function);
ftype = check_typedef (TYPE_TARGET_TYPE (ftype));
- if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
- || TYPE_CODE (ftype) == TYPE_CODE_METHOD)
+ if (ftype->code () == TYPE_CODE_FUNC
+ || ftype->code () == TYPE_CODE_METHOD)
funaddr = gdbarch_convert_from_func_ptr_addr (gdbarch, funaddr,
current_top_target ());
}
- if (TYPE_CODE (ftype) == TYPE_CODE_FUNC
- || TYPE_CODE (ftype) == TYPE_CODE_METHOD)
+ if (ftype->code () == TYPE_CODE_FUNC
+ || ftype->code () == TYPE_CODE_METHOD)
{
if (TYPE_GNU_IFUNC (ftype))
{
else
value_type = TYPE_TARGET_TYPE (ftype);
}
- else if (TYPE_CODE (ftype) == TYPE_CODE_INT)
+ else if (ftype->code () == TYPE_CODE_INT)
{
/* Handle the case of functions lacking debugging info.
Their values are characters since their addresses are char. */
thread_info *thr = inferior_thread ();
bool stack_temporaries = thread_stack_temporaries_enabled_p (thr);
- if (TYPE_CODE (ri->value_type) == TYPE_CODE_VOID)
+ if (ri->value_type->code () == TYPE_CODE_VOID)
retval = allocate_value (ri->value_type);
else if (ri->struct_return_p)
{
/* FIXME drow/2002-05-31: Should just always mark methods as
prototyped. Can we respect TYPE_VARARGS? Probably not. */
- if (TYPE_CODE (ftype) == TYPE_CODE_METHOD)
+ if (ftype->code () == TYPE_CODE_METHOD)
prototyped = 1;
if (TYPE_TARGET_TYPE (ftype) == NULL && TYPE_NFIELDS (ftype) == 0
&& default_return_type != NULL)
struct value *value;
value_type = check_typedef (value_type);
- gdb_assert (TYPE_CODE (value_type) != TYPE_CODE_VOID);
+ gdb_assert (value_type->code () != TYPE_CODE_VOID);
/* FIXME: 2003-09-27: When returning from a nested inferior function
call, it's possible (with no help from the architecture vector)
print_return_value (struct ui_out *uiout, struct return_value_info *rv)
{
if (rv->type == NULL
- || TYPE_CODE (check_typedef (rv->type)) == TYPE_CODE_VOID)
+ || check_typedef (rv->type)->code () == TYPE_CODE_VOID)
return;
try
internal_error (__FILE__, __LINE__,
_("finish_command: function has no target type"));
- if (TYPE_CODE (check_typedef (rv->type)) != TYPE_CODE_VOID)
+ if (check_typedef (rv->type)->code () != TYPE_CODE_VOID)
{
struct value *func;
/* If virtual format is floating, print it that way, and in raw
hex. */
- if (TYPE_CODE (regtype) == TYPE_CODE_FLT
- || TYPE_CODE (regtype) == TYPE_CODE_DECFLOAT)
+ if (regtype->code () == TYPE_CODE_FLT
+ || regtype->code () == TYPE_CODE_DECFLOAT)
{
struct value_print_options opts;
const gdb_byte *valaddr = value_contents_for_printing (val);
struct type * type, const gdb_byte * buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type));
+ enum type_code target = TYPE_TARGET_TYPE (type)->code ();
CORE_ADDR addr
= extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
struct type *type, gdb_byte *buf, CORE_ADDR addr)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type));
+ enum type_code target = TYPE_TARGET_TYPE (type)->code ();
if (target == TYPE_CODE_FUNC || target == TYPE_CODE_METHOD)
addr = insn_ptr_from_addr (addr);
static int
iq2000_use_struct_convention (struct type *type)
{
- return ((TYPE_CODE (type) == TYPE_CODE_STRUCT)
- || (TYPE_CODE (type) == TYPE_CODE_UNION))
+ return ((type->code () == TYPE_CODE_STRUCT)
+ || (type->code () == TYPE_CODE_UNION))
&& TYPE_LENGTH (type) > 8;
}
struct type *ftype;
/* Skip typedefs. */
- while (TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
+ while (type->code () == TYPE_CODE_TYPEDEF)
type = TYPE_TARGET_TYPE (type);
/* Non-struct and non-union types are always passed by value. */
- if (TYPE_CODE (type) != TYPE_CODE_STRUCT
- && TYPE_CODE (type) != TYPE_CODE_UNION)
+ if (type->code () != TYPE_CODE_STRUCT
+ && type->code () != TYPE_CODE_UNION)
return 0;
/* Structs with more than 1 field are always passed by address. */
if (TYPE_NFIELDS (type) != 1)
if (TYPE_LENGTH (ftype) != 8)
return 1;
/* Skip typedefs of field type. */
- while (TYPE_CODE (ftype) == TYPE_CODE_TYPEDEF)
+ while (ftype->code () == TYPE_CODE_TYPEDEF)
ftype = TYPE_TARGET_TYPE (ftype);
/* If field is int or float, pass by value. */
- if (TYPE_CODE (ftype) == TYPE_CODE_FLT
- || TYPE_CODE (ftype) == TYPE_CODE_INT)
+ if (ftype->code () == TYPE_CODE_FLT
+ || ftype->code () == TYPE_CODE_INT)
return 0;
/* Everything else, pass by address. */
return 1;
int
pointer_type (struct type *type)
{
- return TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type);
+ return type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type);
}
\f
default_is_string_type_p (struct type *type)
{
type = check_typedef (type);
- while (TYPE_CODE (type) == TYPE_CODE_REF)
+ while (type->code () == TYPE_CODE_REF)
{
type = TYPE_TARGET_TYPE (type);
type = check_typedef (type);
}
- return (TYPE_CODE (type) == TYPE_CODE_STRING);
+ return (type->code () == TYPE_CODE_STRING);
}
/* See language.h. */
{
struct type *type = SYMBOL_TYPE (sym);
- if (type && TYPE_CODE (type) == TYPE_CODE_BOOL)
+ if (type && type->code () == TYPE_CODE_BOOL)
return type;
}
}
t = SYMBOL_TYPE (sym);
t = check_typedef (t);
- if (TYPE_CODE (t) != TYPE_CODE_STRUCT
- && TYPE_CODE (t) != TYPE_CODE_UNION
- && TYPE_CODE (t) != TYPE_CODE_NAMESPACE)
+ if (t->code () != TYPE_CODE_STRUCT
+ && t->code () != TYPE_CODE_UNION
+ && t->code () != TYPE_CODE_NAMESPACE)
return true; /* Continue iterating. */
slot = htab_find_slot (m_unique_syms, sym, INSERT);
sscanf ((variable[1] == '$') ? variable + 2 : variable + 1, "%d", &index);
val_history
= access_value_history ((variable[1] == '$') ? -index : index);
- if (TYPE_CODE (value_type (val_history)) != TYPE_CODE_INT)
+ if (value_type (val_history)->code () != TYPE_CODE_INT)
error (_("History values used in line "
"specs must have integer values."));
offset.offset = value_as_long (val_history);
ULONGEST val;
/* Promote small integer types to int. */
- switch (TYPE_CODE (arg_type))
+ switch (arg_type->code ())
{
case TYPE_CODE_INT:
case TYPE_CODE_BOOL:
ULONGEST l;
CORE_ADDR return_buffer;
- if (TYPE_CODE (type) != TYPE_CODE_STRUCT
- && TYPE_CODE (type) != TYPE_CODE_UNION
- && TYPE_CODE (type) != TYPE_CODE_ARRAY && TYPE_LENGTH (type) <= 4)
+ if (type->code () != TYPE_CODE_STRUCT
+ && type->code () != TYPE_CODE_UNION
+ && type->code () != TYPE_CODE_ARRAY && TYPE_LENGTH (type) <= 4)
{
/* Return value is returned in a single register. */
regcache_cooked_read_unsigned (regcache, SIM_LM32_R1_REGNUM, &l);
store_unsigned_integer (valbuf, TYPE_LENGTH (type), byte_order, l);
}
- else if ((TYPE_CODE (type) == TYPE_CODE_INT) && (TYPE_LENGTH (type) == 8))
+ else if ((type->code () == TYPE_CODE_INT) && (TYPE_LENGTH (type) == 8))
{
/* 64-bit values are returned in a register pair. */
regcache_cooked_read_unsigned (regcache, SIM_LM32_R1_REGNUM, &l);
struct type *valtype, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
- enum type_code code = TYPE_CODE (valtype);
+ enum type_code code = valtype->code ();
if (code == TYPE_CODE_STRUCT
|| code == TYPE_CODE_UNION
m2_is_string_type_p (struct type *type)
{
type = check_typedef (type);
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY
+ if (type->code () == TYPE_CODE_ARRAY
&& TYPE_LENGTH (type) > 0
&& TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0)
{
struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
if (TYPE_LENGTH (elttype) == 1
- && (TYPE_CODE (elttype) == TYPE_CODE_INT
- || TYPE_CODE (elttype) == TYPE_CODE_CHAR))
+ && (elttype->code () == TYPE_CODE_INT
+ || elttype->code () == TYPE_CODE_CHAR))
return true;
}
{
struct value *temp = arg1;
type = TYPE_FIELD_TYPE (type, 0);
- if (type == NULL || (TYPE_CODE (type) != TYPE_CODE_PTR))
+ if (type == NULL || (type->code () != TYPE_CODE_PTR))
{
warning (_("internal error: unbounded "
"array structure is unknown"));
return value_ind (value_ptradd (arg1, value_as_long (arg2)));
}
else
- if (TYPE_CODE (type) != TYPE_CODE_ARRAY)
+ if (type->code () != TYPE_CODE_ARRAY)
{
if (TYPE_NAME (type))
error (_("cannot subscript something of type `%s'"),
return;
}
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_SET:
m2_short_set(type, stream, show, level);
fprintf_filtered (stream, "PROCEDURE ");
m2_type_name (type, stream);
if (TYPE_TARGET_TYPE (type) == NULL
- || TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
+ || TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID)
{
int i, len = TYPE_NFIELDS (type);
int len, i;
struct type *range;
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
{
/* check if all fields of the RECORD are consecutive sets. */
{
if (TYPE_FIELD_TYPE (type, i) == NULL)
return 0;
- if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) != TYPE_CODE_SET)
+ if (TYPE_FIELD_TYPE (type, i)->code () != TYPE_CODE_SET)
return 0;
if (TYPE_FIELD_NAME (type, i) != NULL
&& (strcmp (TYPE_FIELD_NAME (type, i), "") != 0))
m2_get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp)
{
type = check_typedef (type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_CHAR:
if (TYPE_LENGTH (type) < sizeof (LONGEST))
LONGEST l1, l2;
LONGEST h1, h2;
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
{
len = TYPE_NFIELDS (type);
i = TYPE_N_BASECLASSES (type);
int
m2_is_unbounded_array (struct type *type)
{
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
{
/*
* check if we have a structure with exactly two fields named
return 0;
if (strcmp (TYPE_FIELD_NAME (type, 1), "_m2_high") != 0)
return 0;
- if (TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) != TYPE_CODE_PTR)
+ if (TYPE_FIELD_TYPE (type, 0)->code () != TYPE_CODE_PTR)
return 0;
return 1;
}
wrap_here (" ");
if (show < 0)
{
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
fprintf_filtered (stream, "RECORD ... END ");
- else if (TYPE_CODE (type) == TYPE_CODE_UNION)
+ else if (type->code () == TYPE_CODE_UNION)
fprintf_filtered (stream, "CASE ... END ");
}
else if (show > 0)
int i;
int len = TYPE_NFIELDS (type);
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
fprintf_filtered (stream, "RECORD\n");
- else if (TYPE_CODE (type) == TYPE_CODE_UNION)
+ else if (type->code () == TYPE_CODE_UNION)
/* i18n: Do not translate "CASE" and "OF". */
fprintf_filtered (stream, _("CASE <variant> OF\n"));
{
int len, i;
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
{
len = TYPE_NFIELDS (type);
i = TYPE_N_BASECLASSES (type);
struct type *elttype = check_typedef (TYPE_TARGET_TYPE (type));
int want_space = 0;
- if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
+ if (elttype->code () == TYPE_CODE_FUNC)
{
/* Try to print what function it points to. */
print_function_pointer_address (options, gdbarch, addr, stream);
pointed to, unless pointer is null. */
if (TYPE_LENGTH (elttype) == 1
- && TYPE_CODE (elttype) == TYPE_CODE_INT
+ && elttype->code () == TYPE_CODE_INT
&& (options->format == 0 || options->format == 's')
&& addr != 0)
{
fputs_filtered (paddress (gdbarch, addr), stream);
fprintf_filtered (stream, "] : ");
- if (TYPE_CODE (elttype) != TYPE_CODE_UNDEF)
+ if (elttype->code () != TYPE_CODE_UNDEF)
{
struct value *deref_val =
value_at (TYPE_TARGET_TYPE (type), unpack_pointer (type, valaddr));
{
/* For an array of chars, print with string syntax. */
if (TYPE_LENGTH (type) == 1 &&
- ((TYPE_CODE (type) == TYPE_CODE_INT)
+ ((type->code () == TYPE_CODE_INT)
|| ((current_language->la_language == language_m2)
- && (TYPE_CODE (type) == TYPE_CODE_CHAR)))
+ && (type->code () == TYPE_CODE_CHAR)))
&& (options->format == 0 || options->format == 's'))
val_print_string (type, NULL, value_address (val), len+1, stream,
options);
const CORE_ADDR address = value_address (val);
struct type *type = check_typedef (value_type (val));
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_ARRAY:
if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0)
len = TYPE_LENGTH (type) / TYPE_LENGTH (elttype);
/* For an array of chars, print with string syntax. */
if (TYPE_LENGTH (elttype) == 1 &&
- ((TYPE_CODE (elttype) == TYPE_CODE_INT)
+ ((elttype->code () == TYPE_CODE_INT)
|| ((current_language->la_language == language_m2)
- && (TYPE_CODE (elttype) == TYPE_CODE_CHAR)))
+ && (elttype->code () == TYPE_CODE_CHAR)))
&& (options->format == 0 || options->format == 's'))
{
/* If requested, look for the first null char and only print
static int
m32c_reg_arg_type (struct type *type)
{
- enum type_code code = TYPE_CODE (type);
+ enum type_code code = type->code ();
return (code == TYPE_CODE_INT
|| code == TYPE_CODE_ENUM
struct type *func_type = value_type (function);
/* Dereference function pointer types. */
- if (TYPE_CODE (func_type) == TYPE_CODE_PTR)
+ if (func_type->code () == TYPE_CODE_PTR)
func_type = TYPE_TARGET_TYPE (func_type);
- gdb_assert (TYPE_CODE (func_type) == TYPE_CODE_FUNC ||
- TYPE_CODE (func_type) == TYPE_CODE_METHOD);
+ gdb_assert (func_type->code () == TYPE_CODE_FUNC ||
+ func_type->code () == TYPE_CODE_METHOD);
#if 0
/* The ABI description in gcc/config/m32c/m32c.abi says that
static int
m32c_return_by_passed_buf (struct type *type)
{
- enum type_code code = TYPE_CODE (type);
+ enum type_code code = type->code ();
return (code == TYPE_CODE_STRUCT
|| code == TYPE_CODE_UNION);
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
enum type_code target_code;
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type));
+ gdb_assert (type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type));
- target_code = TYPE_CODE (TYPE_TARGET_TYPE (type));
+ target_code = TYPE_TARGET_TYPE (type)->code ();
if (target_code == TYPE_CODE_FUNC || target_code == TYPE_CODE_METHOD)
{
CORE_ADDR ptr;
enum type_code target_code;
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type));
+ gdb_assert (type->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (type));
ptr = extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
- target_code = TYPE_CODE (TYPE_TARGET_TYPE (type));
+ target_code = TYPE_TARGET_TYPE (type)->code ();
if (target_code == TYPE_CODE_FUNC || target_code == TYPE_CODE_METHOD)
{
for (argnum = 0, stack_offset = 0; argnum < nargs; argnum++)
{
type = value_type (args[argnum]);
- typecode = TYPE_CODE (type);
+ typecode = type->code ();
len = TYPE_LENGTH (type);
memset (valbuf, 0, sizeof (valbuf));
struct type *valtype, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
- if (TYPE_CODE (valtype) == TYPE_CODE_STRUCT
- || TYPE_CODE (valtype) == TYPE_CODE_UNION
- || TYPE_CODE (valtype) == TYPE_CODE_ARRAY
+ if (valtype->code () == TYPE_CODE_STRUCT
+ || valtype->code () == TYPE_CODE_UNION
+ || valtype->code () == TYPE_CODE_ARRAY
|| TYPE_LENGTH (valtype) > 4)
return RETURN_VALUE_STRUCT_CONVENTION;
else
return 0;
return (regnum >= M68K_FP0_REGNUM && regnum <= M68K_FP0_REGNUM + 7
/* We only support floating-point values. */
- && TYPE_CODE (type) == TYPE_CODE_FLT
+ && type->code () == TYPE_CODE_FLT
&& type != register_type (gdbarch, M68K_FP0_REGNUM));
}
gdb_byte from[M68K_MAX_REGISTER_SIZE];
struct type *fpreg_type = register_type (gdbarch, M68K_FP0_REGNUM);
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
+ gdb_assert (type->code () == TYPE_CODE_FLT);
/* Convert to TYPE. */
if (!get_frame_register_bytes (frame, regnum, 0,
M68K_FP0_REGNUM);
/* We only support floating-point values. */
- if (TYPE_CODE (type) != TYPE_CODE_FLT)
+ if (type->code () != TYPE_CODE_FLT)
{
warning (_("Cannot convert non-floating-point type "
"to floating-point register value."));
struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- if (tdep->float_return && TYPE_CODE (type) == TYPE_CODE_FLT)
+ if (tdep->float_return && type->code () == TYPE_CODE_FLT)
{
struct type *fpreg_type = register_type (gdbarch, M68K_FP0_REGNUM);
regcache->raw_read (M68K_FP0_REGNUM, buf);
target_float_convert (buf, fpreg_type, valbuf, type);
}
- else if (TYPE_CODE (type) == TYPE_CODE_PTR && TYPE_LENGTH (type) == 4)
+ else if (type->code () == TYPE_CODE_PTR && TYPE_LENGTH (type) == 4)
regcache->raw_read (M68K_A0_REGNUM, valbuf);
else
m68k_extract_return_value (type, regcache, valbuf);
struct gdbarch *gdbarch = regcache->arch ();
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- if (tdep->float_return && TYPE_CODE (type) == TYPE_CODE_FLT)
+ if (tdep->float_return && type->code () == TYPE_CODE_FLT)
{
struct type *fpreg_type = register_type (gdbarch, M68K_FP0_REGNUM);
gdb_byte buf[M68K_MAX_REGISTER_SIZE];
target_float_convert (valbuf, type, buf, fpreg_type);
regcache->raw_write (M68K_FP0_REGNUM, buf);
}
- else if (TYPE_CODE (type) == TYPE_CODE_PTR && TYPE_LENGTH (type) == 4)
+ else if (type->code () == TYPE_CODE_PTR && TYPE_LENGTH (type) == 4)
{
regcache->raw_write (M68K_A0_REGNUM, valbuf);
regcache->raw_write (M68K_D0_REGNUM, valbuf);
m68k_reg_struct_return_p (struct gdbarch *gdbarch, struct type *type)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- enum type_code code = TYPE_CODE (type);
+ enum type_code code = type->code ();
int len = TYPE_LENGTH (type);
gdb_assert (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION
struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
- enum type_code code = TYPE_CODE (type);
+ enum type_code code = type->code ();
/* GCC returns a `long double' in memory too. */
if (((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION
struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
- enum type_code code = TYPE_CODE (type);
+ enum type_code code = type->code ();
if ((code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION
|| code == TYPE_CODE_COMPLEX)
/* Non-scalars bigger than 4 bytes are left aligned, others are
right aligned. */
- if ((TYPE_CODE (value_type) == TYPE_CODE_STRUCT
- || TYPE_CODE (value_type) == TYPE_CODE_UNION
- || TYPE_CODE (value_type) == TYPE_CODE_ARRAY)
+ if ((value_type->code () == TYPE_CODE_STRUCT
+ || value_type->code () == TYPE_CODE_UNION
+ || value_type->code () == TYPE_CODE_ARRAY)
&& len > 4)
offset = 0;
else
{
t = parse_type (cur_fd, ax, sh->index + 1, 0, bigend, name);
if (strcmp (name, "malloc") == 0
- && TYPE_CODE (t) == TYPE_CODE_VOID)
+ && t->code () == TYPE_CODE_VOID)
{
/* I don't know why, but, at least under Alpha GNU/Linux,
when linking against a malloc without debugging
/* Incomplete definitions of structs should not get a name. */
if (TYPE_NAME (SYMBOL_TYPE (s)) == NULL
&& (TYPE_NFIELDS (SYMBOL_TYPE (s)) != 0
- || (TYPE_CODE (SYMBOL_TYPE (s)) != TYPE_CODE_STRUCT
- && TYPE_CODE (SYMBOL_TYPE (s)) != TYPE_CODE_UNION)))
+ || (SYMBOL_TYPE (s)->code () != TYPE_CODE_STRUCT
+ && SYMBOL_TYPE (s)->code () != TYPE_CODE_UNION)))
{
- if (TYPE_CODE (SYMBOL_TYPE (s)) == TYPE_CODE_PTR
- || TYPE_CODE (SYMBOL_TYPE (s)) == TYPE_CODE_FUNC)
+ if (SYMBOL_TYPE (s)->code () == TYPE_CODE_PTR
+ || SYMBOL_TYPE (s)->code () == TYPE_CODE_FUNC)
{
/* If we are giving a name to a type such as "pointer to
foo" or "function returning foo", we better not set
/* DEC c89 produces cross references to qualified aggregate types,
dereference them. */
- while (TYPE_CODE (tp) == TYPE_CODE_PTR
- || TYPE_CODE (tp) == TYPE_CODE_ARRAY)
+ while (tp->code () == TYPE_CODE_PTR
+ || tp->code () == TYPE_CODE_ARRAY)
tp = TYPE_TARGET_TYPE (tp);
/* Make sure that TYPE_CODE(tp) has an expected type code.
Any type may be returned from cross_ref if file indirect entries
are corrupted. */
- if (TYPE_CODE (tp) != TYPE_CODE_STRUCT
- && TYPE_CODE (tp) != TYPE_CODE_UNION
- && TYPE_CODE (tp) != TYPE_CODE_ENUM)
+ if (tp->code () != TYPE_CODE_STRUCT
+ && tp->code () != TYPE_CODE_UNION
+ && tp->code () != TYPE_CODE_ENUM)
{
unexpected_type_code_complaint (sym_name);
}
exception is if we guessed wrong re struct/union/enum.
But for struct vs. union a wrong guess is harmless, so
don't complain(). */
- if ((TYPE_CODE (tp) == TYPE_CODE_ENUM
+ if ((tp->code () == TYPE_CODE_ENUM
&& type_code != TYPE_CODE_ENUM)
- || (TYPE_CODE (tp) != TYPE_CODE_ENUM
+ || (tp->code () != TYPE_CODE_ENUM
&& type_code == TYPE_CODE_ENUM))
{
bad_tag_guess_complaint (sym_name);
}
- if (TYPE_CODE (tp) != type_code)
+ if (tp->code () != type_code)
{
tp->set_code (type_code);
}
/* Make sure that TYPE_CODE(tp) has an expected type code.
Any type may be returned from cross_ref if file indirect entries
are corrupted. */
- if (TYPE_CODE (tp) != TYPE_CODE_RANGE)
+ if (tp->code () != TYPE_CODE_RANGE)
{
unexpected_type_code_complaint (sym_name);
}
{
/* Usually, TYPE_CODE(tp) is already type_code. The main
exception is if we guessed wrong re struct/union/enum. */
- if (TYPE_CODE (tp) != type_code)
+ if (tp->code () != type_code)
{
bad_tag_guess_complaint (sym_name);
tp->set_code (type_code);
/* The bounds type should be an integer type, but might be anything
else due to corrupt aux entries. */
- if (TYPE_CODE (indx) != TYPE_CODE_INT)
+ if (indx->code () != TYPE_CODE_INT)
{
complaint (_("illegal array index type for %s, assuming int"),
sym_name);
if (processing_gcc_compilation == 0
&& found_ecoff_debugging_info == 0
- && TYPE_CODE (TYPE_TARGET_TYPE (SYMBOL_TYPE (s))) == TYPE_CODE_VOID)
+ && TYPE_TARGET_TYPE (SYMBOL_TYPE (s))->code () == TYPE_CODE_VOID)
SYMBOL_TYPE (s) = objfile_type (mdebugread_objfile)->nodebug_text_symbol;
}
{
case PRINT_SIMPLE_VALUES:
type = check_typedef (sym2->type);
- if (TYPE_CODE (type) != TYPE_CODE_ARRAY
- && TYPE_CODE (type) != TYPE_CODE_STRUCT
- && TYPE_CODE (type) != TYPE_CODE_UNION)
+ if (type->code () != TYPE_CODE_ARRAY
+ && type->code () != TYPE_CODE_STRUCT
+ && type->code () != TYPE_CODE_UNION)
{
case PRINT_ALL_VALUES:
if (SYMBOL_IS_ARGUMENT (sym))
/* For PRINT_SIMPLE_VALUES, only print the value if it has a type
and that type is not a compound type. */
- return (TYPE_CODE (type) != TYPE_CODE_ARRAY
- && TYPE_CODE (type) != TYPE_CODE_STRUCT
- && TYPE_CODE (type) != TYPE_CODE_UNION);
+ return (type->code () != TYPE_CODE_ARRAY
+ && type->code () != TYPE_CODE_STRUCT
+ && type->code () != TYPE_CODE_UNION);
}
}
type = check_typedef (value_type (val));
type_print (value_type (val), "", &stb, -1);
uiout->field_stream ("type", stb);
- if (TYPE_CODE (type) != TYPE_CODE_ARRAY
- && TYPE_CODE (type) != TYPE_CODE_STRUCT
- && TYPE_CODE (type) != TYPE_CODE_UNION)
+ if (type->code () != TYPE_CODE_ARRAY
+ && type->code () != TYPE_CODE_STRUCT
+ && type->code () != TYPE_CODE_UNION)
{
struct value_print_options opts;
if (reggroup == all_reggroup)
return pseudo;
vector_p = TYPE_VECTOR (register_type (gdbarch, regnum));
- float_p = TYPE_CODE (register_type (gdbarch, regnum)) == TYPE_CODE_FLT;
+ float_p = register_type (gdbarch, regnum)->code () == TYPE_CODE_FLT;
/* FIXME: cagney/2003-04-13: Can't yet use gdbarch_num_regs
(gdbarch), as not all architectures are multi-arch. */
raw_p = rawnum < gdbarch_num_regs (gdbarch);
return (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG
&& register_size (gdbarch, regnum) == 4
&& mips_float_register_p (gdbarch, regnum)
- && TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8);
+ && type->code () == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8);
}
/* This predicate tests for the case of a value of less than 8
&& (typecode == TYPE_CODE_STRUCT
|| typecode == TYPE_CODE_UNION)
&& TYPE_NFIELDS (arg_type) == 1
- && TYPE_CODE (check_typedef (TYPE_FIELD_TYPE (arg_type, 0)))
+ && check_typedef (TYPE_FIELD_TYPE (arg_type, 0))->code ()
== TYPE_CODE_FLT))
&& MIPS_FPU_TYPE(gdbarch) != MIPS_FPU_NONE);
}
static int
mips_type_needs_double_align (struct type *type)
{
- enum type_code typecode = TYPE_CODE (type);
+ enum type_code typecode = type->code ();
if (typecode == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8)
return 1;
struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg));
int len = TYPE_LENGTH (arg_type);
- enum type_code typecode = TYPE_CODE (arg_type);
+ enum type_code typecode = arg_type->code ();
if (mips_debug)
fprintf_unfiltered (gdb_stdlog,
/* Floating point type? */
if (tdep->mips_fpu_type != MIPS_FPU_NONE)
{
- if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ if (type->code () == TYPE_CODE_FLT)
fp_return_type = 1;
/* Structs with a single field of float type
are returned in a floating point register. */
- if ((TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION)
+ if ((type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION)
&& TYPE_NFIELDS (type) == 1)
{
struct type *fieldtype = TYPE_FIELD_TYPE (type, 0);
- if (TYPE_CODE (check_typedef (fieldtype)) == TYPE_CODE_FLT)
+ if (check_typedef (fieldtype)->code () == TYPE_CODE_FLT)
fp_return_type = 1;
}
}
{
int i;
- if (TYPE_CODE (arg_type) != TYPE_CODE_STRUCT)
+ if (arg_type->code () != TYPE_CODE_STRUCT)
return 0;
if (MIPS_FPU_TYPE (gdbarch) != MIPS_FPU_DOUBLE)
continue;
/* If this is our special aligned double, we can stop. */
- if (TYPE_CODE (field_type) == TYPE_CODE_FLT
+ if (field_type->code () == TYPE_CODE_FLT
&& TYPE_LENGTH (field_type) == MIPS64_REGSIZE)
return 1;
struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg));
int len = TYPE_LENGTH (arg_type);
- enum type_code typecode = TYPE_CODE (arg_type);
+ enum type_code typecode = arg_type->code ();
if (mips_debug)
fprintf_unfiltered (gdb_stdlog,
if (TYPE_LENGTH (type) > 2 * MIPS64_REGSIZE)
return RETURN_VALUE_STRUCT_CONVENTION;
- else if (TYPE_CODE (type) == TYPE_CODE_FLT
+ else if (type->code () == TYPE_CODE_FLT
&& TYPE_LENGTH (type) == 16
&& tdep->mips_fpu_type != MIPS_FPU_NONE)
{
writebuf ? writebuf + 8 : writebuf, 0);
return RETURN_VALUE_REGISTER_CONVENTION;
}
- else if (TYPE_CODE (type) == TYPE_CODE_FLT
+ else if (type->code () == TYPE_CODE_FLT
&& tdep->mips_fpu_type != MIPS_FPU_NONE)
{
/* A single or double floating-point value that fits in FP0. */
readbuf, writebuf, 0);
return RETURN_VALUE_REGISTER_CONVENTION;
}
- else if (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ else if (type->code () == TYPE_CODE_STRUCT
&& TYPE_NFIELDS (type) <= 2
&& TYPE_NFIELDS (type) >= 1
&& ((TYPE_NFIELDS (type) == 1
- && (TYPE_CODE (check_typedef (TYPE_FIELD_TYPE (type, 0)))
+ && (check_typedef (TYPE_FIELD_TYPE (type, 0))->code ()
== TYPE_CODE_FLT))
|| (TYPE_NFIELDS (type) == 2
- && (TYPE_CODE (check_typedef (TYPE_FIELD_TYPE (type, 0)))
+ && (check_typedef (TYPE_FIELD_TYPE (type, 0))->code ()
== TYPE_CODE_FLT)
- && (TYPE_CODE (check_typedef (TYPE_FIELD_TYPE (type, 1)))
+ && (check_typedef (TYPE_FIELD_TYPE (type, 1))->code ()
== TYPE_CODE_FLT))))
{
/* A struct that contains one or two floats. Each value is part
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
- else if (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION
- || TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ else if (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION
+ || type->code () == TYPE_CODE_ARRAY)
{
/* A composite type. Extract the left justified value,
regardless of the byte order. I.e. DO NOT USE
struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg));
int len = TYPE_LENGTH (arg_type);
- enum type_code typecode = TYPE_CODE (arg_type);
+ enum type_code typecode = arg_type->code ();
if (mips_debug)
fprintf_unfiltered (gdb_stdlog,
enum mips_fval_reg fval_reg;
fval_reg = readbuf ? mips16 ? mips_fval_gpr : mips_fval_fpr : mips_fval_both;
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION
- || TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ if (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION
+ || type->code () == TYPE_CODE_ARRAY)
return RETURN_VALUE_STRUCT_CONVENTION;
- else if (TYPE_CODE (type) == TYPE_CODE_FLT
+ else if (type->code () == TYPE_CODE_FLT
&& TYPE_LENGTH (type) == 4 && tdep->mips_fpu_type != MIPS_FPU_NONE)
{
/* A single-precision floating-point value. If reading in or copying,
readbuf, writebuf, 0);
return RETURN_VALUE_REGISTER_CONVENTION;
}
- else if (TYPE_CODE (type) == TYPE_CODE_FLT
+ else if (type->code () == TYPE_CODE_FLT
&& TYPE_LENGTH (type) == 8 && tdep->mips_fpu_type != MIPS_FPU_NONE)
{
/* A double-precision floating-point value. If reading in or copying,
return RETURN_VALUE_REGISTER_CONVENTION;
}
#if 0
- else if (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ else if (type->code () == TYPE_CODE_STRUCT
&& TYPE_NFIELDS (type) <= 2
&& TYPE_NFIELDS (type) >= 1
&& ((TYPE_NFIELDS (type) == 1
}
#endif
#if 0
- else if (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION)
+ else if (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION)
{
/* A structure or union. Extract the left justified value,
regardless of the byte order. I.e. DO NOT USE
struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg));
int len = TYPE_LENGTH (arg_type);
- enum type_code typecode = TYPE_CODE (arg_type);
+ enum type_code typecode = arg_type->code ();
if (mips_debug)
fprintf_unfiltered (gdb_stdlog,
enum mips_fval_reg fval_reg;
fval_reg = readbuf ? mips16 ? mips_fval_gpr : mips_fval_fpr : mips_fval_both;
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION
- || TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ if (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION
+ || type->code () == TYPE_CODE_ARRAY)
return RETURN_VALUE_STRUCT_CONVENTION;
- else if (fp_register_arg_p (gdbarch, TYPE_CODE (type), type))
+ else if (fp_register_arg_p (gdbarch, type->code (), type))
{
/* A floating-point value. If reading in or copying, then we get it
from/put it to FP0 for standard MIPS code or GPR2 for MIPS16 code.
{
int i, align = 1;
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_INT:
case TYPE_CODE_ENUM:
if (TYPE_LENGTH (type) > 8)
return 1;
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
int len = TYPE_LENGTH (type);
int reg, regsz;
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ if (type->code () == TYPE_CODE_PTR)
reg = 4;
else
reg = 0;
int len = TYPE_LENGTH (type);
int reg, regsz;
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ if (type->code () == TYPE_CODE_PTR)
reg = 4;
else
reg = 0;
for (argnum = 0; argnum < nargs; argnum++)
{
/* FIXME what about structs? Unions? */
- if (TYPE_CODE (value_type (*args)) == TYPE_CODE_STRUCT
+ if (value_type (*args)->code () == TYPE_CODE_STRUCT
&& TYPE_LENGTH (value_type (*args)) > 8)
{
/* Change to pointer-to-type. */
int code_model = gdbarch_tdep (gdbarch)->code_model;
if (TYPE_LENGTH (valtype) > 8
- || TYPE_CODE (valtype) == TYPE_CODE_STRUCT
- || TYPE_CODE (valtype) == TYPE_CODE_UNION)
+ || valtype->code () == TYPE_CODE_STRUCT
+ || valtype->code () == TYPE_CODE_UNION)
return RETURN_VALUE_STRUCT_CONVENTION;
if (readbuf)
int size = 2;
if (code_model == MSP_LARGE_CODE_MODEL
- && TYPE_CODE (valtype) == TYPE_CODE_PTR)
+ && valtype->code () == TYPE_CODE_PTR)
{
size = 4;
}
int size = 2;
if (code_model == MSP_LARGE_CODE_MODEL
- && TYPE_CODE (valtype) == TYPE_CODE_PTR)
+ && valtype->code () == TYPE_CODE_PTR)
{
size = 4;
}
struct type *func_type = value_type (function);
/* Dereference function pointer types. */
- while (TYPE_CODE (func_type) == TYPE_CODE_PTR)
+ while (func_type->code () == TYPE_CODE_PTR)
func_type = TYPE_TARGET_TYPE (func_type);
/* The end result had better be a function or a method. */
- gdb_assert (TYPE_CODE (func_type) == TYPE_CODE_FUNC
- || TYPE_CODE (func_type) == TYPE_CODE_METHOD);
+ gdb_assert (func_type->code () == TYPE_CODE_FUNC
+ || func_type->code () == TYPE_CODE_METHOD);
/* We make two passes; the first does the stack allocation,
the second actually stores the arguments. */
current_arg_on_stack = 0;
- if (TYPE_CODE (arg_type) == TYPE_CODE_STRUCT
- || TYPE_CODE (arg_type) == TYPE_CODE_UNION)
+ if (arg_type->code () == TYPE_CODE_STRUCT
+ || arg_type->code () == TYPE_CODE_UNION)
{
/* Aggregates of any size are passed by reference. */
store_unsigned_integer (struct_addr_buf, 4, byte_order,
int size = 2;
if (code_model == MSP_LARGE_CODE_MODEL
- && (TYPE_CODE (arg_type) == TYPE_CODE_PTR
+ && (arg_type->code () == TYPE_CODE_PTR
|| TYPE_IS_REFERENCE (arg_type)
- || TYPE_CODE (arg_type) == TYPE_CODE_STRUCT
- || TYPE_CODE (arg_type) == TYPE_CODE_UNION))
+ || arg_type->code () == TYPE_CODE_STRUCT
+ || arg_type->code () == TYPE_CODE_UNION))
{
/* When using the large memory model, pointer,
reference, struct, and union arguments are
while (1)
{
t = check_typedef (t);
- typecode = TYPE_CODE (t);
+ typecode = t->code ();
if (typecode != TYPE_CODE_STRUCT)
break;
else if (TYPE_NFIELDS (t) != 1)
static ULONGEST
nios2_type_align (struct gdbarch *gdbarch, struct type *type)
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_PTR:
case TYPE_CODE_FUNC:
else
error (_("No struct type named %s."), name);
}
- if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_STRUCT)
+ if (SYMBOL_TYPE (sym)->code () != TYPE_CODE_STRUCT)
{
if (noerr)
return 0;
{
LONGEST lowb, highb;
- if (TYPE_CODE (types[i]) == TYPE_CODE_ARRAY && TYPE_VECTOR (types[i])
+ if (types[i]->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (types[i])
&& get_array_bounds (types[i], &lowb, &highb)
- && TYPE_CODE (TYPE_TARGET_TYPE (types[i])) == code
+ && TYPE_TARGET_TYPE (types[i])->code () == code
&& TYPE_UNSIGNED (TYPE_TARGET_TYPE (types[i])) == flag_unsigned
&& TYPE_LENGTH (TYPE_TARGET_TYPE (types[i])) == el_length
&& TYPE_LENGTH (types[i]) == length
LONGEST lowb = 0;
LONGEST highb = 0;
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY
+ if (type->code () == TYPE_CODE_ARRAY
&& !get_array_bounds (type, &lowb, &highb))
error (_("Could not determine the vector bounds"));
LONGEST lowb = 0;
LONGEST highb = 0;
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY
+ if (type->code () == TYPE_CODE_ARRAY
&& !get_array_bounds (type, &lowb, &highb))
error (_("Could not determine the vector bounds"));
/* Multiple components of the vector are requested which means the
resulting type is a vector as well. */
struct type *dst_type =
- lookup_opencl_vector_type (gdbarch, TYPE_CODE (elm_type),
+ lookup_opencl_vector_type (gdbarch, elm_type->code (),
TYPE_LENGTH (elm_type),
TYPE_UNSIGNED (elm_type), n);
struct type *rettype;
struct value *ret;
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type))
+ if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type))
{
struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type));
LONGEST lowb, highb;
type1 = check_typedef (value_type (val1));
type2 = check_typedef (value_type (val2));
- t1_is_vec = (TYPE_CODE (type1) == TYPE_CODE_ARRAY && TYPE_VECTOR (type1));
- t2_is_vec = (TYPE_CODE (type2) == TYPE_CODE_ARRAY && TYPE_VECTOR (type2));
+ t1_is_vec = (type1->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type1));
+ t2_is_vec = (type2->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type2));
if (!t1_is_vec || !t2_is_vec)
error (_("Vector operations are not supported on scalar types"));
error (_("Could not determine the vector bounds"));
/* Check whether the vector types are compatible. */
- if (TYPE_CODE (eltype1) != TYPE_CODE (eltype2)
+ if (eltype1->code () != eltype2->code ()
|| TYPE_LENGTH (eltype1) != TYPE_LENGTH (eltype2)
|| TYPE_UNSIGNED (eltype1) != TYPE_UNSIGNED (eltype2)
|| lowb1 != lowb2 || highb1 != highb2)
to_type = check_typedef (type);
- code1 = TYPE_CODE (to_type);
- code2 = TYPE_CODE (check_typedef (value_type (arg)));
+ code1 = to_type->code ();
+ code2 = check_typedef (value_type (arg))->code ();
if (code2 == TYPE_CODE_REF)
- code2 = TYPE_CODE (check_typedef (value_type (coerce_ref (arg))));
+ code2 = check_typedef (value_type (coerce_ref(arg)))->code ();
scalar = (code2 == TYPE_CODE_INT || code2 == TYPE_CODE_BOOL
|| code2 == TYPE_CODE_CHAR || code2 == TYPE_CODE_FLT
struct value *val;
struct type *type1 = check_typedef (value_type (arg1));
struct type *type2 = check_typedef (value_type (arg2));
- int t1_is_vec = (TYPE_CODE (type1) == TYPE_CODE_ARRAY
+ int t1_is_vec = (type1->code () == TYPE_CODE_ARRAY
&& TYPE_VECTOR (type1));
- int t2_is_vec = (TYPE_CODE (type2) == TYPE_CODE_ARRAY
+ int t2_is_vec = (type2->code () == TYPE_CODE_ARRAY
&& TYPE_VECTOR (type2));
if (!t1_is_vec && !t2_is_vec)
struct value **v = t1_is_vec ? &arg2 : &arg1;
struct type *t = t1_is_vec ? type2 : type1;
- if (TYPE_CODE (t) != TYPE_CODE_FLT && !is_integral_type (t))
+ if (t->code () != TYPE_CODE_FLT && !is_integral_type (t))
error (_("Argument to operation not a number or boolean."));
*v = opencl_value_cast (t1_is_vec ? type1 : type2, *v);
type1 = check_typedef (value_type (arg1));
type2 = check_typedef (value_type (arg2));
- if ((TYPE_CODE (type1) == TYPE_CODE_ARRAY && TYPE_VECTOR (type1))
- || (TYPE_CODE (type2) == TYPE_CODE_ARRAY && TYPE_VECTOR (type2)))
+ if ((type1->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type1))
+ || (type2->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type2)))
{
arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
(*pos)++;
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
type1 = check_typedef (value_type (arg1));
- if (TYPE_CODE (type1) == TYPE_CODE_ARRAY && TYPE_VECTOR (type1))
+ if (type1->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type1))
{
struct value *arg3, *tmp, *ret;
struct type *eltype2, *type3, *eltype3;
type2 = check_typedef (value_type (arg2));
type3 = check_typedef (value_type (arg3));
t2_is_vec
- = TYPE_CODE (type2) == TYPE_CODE_ARRAY && TYPE_VECTOR (type2);
+ = type2->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type2);
t3_is_vec
- = TYPE_CODE (type3) == TYPE_CODE_ARRAY && TYPE_VECTOR (type3);
+ = type3->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type3);
/* Widen the scalar operand to a vector if necessary. */
if (t2_is_vec || !t3_is_vec)
error (_("Could not determine the vector bounds"));
/* Throw an error if the types of arg2 or arg3 are incompatible. */
- if (TYPE_CODE (eltype2) != TYPE_CODE (eltype3)
+ if (eltype2->code () != eltype3->code ()
|| TYPE_LENGTH (eltype2) != TYPE_LENGTH (eltype3)
|| TYPE_UNSIGNED (eltype2) != TYPE_UNSIGNED (eltype3)
|| lowb2 != lowb3 || highb2 != highb3)
return value_from_longest (builtin_type (exp->gdbarch)->
builtin_int, 1);
}
- else if (TYPE_CODE (type1) == TYPE_CODE_ARRAY && TYPE_VECTOR (type1))
+ else if (type1->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type1))
{
return opencl_component_ref (exp, arg1, &exp->elts[pc + 2].string,
noside);
if (show > 0)
{
type = check_typedef (type);
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type)
+ if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)
&& TYPE_NAME (type) != NULL)
show = 0;
}
gdb_byte *readbuf, const gdb_byte *writebuf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- enum type_code rv_type = TYPE_CODE (valtype);
+ enum type_code rv_type = valtype->code ();
unsigned int rv_size = TYPE_LENGTH (valtype);
int bpw = (gdbarch_tdep (gdbarch))->bytes_per_word;
struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg));
int len = TYPE_LENGTH (arg_type);
- enum type_code typecode = TYPE_CODE (arg_type);
+ enum type_code typecode = arg_type->code ();
if (TYPE_VARARGS (func_type) && argnum >= TYPE_NFIELDS (func_type))
break; /* end or regular args, varargs go to stack. */
struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg));
int len = TYPE_LENGTH (arg_type);
- enum type_code typecode = TYPE_CODE (arg_type);
+ enum type_code typecode = arg_type->code ();
if ((TYPE_CODE_STRUCT == typecode) || (TYPE_CODE_UNION == typecode)
|| (len > bpw * 2))
struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg));
int len = TYPE_LENGTH (arg_type);
- enum type_code typecode = TYPE_CODE (arg_type);
+ enum type_code typecode = arg_type->code ();
/* The EABI passes structures that do not fit in a register by
reference. In all other cases, pass the structure by value. */
if ((TYPE_CODE_STRUCT == typecode) || (TYPE_CODE_UNION == typecode)
search_field = 0;
if (current_type)
{
- while (TYPE_CODE (current_type)
+ while (current_type->code ()
== TYPE_CODE_PTR)
current_type =
TYPE_TARGET_TYPE (current_type);
search_field = 0;
if (current_type)
{
- while (TYPE_CODE (current_type)
+ while (current_type->code ()
== TYPE_CODE_PTR)
current_type =
TYPE_TARGET_TYPE (current_type);
{ if (current_type)
{
/* Allow automatic dereference of classes. */
- if ((TYPE_CODE (current_type) == TYPE_CODE_PTR)
- && (TYPE_CODE (TYPE_TARGET_TYPE (current_type)) == TYPE_CODE_STRUCT)
- && (TYPE_CODE ($1) == TYPE_CODE_STRUCT))
+ if ((current_type->code () == TYPE_CODE_PTR)
+ && (TYPE_TARGET_TYPE (current_type)->code () == TYPE_CODE_STRUCT)
+ && (($1)->code () == TYPE_CODE_STRUCT))
write_exp_elt_opcode (pstate, UNOP_IND);
}
write_exp_elt_opcode (pstate, UNOP_CAST);
this_type = NULL;
if (this_type)
{
- if (TYPE_CODE (this_type) == TYPE_CODE_PTR)
+ if (this_type->code () == TYPE_CODE_PTR)
{
this_type = TYPE_TARGET_TYPE (this_type);
write_exp_elt_opcode (pstate, UNOP_IND);
{
struct type *type = $1;
- if (TYPE_CODE (type) != TYPE_CODE_STRUCT
- && TYPE_CODE (type) != TYPE_CODE_UNION)
+ if (type->code () != TYPE_CODE_STRUCT
+ && type->code () != TYPE_CODE_UNION)
error (_("`%s' is not defined as an aggregate type."),
TYPE_NAME (type));
struct type **char_type,
const char **arrayname)
{
- if (type != NULL && TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type != NULL && type->code () == TYPE_CODE_STRUCT)
{
/* Old Borland type pascal strings from Free Pascal Compiler. */
/* Two fields: length and st. */
{
*char_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 2));
- if (TYPE_CODE (*char_type) == TYPE_CODE_ARRAY)
+ if ((*char_type)->code () == TYPE_CODE_ARRAY)
*char_type = TYPE_TARGET_TYPE (*char_type);
}
if (arrayname)
enum type_code code;
int demangled_args;
- code = TYPE_CODE (type);
+ code = type->code ();
if (show > 0)
type = check_typedef (type);
QUIT;
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_PTR:
fprintf_filtered (stream, "^");
if (passed_a_ptr)
fprintf_filtered (stream, "(");
if (TYPE_TARGET_TYPE (type) != NULL
- && TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
+ && TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID)
{
fprintf_filtered (stream, "function ");
}
fprintf_filtered (stream, "(");
if (TYPE_TARGET_TYPE (type) != NULL
- && TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
+ && TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID)
{
fprintf_filtered (stream, "function ");
}
const struct type_print_options *flags)
{
if (TYPE_TARGET_TYPE (type) == NULL
- || TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
+ || TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID)
{
fprintf_filtered (stream, " : ");
pascal_type_print_varspec_prefix (TYPE_TARGET_TYPE (type),
QUIT;
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_ARRAY:
if (passed_a_ptr)
}
/* void pointer */
- if ((TYPE_CODE (type) == TYPE_CODE_PTR)
- && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID))
+ if ((type->code () == TYPE_CODE_PTR)
+ && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_VOID))
{
fputs_filtered (TYPE_NAME (type) ? TYPE_NAME (type) : "pointer",
stream);
type = check_typedef (type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_TYPEDEF:
case TYPE_CODE_PTR:
fprintf_filtered (stream, "destructor ");
}
else if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) != 0
- && TYPE_CODE (TYPE_TARGET_TYPE (
- TYPE_FN_FIELD_TYPE (f, j))) != TYPE_CODE_VOID)
+ && TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE(f, j))->code () != TYPE_CODE_VOID)
{
fprintf_filtered (stream, "function ");
}
stream);
if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) != 0
- && TYPE_CODE (TYPE_TARGET_TYPE (
- TYPE_FN_FIELD_TYPE (f, j))) != TYPE_CODE_VOID)
+ && TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE(f, j))->code () != TYPE_CODE_VOID)
{
fputs_filtered (" : ", stream);
type_print (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)),
an error (). */
fprintf_styled (stream, metadata_style.style (),
"<invalid unnamed pascal type code %d>",
- TYPE_CODE (type));
+ type->code ());
}
break;
}
int want_space = 0;
const gdb_byte *valaddr = value_contents_for_printing (val);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_ARRAY:
{
is of TYPE_CODE_CHAR and element size is 1,2 or 4. */
if (options->format == 's'
|| ((eltlen == 1 || eltlen == 2 || eltlen == 4)
- && TYPE_CODE (elttype) == TYPE_CODE_CHAR
+ && elttype->code () == TYPE_CODE_CHAR
&& options->format == 0))
{
/* If requested, look for the first null char and only print
print_unpacked_pointer:
elttype = check_typedef (TYPE_TARGET_TYPE (type));
- if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
+ if (elttype->code () == TYPE_CODE_FUNC)
{
/* Try to print what function it points to. */
print_address_demangle (options, gdbarch, addr, stream, demangle);
/* For a pointer to char or unsigned char, also print the string
pointed to, unless pointer is null. */
if (((TYPE_LENGTH (elttype) == 1
- && (TYPE_CODE (elttype) == TYPE_CODE_INT
- || TYPE_CODE (elttype) == TYPE_CODE_CHAR))
- || ((TYPE_LENGTH (elttype) == 2 || TYPE_LENGTH (elttype) == 4)
- && TYPE_CODE (elttype) == TYPE_CODE_CHAR))
+ && (elttype->code () == TYPE_CODE_INT
+ || elttype->code () == TYPE_CODE_CHAR))
+ || ((TYPE_LENGTH (elttype) == 2 || TYPE_LENGTH (elttype) == 4)
+ && elttype->code () == TYPE_CODE_CHAR))
&& (options->format == 0 || options->format == 's')
&& addr != 0)
{
default:
error (_("Invalid pascal type code %d in symbol table."),
- TYPE_CODE (type));
+ type->code ());
}
}
Object pascal: if it is a member pointer, we will take care
of that when we print it. */
- if (TYPE_CODE (type) == TYPE_CODE_PTR
- || TYPE_CODE (type) == TYPE_CODE_REF)
+ if (type->code () == TYPE_CODE_PTR
+ || type->code () == TYPE_CODE_REF)
{
/* Hack: remove (char *) for char strings. Their
type is indicated by the quoted string anyway. */
- if (TYPE_CODE (type) == TYPE_CODE_PTR
+ if (type->code () == TYPE_CODE_PTR
&& TYPE_NAME (type) == NULL
&& TYPE_NAME (TYPE_TARGET_TYPE (type)) != NULL
&& strcmp (TYPE_NAME (TYPE_TARGET_TYPE (type)), "char") == 0)
int
pascal_object_is_vtbl_member (struct type *type)
{
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ if (type->code () == TYPE_CODE_PTR)
{
type = TYPE_TARGET_TYPE (type);
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ if (type->code () == TYPE_CODE_ARRAY)
{
type = TYPE_TARGET_TYPE (type);
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT /* If not using
+ if (type->code () == TYPE_CODE_STRUCT /* If not using
thunks. */
- || TYPE_CODE (type) == TYPE_CODE_PTR) /* If using thunks. */
+ || type->code () == TYPE_CODE_PTR) /* If using thunks. */
{
/* Virtual functions tables are full of pointers
to virtual functions. */
return;
}
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
{
CORE_ADDR *first_dont_print, addr;
int i;
struct type *valtype, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
- if ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT
- || TYPE_CODE (valtype) == TYPE_CODE_UNION)
+ if ((valtype->code () == TYPE_CODE_STRUCT
+ || valtype->code () == TYPE_CODE_UNION)
&& !((TYPE_LENGTH (valtype) == 16 || TYPE_LENGTH (valtype) == 8)
&& TYPE_VECTOR (valtype)))
return RETURN_VALUE_STRUCT_CONVENTION;
gdb_byte *readbuf, const gdb_byte *writebuf)
{
#if 0
- if ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT
- || TYPE_CODE (valtype) == TYPE_CODE_UNION)
+ if ((valtype->code () == TYPE_CODE_STRUCT
+ || valtype->code () == TYPE_CODE_UNION)
&& !((TYPE_LENGTH (valtype) == 16 || TYPE_LENGTH (valtype) == 8)
&& TYPE_VECTOR (valtype))
&& !(TYPE_LENGTH (valtype) == 1
{
ftype = check_typedef (ftype);
- if (TYPE_CODE (ftype) == TYPE_CODE_PTR)
+ if (ftype->code () == TYPE_CODE_PTR)
ftype = check_typedef (TYPE_TARGET_TYPE (ftype));
- return (TYPE_CODE (ftype) == TYPE_CODE_FUNC
+ return (ftype->code () == TYPE_CODE_FUNC
&& TYPE_CALLING_CONVENTION (ftype) == DW_CC_GDB_IBM_OpenCL);
}
int len = TYPE_LENGTH (type);
const bfd_byte *val = value_contents (arg);
- if (TYPE_CODE (type) == TYPE_CODE_FLT && len <= 8
+ if (type->code () == TYPE_CODE_FLT && len <= 8
&& !tdep->soft_float)
{
/* Floating point value converted to "double" then
argoffset += len;
}
}
- else if (TYPE_CODE (type) == TYPE_CODE_FLT
+ else if (type->code () == TYPE_CODE_FLT
&& len == 16
&& !tdep->soft_float
&& (gdbarch_long_double_format (gdbarch)
}
}
else if (len == 8
- && (TYPE_CODE (type) == TYPE_CODE_INT /* long long */
- || TYPE_CODE (type) == TYPE_CODE_FLT /* double */
- || (TYPE_CODE (type) == TYPE_CODE_DECFLOAT
+ && (type->code () == TYPE_CODE_INT /* long long */
+ || type->code () == TYPE_CODE_FLT /* double */
+ || (type->code () == TYPE_CODE_DECFLOAT
&& tdep->soft_float)))
{
/* "long long" or soft-float "double" or "_Decimal64"
}
}
else if (len == 16
- && ((TYPE_CODE (type) == TYPE_CODE_FLT
+ && ((type->code () == TYPE_CODE_FLT
&& (gdbarch_long_double_format (gdbarch)
== floatformats_ibm_long_double))
- || (TYPE_CODE (type) == TYPE_CODE_DECFLOAT
+ || (type->code () == TYPE_CODE_DECFLOAT
&& tdep->soft_float)))
{
/* Soft-float IBM long double or _Decimal128 passed in
greg += 4;
}
}
- else if (TYPE_CODE (type) == TYPE_CODE_DECFLOAT && len <= 8
+ else if (type->code () == TYPE_CODE_DECFLOAT && len <= 8
&& !tdep->soft_float)
{
/* 32-bit and 64-bit decimal floats go in f1 .. f8. They can
argoffset += len;
}
}
- else if (TYPE_CODE (type) == TYPE_CODE_DECFLOAT && len == 16
+ else if (type->code () == TYPE_CODE_DECFLOAT && len == 16
&& !tdep->soft_float)
{
/* 128-bit decimal floats go in f2 .. f7, always in even/odd
freg += 2;
}
else if (len < 16
- && TYPE_CODE (type) == TYPE_CODE_ARRAY
+ && type->code () == TYPE_CODE_ARRAY
&& TYPE_VECTOR (type)
&& opencl_abi)
{
{
const gdb_byte *elval = val + i * TYPE_LENGTH (eltype);
- if (TYPE_CODE (eltype) == TYPE_CODE_FLT && !tdep->soft_float)
+ if (eltype->code () == TYPE_CODE_FLT && !tdep->soft_float)
{
if (freg <= 8)
{
}
}
else if (len >= 16
- && TYPE_CODE (type) == TYPE_CODE_ARRAY
+ && type->code () == TYPE_CODE_ARRAY
&& TYPE_VECTOR (type)
&& opencl_abi)
{
}
}
else if (len == 16
- && TYPE_CODE (type) == TYPE_CODE_ARRAY
+ && type->code () == TYPE_CODE_ARRAY
&& TYPE_VECTOR (type)
&& tdep->vector_abi == POWERPC_VEC_ALTIVEC)
{
}
}
else if (len == 8
- && TYPE_CODE (type) == TYPE_CODE_ARRAY
+ && type->code () == TYPE_CODE_ARRAY
&& TYPE_VECTOR (type)
&& tdep->vector_abi == POWERPC_VEC_SPE)
{
gdb_byte word[PPC_MAX_REGISTER_SIZE];
memset (word, 0, PPC_MAX_REGISTER_SIZE);
if (len > tdep->wordsize
- || TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION)
+ || type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION)
{
/* Structs and large values are put in an
aligned stack slot ... */
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY
+ if (type->code () == TYPE_CODE_ARRAY
&& TYPE_VECTOR (type)
&& len >= 16)
structoffset = align_up (structoffset, 16);
sp + structoffset);
structoffset += len;
}
- else if (TYPE_CODE (type) == TYPE_CODE_INT)
+ else if (type->code () == TYPE_CODE_INT)
/* Sign or zero extend the "int" into a "word". */
store_unsigned_integer (word, tdep->wordsize, byte_order,
unpack_long (type, val));
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- gdb_assert (TYPE_CODE (valtype) == TYPE_CODE_DECFLOAT);
+ gdb_assert (valtype->code () == TYPE_CODE_DECFLOAT);
/* 32-bit and 64-bit decimal floats in f1. */
if (TYPE_LENGTH (valtype) <= 8)
gdb_assert (tdep->wordsize == 4);
- if (TYPE_CODE (type) == TYPE_CODE_FLT
+ if (type->code () == TYPE_CODE_FLT
&& TYPE_LENGTH (type) <= 8
&& !tdep->soft_float)
{
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
- if (TYPE_CODE (type) == TYPE_CODE_FLT
+ if (type->code () == TYPE_CODE_FLT
&& TYPE_LENGTH (type) == 16
&& !tdep->soft_float
&& (gdbarch_long_double_format (gdbarch)
return RETURN_VALUE_REGISTER_CONVENTION;
}
if (TYPE_LENGTH (type) == 16
- && ((TYPE_CODE (type) == TYPE_CODE_FLT
+ && ((type->code () == TYPE_CODE_FLT
&& (gdbarch_long_double_format (gdbarch)
== floatformats_ibm_long_double))
- || (TYPE_CODE (type) == TYPE_CODE_DECFLOAT && tdep->soft_float)))
+ || (type->code () == TYPE_CODE_DECFLOAT && tdep->soft_float)))
{
/* Soft-float IBM long double or _Decimal128 stored in r3, r4,
r5, r6. */
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
- if ((TYPE_CODE (type) == TYPE_CODE_INT && TYPE_LENGTH (type) == 8)
- || (TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8)
- || (TYPE_CODE (type) == TYPE_CODE_DECFLOAT && TYPE_LENGTH (type) == 8
+ if ((type->code () == TYPE_CODE_INT && TYPE_LENGTH (type) == 8)
+ || (type->code () == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8)
+ || (type->code () == TYPE_CODE_DECFLOAT && TYPE_LENGTH (type) == 8
&& tdep->soft_float))
{
if (readbuf)
}
return RETURN_VALUE_REGISTER_CONVENTION;
}
- if (TYPE_CODE (type) == TYPE_CODE_DECFLOAT && !tdep->soft_float)
+ if (type->code () == TYPE_CODE_DECFLOAT && !tdep->soft_float)
return get_decimal_float_return_value (gdbarch, type, regcache, readbuf,
writebuf);
- else if ((TYPE_CODE (type) == TYPE_CODE_INT
- || TYPE_CODE (type) == TYPE_CODE_CHAR
- || TYPE_CODE (type) == TYPE_CODE_BOOL
- || TYPE_CODE (type) == TYPE_CODE_PTR
+ else if ((type->code () == TYPE_CODE_INT
+ || type->code () == TYPE_CODE_CHAR
+ || type->code () == TYPE_CODE_BOOL
+ || type->code () == TYPE_CODE_PTR
|| TYPE_IS_REFERENCE (type)
- || TYPE_CODE (type) == TYPE_CODE_ENUM)
+ || type->code () == TYPE_CODE_ENUM)
&& TYPE_LENGTH (type) <= tdep->wordsize)
{
if (readbuf)
}
/* OpenCL vectors < 16 bytes are returned as distinct
scalars in f1..f2 or r3..r10. */
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY
+ if (type->code () == TYPE_CODE_ARRAY
&& TYPE_VECTOR (type)
&& TYPE_LENGTH (type) < 16
&& opencl_abi)
{
int offset = i * TYPE_LENGTH (eltype);
- if (TYPE_CODE (eltype) == TYPE_CODE_FLT)
+ if (eltype->code () == TYPE_CODE_FLT)
{
int regnum = tdep->ppc_fp0_regnum + 1 + i;
gdb_byte regval[PPC_MAX_REGISTER_SIZE];
return RETURN_VALUE_REGISTER_CONVENTION;
}
/* OpenCL vectors >= 16 bytes are returned in v2..v9. */
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY
+ if (type->code () == TYPE_CODE_ARRAY
&& TYPE_VECTOR (type)
&& TYPE_LENGTH (type) >= 16
&& opencl_abi)
return RETURN_VALUE_REGISTER_CONVENTION;
}
if (TYPE_LENGTH (type) == 16
- && TYPE_CODE (type) == TYPE_CODE_ARRAY
+ && type->code () == TYPE_CODE_ARRAY
&& TYPE_VECTOR (type)
&& tdep->vector_abi == POWERPC_VEC_ALTIVEC)
{
return RETURN_VALUE_REGISTER_CONVENTION;
}
if (TYPE_LENGTH (type) == 16
- && TYPE_CODE (type) == TYPE_CODE_ARRAY
+ && type->code () == TYPE_CODE_ARRAY
&& TYPE_VECTOR (type)
&& tdep->vector_abi == POWERPC_VEC_GENERIC)
{
return RETURN_VALUE_REGISTER_CONVENTION;
}
if (TYPE_LENGTH (type) == 8
- && TYPE_CODE (type) == TYPE_CODE_ARRAY
+ && type->code () == TYPE_CODE_ARRAY
&& TYPE_VECTOR (type)
&& tdep->vector_abi == POWERPC_VEC_SPE)
{
{
type = check_typedef (type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_FLT:
case TYPE_CODE_DECFLOAT:
if (!*field_type)
*field_type = type;
- if (TYPE_CODE (*field_type) == TYPE_CODE (type)
+ if ((*field_type)->code () == type->code ()
&& TYPE_LENGTH (*field_type) == TYPE_LENGTH (type))
return 1;
break;
case TYPE_CODE_COMPLEX:
type = TYPE_TARGET_TYPE (type);
- if (TYPE_CODE (type) == TYPE_CODE_FLT
- || TYPE_CODE (type) == TYPE_CODE_DECFLOAT)
+ if (type->code () == TYPE_CODE_FLT
+ || type->code () == TYPE_CODE_DECFLOAT)
{
if (!*field_type)
*field_type = type;
- if (TYPE_CODE (*field_type) == TYPE_CODE (type)
+ if ((*field_type)->code () == type->code ()
&& TYPE_LENGTH (*field_type) == TYPE_LENGTH (type))
return 2;
}
{
if (!*field_type)
*field_type = type;
- if (TYPE_CODE (*field_type) == TYPE_CODE (type)
+ if ((*field_type)->code () == type->code ()
&& TYPE_LENGTH (*field_type) == TYPE_LENGTH (type))
return 1;
}
if (sub_count == -1)
return -1;
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
count += sub_count;
else
count = std::max (count, sub_count);
{
/* Complex types at the top level are treated separately. However,
complex types can be elements of homogeneous aggregates. */
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION
- || (TYPE_CODE (type) == TYPE_CODE_ARRAY && !TYPE_VECTOR (type)))
+ if (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION
+ || (type->code () == TYPE_CODE_ARRAY && !TYPE_VECTOR (type)))
{
struct type *field_type = NULL;
LONGEST field_count = ppc64_aggregate_candidate (type, &field_type);
if (field_count > 0)
{
- int n_regs = ((TYPE_CODE (field_type) == TYPE_CODE_FLT
- || TYPE_CODE (field_type) == TYPE_CODE_DECFLOAT)?
+ int n_regs = ((field_type->code () == TYPE_CODE_FLT
+ || field_type->code () == TYPE_CODE_DECFLOAT)?
(TYPE_LENGTH (field_type) + 7) >> 3 : 1);
/* The ELFv2 ABI allows homogeneous aggregates to occupy
return;
if (TYPE_LENGTH (type) <= 8
- && TYPE_CODE (type) == TYPE_CODE_FLT)
+ && type->code () == TYPE_CODE_FLT)
{
/* Floats and doubles go in f1 .. f13. 32-bit floats are converted
to double first. */
argpos->freg++;
}
else if (TYPE_LENGTH (type) <= 8
- && TYPE_CODE (type) == TYPE_CODE_DECFLOAT)
+ && type->code () == TYPE_CODE_DECFLOAT)
{
/* Floats and doubles go in f1 .. f13. 32-bit decimal floats are
placed in the least significant word. */
argpos->freg++;
}
else if (TYPE_LENGTH (type) == 16
- && TYPE_CODE (type) == TYPE_CODE_FLT
+ && type->code () == TYPE_CODE_FLT
&& (gdbarch_long_double_format (gdbarch)
== floatformats_ibm_long_double))
{
argpos->freg += 2;
}
else if (TYPE_LENGTH (type) == 16
- && TYPE_CODE (type) == TYPE_CODE_DECFLOAT)
+ && type->code () == TYPE_CODE_DECFLOAT)
{
/* 128-bit decimal floating-point values are stored in and even/odd
pair of FPRs, with the even FPR holding the most significant half. */
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- if (TYPE_CODE (type) == TYPE_CODE_FLT
- || TYPE_CODE (type) == TYPE_CODE_DECFLOAT)
+ if (type->code () == TYPE_CODE_FLT
+ || type->code () == TYPE_CODE_DECFLOAT)
{
/* Floating-point scalars are passed in floating-point registers. */
ppc64_sysv_abi_push_val (gdbarch, val, TYPE_LENGTH (type), 0, argpos);
ppc64_sysv_abi_push_freg (gdbarch, type, val, argpos);
}
- else if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type)
+ else if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)
&& tdep->vector_abi == POWERPC_VEC_ALTIVEC
&& TYPE_LENGTH (type) == 16)
{
ppc64_sysv_abi_push_val (gdbarch, val, TYPE_LENGTH (type), 16, argpos);
ppc64_sysv_abi_push_vreg (gdbarch, val, argpos);
}
- else if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type)
+ else if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)
&& TYPE_LENGTH (type) >= 16)
{
/* Non-Altivec vectors are passed by reference. */
/* ... and pass a pointer to the copy as parameter. */
ppc64_sysv_abi_push_integer (gdbarch, addr, argpos);
}
- else if ((TYPE_CODE (type) == TYPE_CODE_INT
- || TYPE_CODE (type) == TYPE_CODE_ENUM
- || TYPE_CODE (type) == TYPE_CODE_BOOL
- || TYPE_CODE (type) == TYPE_CODE_CHAR
- || TYPE_CODE (type) == TYPE_CODE_PTR
+ else if ((type->code () == TYPE_CODE_INT
+ || type->code () == TYPE_CODE_ENUM
+ || type->code () == TYPE_CODE_BOOL
+ || type->code () == TYPE_CODE_CHAR
+ || type->code () == TYPE_CODE_PTR
|| TYPE_IS_REFERENCE (type))
&& TYPE_LENGTH (type) <= tdep->wordsize)
{
/* Convert any function code addresses into descriptors. */
if (tdep->elf_abi == POWERPC_ELF_V1
- && (TYPE_CODE (type) == TYPE_CODE_PTR
- || TYPE_CODE (type) == TYPE_CODE_REF))
+ && (type->code () == TYPE_CODE_PTR
+ || type->code () == TYPE_CODE_REF))
{
struct type *target_type
= check_typedef (TYPE_TARGET_TYPE (type));
- if (TYPE_CODE (target_type) == TYPE_CODE_FUNC
- || TYPE_CODE (target_type) == TYPE_CODE_METHOD)
+ if (target_type->code () == TYPE_CODE_FUNC
+ || target_type->code () == TYPE_CODE_METHOD)
{
CORE_ADDR desc = word;
/* The ABI (version 1.9) specifies that structs containing a
single floating-point value, at any level of nesting of
single-member structs, are passed in floating-point registers. */
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ if (type->code () == TYPE_CODE_STRUCT
&& TYPE_NFIELDS (type) == 1)
{
- while (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ while (type->code () == TYPE_CODE_STRUCT
&& TYPE_NFIELDS (type) == 1)
type = check_typedef (TYPE_FIELD_TYPE (type, 0));
- if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ if (type->code () == TYPE_CODE_FLT)
ppc64_sysv_abi_push_freg (gdbarch, type, val, argpos);
}
{
const gdb_byte *elval = val + i * TYPE_LENGTH (eltype);
- if (TYPE_CODE (eltype) == TYPE_CODE_FLT
- || TYPE_CODE (eltype) == TYPE_CODE_DECFLOAT)
+ if (eltype->code () == TYPE_CODE_FLT
+ || eltype->code () == TYPE_CODE_DECFLOAT)
ppc64_sysv_abi_push_freg (gdbarch, eltype, elval, argpos);
- else if (TYPE_CODE (eltype) == TYPE_CODE_ARRAY
+ else if (eltype->code () == TYPE_CODE_ARRAY
&& TYPE_VECTOR (eltype)
&& tdep->vector_abi == POWERPC_VEC_ALTIVEC
&& TYPE_LENGTH (eltype) == 16)
struct type *type = check_typedef (value_type (arg));
const bfd_byte *val = value_contents (arg);
- if (TYPE_CODE (type) == TYPE_CODE_COMPLEX)
+ if (type->code () == TYPE_CODE_COMPLEX)
{
/* Complex types are passed as if two independent scalars. */
struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type));
ppc64_sysv_abi_push_param (gdbarch, eltype,
val + TYPE_LENGTH (eltype), &argpos);
}
- else if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type)
+ else if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type)
&& opencl_abi)
{
/* OpenCL vectors shorter than 16 bytes are passed as if
struct type *ftype = check_typedef (value_type (function));
CORE_ADDR desc_addr = value_as_address (function);
- if (TYPE_CODE (ftype) == TYPE_CODE_PTR
+ if (ftype->code () == TYPE_CODE_PTR
|| convert_code_addr_to_desc_addr (func_addr, &desc_addr))
{
/* The TOC is the second double word in the descriptor. */
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* Integers live in GPRs starting at r3. */
- if ((TYPE_CODE (valtype) == TYPE_CODE_INT
- || TYPE_CODE (valtype) == TYPE_CODE_ENUM
- || TYPE_CODE (valtype) == TYPE_CODE_CHAR
- || TYPE_CODE (valtype) == TYPE_CODE_BOOL)
+ if ((valtype->code () == TYPE_CODE_INT
+ || valtype->code () == TYPE_CODE_ENUM
+ || valtype->code () == TYPE_CODE_CHAR
+ || valtype->code () == TYPE_CODE_BOOL)
&& TYPE_LENGTH (valtype) <= 8)
{
int regnum = tdep->ppc_gp0_regnum + 3 + index;
/* Floats and doubles go in f1 .. f13. 32-bit floats are converted
to double first. */
if (TYPE_LENGTH (valtype) <= 8
- && TYPE_CODE (valtype) == TYPE_CODE_FLT)
+ && valtype->code () == TYPE_CODE_FLT)
{
int regnum = tdep->ppc_fp0_regnum + 1 + index;
struct type *regtype = register_type (gdbarch, regnum);
/* Floats and doubles go in f1 .. f13. 32-bit decimal floats are
placed in the least significant word. */
if (TYPE_LENGTH (valtype) <= 8
- && TYPE_CODE (valtype) == TYPE_CODE_DECFLOAT)
+ && valtype->code () == TYPE_CODE_DECFLOAT)
{
int regnum = tdep->ppc_fp0_regnum + 1 + index;
int offset = 0;
/* IBM long double stored in two consecutive FPRs. */
if (TYPE_LENGTH (valtype) == 16
- && TYPE_CODE (valtype) == TYPE_CODE_FLT
+ && valtype->code () == TYPE_CODE_FLT
&& (gdbarch_long_double_format (gdbarch)
== floatformats_ibm_long_double))
{
/* 128-bit decimal floating-point values are stored in an even/odd
pair of FPRs, with the even FPR holding the most significant half. */
if (TYPE_LENGTH (valtype) == 16
- && TYPE_CODE (valtype) == TYPE_CODE_DECFLOAT)
+ && valtype->code () == TYPE_CODE_DECFLOAT)
{
int regnum = tdep->ppc_fp0_regnum + 2 + 2 * index;
int lopart = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG ? 8 : 0;
/* AltiVec vectors are returned in VRs starting at v2. */
if (TYPE_LENGTH (valtype) == 16
- && TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype)
+ && valtype->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype)
&& tdep->vector_abi == POWERPC_VEC_ALTIVEC)
{
int regnum = tdep->ppc_vr0_regnum + 2 + index;
/* Short vectors are returned in GPRs starting at r3. */
if (TYPE_LENGTH (valtype) <= 8
- && TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype))
+ && valtype->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype))
{
int regnum = tdep->ppc_gp0_regnum + 3 + index;
int offset = 0;
gdb_assert (ppc_floating_point_unit_p (gdbarch));
/* Complex types are returned as if two independent scalars. */
- if (TYPE_CODE (valtype) == TYPE_CODE_COMPLEX)
+ if (valtype->code () == TYPE_CODE_COMPLEX)
{
eltype = check_typedef (TYPE_TARGET_TYPE (valtype));
/* OpenCL vectors shorter than 16 bytes are returned as if
a series of independent scalars; OpenCL vectors 16 bytes
or longer are returned as if a series of AltiVec vectors. */
- if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype)
+ if (valtype->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype)
&& opencl_abi)
{
if (TYPE_LENGTH (valtype) < 16)
}
/* All pointers live in r3. */
- if (TYPE_CODE (valtype) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (valtype))
+ if (valtype->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (valtype))
{
int regnum = tdep->ppc_gp0_regnum + 3;
}
/* Small character arrays are returned, right justified, in r3. */
- if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY
+ if (valtype->code () == TYPE_CODE_ARRAY
&& !TYPE_VECTOR (valtype)
&& TYPE_LENGTH (valtype) <= 8
- && TYPE_CODE (TYPE_TARGET_TYPE (valtype)) == TYPE_CODE_INT
+ && TYPE_TARGET_TYPE (valtype)->code () == TYPE_CODE_INT
&& TYPE_LENGTH (TYPE_TARGET_TYPE (valtype)) == 1)
{
int regnum = tdep->ppc_gp0_regnum + 3;
aggregates are returned in registers. */
if (tdep->elf_abi == POWERPC_ELF_V2
&& ppc64_elfv2_abi_homogeneous_aggregate (valtype, &eltype, &nelt)
- && (TYPE_CODE (eltype) == TYPE_CODE_FLT
- || TYPE_CODE (eltype) == TYPE_CODE_DECFLOAT
- || (TYPE_CODE (eltype) == TYPE_CODE_ARRAY
+ && (eltype->code () == TYPE_CODE_FLT
+ || eltype->code () == TYPE_CODE_DECFLOAT
+ || (eltype->code () == TYPE_CODE_ARRAY
&& TYPE_VECTOR (eltype)
&& tdep->vector_abi == POWERPC_VEC_ALTIVEC
&& TYPE_LENGTH (eltype) == 16)))
returned in registers r3:r4. */
if (tdep->elf_abi == POWERPC_ELF_V2
&& TYPE_LENGTH (valtype) <= 16
- && (TYPE_CODE (valtype) == TYPE_CODE_STRUCT
- || TYPE_CODE (valtype) == TYPE_CODE_UNION
- || (TYPE_CODE (valtype) == TYPE_CODE_ARRAY
+ && (valtype->code () == TYPE_CODE_STRUCT
+ || valtype->code () == TYPE_CODE_UNION
+ || (valtype->code () == TYPE_CODE_ARRAY
&& !TYPE_VECTOR (valtype))))
{
int n_regs = ((TYPE_LENGTH (valtype) + tdep->wordsize - 1)
}
if (options->format == 0 || options->format == 's'
- || TYPE_CODE (type) == TYPE_CODE_REF
- || TYPE_CODE (type) == TYPE_CODE_ARRAY
- || TYPE_CODE (type) == TYPE_CODE_STRING
- || TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION
- || TYPE_CODE (type) == TYPE_CODE_NAMESPACE)
+ || type->code () == TYPE_CODE_REF
+ || type->code () == TYPE_CODE_ARRAY
+ || type->code () == TYPE_CODE_STRING
+ || type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION
+ || type->code () == TYPE_CODE_NAMESPACE)
value_print (val, stream, options);
else
/* User specified format, so don't look to the type to tell us
/* If the value is a pointer, and pointers and addresses are not the
same, then at this point, the value's length (in target bytes) is
gdbarch_addr_bit/TARGET_CHAR_BIT, not TYPE_LENGTH (type). */
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ if (type->code () == TYPE_CODE_PTR)
len = gdbarch_addr_bit (gdbarch) / TARGET_CHAR_BIT;
/* If we are printing it as unsigned, truncate it in case it is actually
range case, we want to avoid this, so we store the unpacked value
here for possible use later. */
gdb::optional<LONGEST> val_long;
- if ((TYPE_CODE (type) == TYPE_CODE_FLT
+ if ((type->code () == TYPE_CODE_FLT
&& (options->format == 'o'
|| options->format == 'x'
|| options->format == 't'
|| options->format == 'z'
|| options->format == 'd'
|| options->format == 'u'))
- || (TYPE_CODE (type) == TYPE_CODE_RANGE
+ || (type->code () == TYPE_CODE_RANGE
&& TYPE_RANGE_DATA (type)->bias != 0))
{
val_long.emplace (unpack_long (type, valaddr));
of a floating-point type of the same length, if that exists. Otherwise,
the data is printed as integer. */
char format = options->format;
- if (format == 'f' && TYPE_CODE (type) != TYPE_CODE_FLT)
+ if (format == 'f' && type->code () != TYPE_CODE_FLT)
{
type = float_type_from_length (type);
- if (TYPE_CODE (type) != TYPE_CODE_FLT)
+ if (type->code () != TYPE_CODE_FLT)
format = 0;
}
print_decimal_chars (stream, valaddr, len, false, byte_order);
break;
case 0:
- if (TYPE_CODE (type) != TYPE_CODE_FLT)
+ if (type->code () != TYPE_CODE_FLT)
{
print_decimal_chars (stream, valaddr, len, !TYPE_UNSIGNED (type),
byte_order);
val = access_value_history (0);
if (voidprint || (val && value_type (val) &&
- TYPE_CODE (value_type (val)) != TYPE_CODE_VOID))
+ value_type (val)->code () != TYPE_CODE_VOID))
print_value (val, print_opts);
}
val = coerce_ref (val);
/* In rvalue contexts, such as this, functions are coerced into
pointers to functions. This makes "x/i main" work. */
- if (/* last_format == 'i' && */
- TYPE_CODE (value_type (val)) == TYPE_CODE_FUNC
+ if (value_type (val)->code () == TYPE_CODE_FUNC
&& VALUE_LVAL (val) == lval_memory)
next_address = value_address (val);
else
{
const gdb_byte *str;
- if (TYPE_CODE (value_type (value)) != TYPE_CODE_PTR
+ if (value_type (value)->code () != TYPE_CODE_PTR
&& VALUE_LVAL (value) == lval_internalvar
&& c_is_string_type_p (value_type (value)))
{
In either case, the result of the conversion is a byte buffer
formatted in the target format for the target type. */
- if (TYPE_CODE (fmt_type) == TYPE_CODE_FLT)
+ if (fmt_type->code () == TYPE_CODE_FLT)
{
param_type = float_type_from_length (param_type);
if (param_type != value_type (value))
valtype = value_type (val_args[i]);
if (TYPE_LENGTH (valtype) != TYPE_LENGTH (wctype)
- || TYPE_CODE (valtype) != TYPE_CODE_INT)
+ || valtype->code () != TYPE_CODE_INT)
error (_("expected wchar_t argument for %%lc"));
bytes = value_contents (val_args[i]);
check_typedef (TYPE_TARGET_TYPE (SYMBOL_TYPE (function)));
/* Remember only non-void return types. */
- if (TYPE_CODE (ret_type) != TYPE_CODE_VOID)
+ if (ret_type->code () != TYPE_CODE_VOID)
{
struct value *func_value;
if (args_type == MI_PRINT_ALL_VALUES)
should_print = 1;
else if (args_type == MI_PRINT_SIMPLE_VALUES
- && TYPE_CODE (type) != TYPE_CODE_ARRAY
- && TYPE_CODE (type) != TYPE_CODE_STRUCT
- && TYPE_CODE (type) != TYPE_CODE_UNION)
+ && type->code () != TYPE_CODE_ARRAY
+ && type->code () != TYPE_CODE_STRUCT
+ && type->code () != TYPE_CODE_UNION)
should_print = 1;
}
else if (args_type != NO_VALUES)
gdb_assert (type != NULL);
realtype = check_typedef (type);
- switch (TYPE_CODE (realtype))
+ switch (realtype->code ())
{
case TYPE_CODE_PTR:
/* If a length is specified we need to convert this to an array
}
realtype = check_typedef (type);
- switch (TYPE_CODE (realtype))
+ switch (realtype->code ())
{
case TYPE_CODE_ARRAY:
{
gdb_assert (type != NULL);
realtype = check_typedef (type);
- switch (TYPE_CODE (realtype))
+ switch (realtype->code ())
{
case TYPE_CODE_PTR:
case TYPE_CODE_ARRAY:
{
struct type *type = ((type_object *) self)->type;
- return PyInt_FromLong (TYPE_CODE (type));
+ return PyInt_FromLong (type->code ());
}
/* Helper function for typy_fields which converts a single field to a
{
const char *attrstring;
- if (TYPE_CODE (type) == TYPE_CODE_ENUM)
+ if (type->code () == TYPE_CODE_ENUM)
{
arg.reset (gdb_py_long_from_longest (TYPE_FIELD_ENUMVAL (type,
field)));
if (PyObject_SetAttrString (result.get (), "artificial", arg.get ()) < 0)
return NULL;
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
arg = gdbpy_ref<>::new_reference (field < TYPE_N_BASECLASSES (type)
? Py_True : Py_False);
else
{
struct type *type = ((type_object *) self)->type;
- if (TYPE_CODE (type) != TYPE_CODE_ARRAY)
+ if (type->code () != TYPE_CODE_ARRAY)
return typy_fields_items (self, iter_values);
/* Array type. Handle this as a special case because the common
struct type *type = ((type_object *) self)->type;
const char *tagname = nullptr;
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION
- || TYPE_CODE (type) == TYPE_CODE_ENUM)
+ if (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION
+ || type->code () == TYPE_CODE_ENUM)
tagname = TYPE_NAME (type);
if (tagname == nullptr)
GDB_PY_HANDLE_EXCEPTION (except);
}
- if (TYPE_CODE (type) != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type))
+ if (type->code () != TYPE_CODE_PTR && !TYPE_IS_REFERENCE (type))
break;
type = TYPE_TARGET_TYPE (type);
}
/* If this is not a struct, union, or enum type, raise TypeError
exception. */
- if (TYPE_CODE (type) != TYPE_CODE_STRUCT
- && TYPE_CODE (type) != TYPE_CODE_UNION
- && TYPE_CODE (type) != TYPE_CODE_ENUM
- && TYPE_CODE (type) != TYPE_CODE_FUNC)
+ if (type->code () != TYPE_CODE_STRUCT
+ && type->code () != TYPE_CODE_UNION
+ && type->code () != TYPE_CODE_ENUM
+ && type->code () != TYPE_CODE_FUNC)
{
PyErr_SetString (PyExc_TypeError,
"Type is not a structure, union, enum, or function type.");
/* Initialize these to appease GCC warnings. */
LONGEST low = 0, high = 0;
- if (TYPE_CODE (type) != TYPE_CODE_ARRAY
- && TYPE_CODE (type) != TYPE_CODE_STRING
- && TYPE_CODE (type) != TYPE_CODE_RANGE)
+ if (type->code () != TYPE_CODE_ARRAY
+ && type->code () != TYPE_CODE_STRING
+ && type->code () != TYPE_CODE_RANGE)
{
PyErr_SetString (PyExc_RuntimeError,
_("This type does not have a range."));
return NULL;
}
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_ARRAY:
case TYPE_CODE_STRING:
scoped_value_mark free_values;
self_val = ((value_object *) self)->value;
- switch (TYPE_CODE (check_typedef (value_type (self_val))))
+ switch (check_typedef (value_type (self_val))->code ())
{
case TYPE_CODE_PTR:
res_val = value_ind (self_val);
type = value_type (val);
type = check_typedef (type);
- if (((TYPE_CODE (type) == TYPE_CODE_PTR) || TYPE_IS_REFERENCE (type))
- && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT))
+ if (((type->code () == TYPE_CODE_PTR) || TYPE_IS_REFERENCE (type))
+ && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRUCT))
{
struct value *target;
- int was_pointer = TYPE_CODE (type) == TYPE_CODE_PTR;
+ int was_pointer = type->code () == TYPE_CODE_PTR;
if (was_pointer)
target = value_ind (val);
type = lookup_lvalue_reference_type (type);
}
}
- else if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ else if (type->code () == TYPE_CODE_STRUCT)
type = value_rtti_type (val, NULL, NULL, NULL);
else
{
type = value_type (value);
realtype = check_typedef (type);
- switch (TYPE_CODE (realtype))
+ switch (realtype->code ())
{
case TYPE_CODE_ARRAY:
{
{
val_type = value_type (v);
val_type = check_typedef (val_type);
- if (TYPE_IS_REFERENCE (val_type) || TYPE_CODE (val_type) == TYPE_CODE_PTR)
+ if (TYPE_IS_REFERENCE (val_type) || val_type->code () == TYPE_CODE_PTR)
val_type = check_typedef (TYPE_TARGET_TYPE (val_type));
- type_code = TYPE_CODE (val_type);
+ type_code = val_type->code ();
if ((type_code == TYPE_CODE_STRUCT || type_code == TYPE_CODE_UNION)
&& types_equal (val_type, parent_type))
has_field = 1;
struct type *val_type;
val_type = check_typedef (value_type (tmp));
- if (TYPE_CODE (val_type) == TYPE_CODE_PTR)
+ if (val_type->code () == TYPE_CODE_PTR)
res_val = value_cast (lookup_pointer_type (base_class_type), tmp);
- else if (TYPE_CODE (val_type) == TYPE_CODE_REF)
+ else if (val_type->code () == TYPE_CODE_REF)
res_val = value_cast (lookup_lvalue_reference_type (base_class_type),
tmp);
- else if (TYPE_CODE (val_type) == TYPE_CODE_RVALUE_REF)
+ else if (val_type->code () == TYPE_CODE_RVALUE_REF)
res_val = value_cast (lookup_rvalue_reference_type (base_class_type),
tmp);
else
tmp = coerce_ref (tmp);
type = check_typedef (value_type (tmp));
- if (TYPE_CODE (type) != TYPE_CODE_ARRAY
- && TYPE_CODE (type) != TYPE_CODE_PTR)
+ if (type->code () != TYPE_CODE_ARRAY
+ && type->code () != TYPE_CODE_PTR)
error (_("Cannot subscript requested type."));
else
res_val = value_subscript (tmp, value_as_long (idx));
GDB_PY_HANDLE_EXCEPTION (except);
}
- if (TYPE_CODE (ftype) != TYPE_CODE_FUNC)
+ if (ftype->code () != TYPE_CODE_FUNC)
{
PyErr_SetString (PyExc_RuntimeError,
_("Value is not callable (not TYPE_CODE_FUNC)."));
rtype = STRIP_REFERENCE (rtype);
handled = 1;
- if (TYPE_CODE (ltype) == TYPE_CODE_PTR
+ if (ltype->code () == TYPE_CODE_PTR
&& is_integral_type (rtype))
res_val = value_ptradd (arg1, value_as_long (arg2));
- else if (TYPE_CODE (rtype) == TYPE_CODE_PTR
+ else if (rtype->code () == TYPE_CODE_PTR
&& is_integral_type (ltype))
res_val = value_ptradd (arg2, value_as_long (arg1));
else
rtype = STRIP_REFERENCE (rtype);
handled = 1;
- if (TYPE_CODE (ltype) == TYPE_CODE_PTR
- && TYPE_CODE (rtype) == TYPE_CODE_PTR)
+ if (ltype->code () == TYPE_CODE_PTR
+ && rtype->code () == TYPE_CODE_PTR)
/* A ptrdiff_t for the target would be preferable here. */
res_val = value_from_longest (builtin_type_pyint,
value_ptrdiff (arg1, arg2));
- else if (TYPE_CODE (ltype) == TYPE_CODE_PTR
+ else if (ltype->code () == TYPE_CODE_PTR
&& is_integral_type (rtype))
res_val = value_ptradd (arg1, - value_as_long (arg2));
else
{
type = check_typedef (value_type (self_value->value));
- if (is_integral_type (type) || TYPE_CODE (type) == TYPE_CODE_PTR)
+ if (is_integral_type (type) || type->code () == TYPE_CODE_PTR)
nonzero = !!value_as_long (self_value->value);
else if (is_floating_value (self_value->value))
nonzero = !target_float_is_zero (value_contents (self_value->value),
}
if (!is_integral_type (type)
- && TYPE_CODE (type) != TYPE_CODE_PTR)
+ && type->code () != TYPE_CODE_PTR)
error (_("Cannot convert value to int."));
l = value_as_long (value);
type = check_typedef (type);
if (!is_integral_type (type)
- && TYPE_CODE (type) != TYPE_CODE_PTR)
+ && type->code () != TYPE_CODE_PTR)
error (_("Cannot convert value to long."));
l = value_as_long (value);
{
type = check_typedef (type);
- if (TYPE_CODE (type) == TYPE_CODE_FLT && is_floating_value (value))
+ if (type->code () == TYPE_CODE_FLT && is_floating_value (value))
d = target_float_to_host_double (value_contents (value), type);
- else if (TYPE_CODE (type) == TYPE_CODE_INT)
+ else if (type->code () == TYPE_CODE_INT)
{
/* Note that valpy_long accepts TYPE_CODE_PTR and some
others here here -- but casting a pointer or bool to a
if (var != NULL)
{
res_val = value_of_internalvar (python_gdbarch, var);
- if (TYPE_CODE (value_type (res_val)) == TYPE_CODE_VOID)
+ if (value_type (res_val)->code () == TYPE_CODE_VOID)
res_val = NULL;
}
}
obj_type = check_typedef (value_type (obj));
this_type = check_typedef (type_object_to_type (m_this_type));
- if (TYPE_CODE (obj_type) == TYPE_CODE_PTR)
+ if (obj_type->code () == TYPE_CODE_PTR)
{
struct type *this_ptr = lookup_pointer_type (this_type);
else if (TYPE_IS_REFERENCE (obj_type))
{
struct type *this_ref
- = lookup_reference_type (this_type, TYPE_CODE (obj_type));
+ = lookup_reference_type (this_type, obj_type->code ());
if (!types_equal (obj_type, this_ref))
obj = value_cast (this_ref, obj);
obj_type = check_typedef (value_type (obj));
this_type = check_typedef (type_object_to_type (m_this_type));
- if (TYPE_CODE (obj_type) == TYPE_CODE_PTR)
+ if (obj_type->code () == TYPE_CODE_PTR)
{
struct type *this_ptr = lookup_pointer_type (this_type);
else if (TYPE_IS_REFERENCE (obj_type))
{
struct type *this_ref
- = lookup_reference_type (this_type, TYPE_CODE (obj_type));
+ = lookup_reference_type (this_type, obj_type->code ());
if (!types_equal (obj_type, this_ref))
obj = value_cast (this_ref, obj);
/* Lay out the register cache.
- NOTE: cagney/2002-05-22: Only register_type() is used when
+ NOTE: cagney/2002-05-22: Only register_type () is used when
constructing the register cache. It is assumed that the
register's raw size, virtual size and type length are all the
same. */
std::vector<gdb_byte> buf (register_size (gdbarch, regnum), 0);
const auto type = register_type (gdbarch, regnum);
- if (TYPE_CODE (type) == TYPE_CODE_FLT
- || TYPE_CODE (type) == TYPE_CODE_DECFLOAT)
+ if (type->code () == TYPE_CODE_FLT
+ || type->code () == TYPE_CODE_DECFLOAT)
{
/* Generate valid float format. */
target_float_from_string (expected.data (), type, "1.25");
}
- else if (TYPE_CODE (type) == TYPE_CODE_INT
- || TYPE_CODE (type) == TYPE_CODE_ARRAY
- || TYPE_CODE (type) == TYPE_CODE_PTR
- || TYPE_CODE (type) == TYPE_CODE_UNION
- || TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ else if (type->code () == TYPE_CODE_INT
+ || type->code () == TYPE_CODE_ARRAY
+ || type->code () == TYPE_CODE_PTR
+ || type->code () == TYPE_CODE_UNION
+ || type->code () == TYPE_CODE_STRUCT)
{
if (bfd_arch == bfd_arch_ia64
|| (regnum >= gdbarch_num_regs (gdbarch)
expected[j] = j;
}
}
- else if (TYPE_CODE (type) == TYPE_CODE_FLAGS)
+ else if (type->code () == TYPE_CODE_FLAGS)
{
/* No idea how to test flags. */
continue;
if (group == all_reggroup)
return 1;
vector_p = TYPE_VECTOR (register_type (gdbarch, regnum));
- float_p = (TYPE_CODE (register_type (gdbarch, regnum)) == TYPE_CODE_FLT
- || (TYPE_CODE (register_type (gdbarch, regnum))
+ float_p = (register_type (gdbarch, regnum)->code () == TYPE_CODE_FLT
+ || (register_type (gdbarch, regnum)->code ()
== TYPE_CODE_DECFLOAT));
raw_p = regnum < gdbarch_num_regs (gdbarch);
if (group == float_reggroup)
present the registers using a union type. */
int flen = riscv_isa_flen (gdbarch);
if (flen == 8
- && TYPE_CODE (type) == TYPE_CODE_FLT
+ && type->code () == TYPE_CODE_FLT
&& TYPE_LENGTH (type) == flen
&& (strcmp (TYPE_NAME (type), "builtin_type_ieee_double") == 0
|| strcmp (TYPE_NAME (type), "double") == 0))
|| regnum == RISCV_SP_REGNUM
|| regnum == RISCV_GP_REGNUM
|| regnum == RISCV_TP_REGNUM)
- && TYPE_CODE (type) == TYPE_CODE_INT
+ && type->code () == TYPE_CODE_INT
&& TYPE_LENGTH (type) == xlen)
{
/* This spots the case where some interesting registers are defined
print_raw_format = (value_entirely_available (val)
&& !value_optimized_out (val));
- if (TYPE_CODE (regtype) == TYPE_CODE_FLT
- || (TYPE_CODE (regtype) == TYPE_CODE_UNION
+ if (regtype->code () == TYPE_CODE_FLT
+ || (regtype->code () == TYPE_CODE_UNION
&& TYPE_NFIELDS (regtype) == 2
- && TYPE_CODE (TYPE_FIELD_TYPE (regtype, 0)) == TYPE_CODE_FLT
- && TYPE_CODE (TYPE_FIELD_TYPE (regtype, 1)) == TYPE_CODE_FLT)
- || (TYPE_CODE (regtype) == TYPE_CODE_UNION
+ && TYPE_FIELD_TYPE (regtype, 0)->code () == TYPE_CODE_FLT
+ && TYPE_FIELD_TYPE (regtype, 1)->code () == TYPE_CODE_FLT)
+ || (regtype->code () == TYPE_CODE_UNION
&& TYPE_NFIELDS (regtype) == 3
- && TYPE_CODE (TYPE_FIELD_TYPE (regtype, 0)) == TYPE_CODE_FLT
- && TYPE_CODE (TYPE_FIELD_TYPE (regtype, 1)) == TYPE_CODE_FLT
- && TYPE_CODE (TYPE_FIELD_TYPE (regtype, 2)) == TYPE_CODE_FLT))
+ && TYPE_FIELD_TYPE (regtype, 0)->code () == TYPE_CODE_FLT
+ && TYPE_FIELD_TYPE (regtype, 1)->code () == TYPE_CODE_FLT
+ && TYPE_FIELD_TYPE (regtype, 2)->code () == TYPE_CODE_FLT))
{
struct value_print_options opts;
const gdb_byte *valaddr = value_contents_for_printing (val);
riscv_type_align (gdbarch *gdbarch, type *type)
{
type = check_typedef (type);
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type))
+ if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type))
return std::min (TYPE_LENGTH (type), (ULONGEST) BIGGEST_ALIGNMENT);
/* Anything else will be aligned by the generic code. */
int field_offset
= offset + TYPE_FIELD_BITPOS (type, i) / TARGET_CHAR_BIT;
- switch (TYPE_CODE (field_type))
+ switch (field_type->code ())
{
case TYPE_CODE_STRUCT:
analyse_inner (field_type, field_offset);
sinfo.analyse (ainfo->type);
if (sinfo.number_of_fields () == 1
- && TYPE_CODE (sinfo.field_type (0)) == TYPE_CODE_COMPLEX)
+ && sinfo.field_type(0)->code () == TYPE_CODE_COMPLEX)
{
/* The following is similar to RISCV_CALL_ARG_COMPLEX_FLOAT,
except we use the type of the complex field instead of the
}
if (sinfo.number_of_fields () == 1
- && TYPE_CODE (sinfo.field_type (0)) == TYPE_CODE_FLT)
+ && sinfo.field_type(0)->code () == TYPE_CODE_FLT)
{
/* The following is similar to RISCV_CALL_ARG_SCALAR_FLOAT,
except we use the type of the first scalar field instead of
}
if (sinfo.number_of_fields () == 2
- && TYPE_CODE (sinfo.field_type (0)) == TYPE_CODE_FLT
+ && sinfo.field_type(0)->code () == TYPE_CODE_FLT
&& TYPE_LENGTH (sinfo.field_type (0)) <= cinfo->flen
- && TYPE_CODE (sinfo.field_type (1)) == TYPE_CODE_FLT
+ && sinfo.field_type(1)->code () == TYPE_CODE_FLT
&& TYPE_LENGTH (sinfo.field_type (1)) <= cinfo->flen
&& riscv_arg_regs_available (&cinfo->float_regs) >= 2)
{
if (sinfo.number_of_fields () == 2
&& riscv_arg_regs_available (&cinfo->int_regs) >= 1
- && (TYPE_CODE (sinfo.field_type (0)) == TYPE_CODE_FLT
+ && (sinfo.field_type(0)->code () == TYPE_CODE_FLT
&& TYPE_LENGTH (sinfo.field_type (0)) <= cinfo->flen
&& is_integral_type (sinfo.field_type (1))
&& TYPE_LENGTH (sinfo.field_type (1)) <= cinfo->xlen))
&& riscv_arg_regs_available (&cinfo->int_regs) >= 1
&& (is_integral_type (sinfo.field_type (0))
&& TYPE_LENGTH (sinfo.field_type (0)) <= cinfo->xlen
- && TYPE_CODE (sinfo.field_type (1)) == TYPE_CODE_FLT
+ && sinfo.field_type(1)->code () == TYPE_CODE_FLT
&& TYPE_LENGTH (sinfo.field_type (1)) <= cinfo->flen))
{
int len0 = TYPE_LENGTH (sinfo.field_type (0));
ainfo->argloc[0].c_length = 0;
ainfo->argloc[1].c_length = 0;
- switch (TYPE_CODE (ainfo->type))
+ switch (ainfo->type->code ())
{
case TYPE_CODE_INT:
case TYPE_CODE_BOOL:
struct type *ftype = check_typedef (value_type (function));
- if (TYPE_CODE (ftype) == TYPE_CODE_PTR)
+ if (ftype->code () == TYPE_CODE_PTR)
ftype = check_typedef (TYPE_TARGET_TYPE (ftype));
/* We'll use register $a0 if we're returning a struct. */
= extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
/* Is it a code address? */
- if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
- || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD
+ if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_FUNC
+ || TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_METHOD
|| TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type))
|| TYPE_LENGTH (type) == 4)
return rl78_make_instruction_address (addr);
type = check_typedef (value_type (arg));
len = TYPE_LENGTH (type);
- if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ if (type->code () == TYPE_CODE_FLT)
{
/* Floating point arguments are passed in fpr's, as well as gpr's.
There are 13 fpr's reserved for passing parameters. At this point
/* Float types should be passed in fpr's, as well as in the
stack. */
- if (TYPE_CODE (type) == TYPE_CODE_FLT && f_argno < 13)
+ if (type->code () == TYPE_CODE_FLT && f_argno < 13)
{
gdb_assert (len <= 8);
/* AltiVec extension: Functions that declare a vector data type as a
return value place that return value in VR2. */
- if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype)
+ if (valtype->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype)
&& TYPE_LENGTH (valtype) == 16)
{
if (readbuf)
allocated buffer into which the callee is assumed to store its
return value. All explicit parameters are appropriately
relabeled. */
- if (TYPE_CODE (valtype) == TYPE_CODE_STRUCT
- || TYPE_CODE (valtype) == TYPE_CODE_UNION
- || TYPE_CODE (valtype) == TYPE_CODE_ARRAY)
+ if (valtype->code () == TYPE_CODE_STRUCT
+ || valtype->code () == TYPE_CODE_UNION
+ || valtype->code () == TYPE_CODE_ARRAY)
return RETURN_VALUE_STRUCT_CONVENTION;
/* Scalar floating-point values are returned in FPR1 for float or
double, and in FPR1:FPR2 for quadword precision. Fortran
complex*8 and complex*16 are returned in FPR1:FPR2, and
complex*32 is returned in FPR1:FPR4. */
- if (TYPE_CODE (valtype) == TYPE_CODE_FLT
+ if (valtype->code () == TYPE_CODE_FLT
&& (TYPE_LENGTH (valtype) == 4 || TYPE_LENGTH (valtype) == 8))
{
struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum);
if (TYPE_LENGTH (valtype) == 8)
{
- gdb_assert (TYPE_CODE (valtype) != TYPE_CODE_FLT);
+ gdb_assert (valtype->code () != TYPE_CODE_FLT);
gdb_assert (tdep->wordsize == 4);
if (readbuf)
type = check_typedef (value_type (arg));
len = TYPE_LENGTH (type);
- if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ if (type->code () == TYPE_CODE_FLT)
{
/* Floating point arguments are passed in fpr's, as well as gpr's.
/* Float types should be passed in fpr's, as well as in the
stack. */
- if (TYPE_CODE (type) == TYPE_CODE_FLT && f_argno < 13)
+ if (type->code () == TYPE_CODE_FLT && f_argno < 13)
{
gdb_assert (len <= 8);
/* AltiVec extension: Functions that declare a vector data type as a
return value place that return value in VR2. */
- if (TYPE_CODE (valtype) == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype)
+ if (valtype->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (valtype)
&& TYPE_LENGTH (valtype) == 16)
{
if (readbuf)
allocated buffer into which the callee is assumed to store its
return value. All explicit parameters are appropriately
relabeled. */
- if (TYPE_CODE (valtype) == TYPE_CODE_STRUCT
- || TYPE_CODE (valtype) == TYPE_CODE_UNION
- || TYPE_CODE (valtype) == TYPE_CODE_ARRAY)
+ if (valtype->code () == TYPE_CODE_STRUCT
+ || valtype->code () == TYPE_CODE_UNION
+ || valtype->code () == TYPE_CODE_ARRAY)
return RETURN_VALUE_STRUCT_CONVENTION;
/* Scalar floating-point values are returned in FPR1 for float or
double, and in FPR1:FPR2 for quadword precision. Fortran
complex*8 and complex*16 are returned in FPR1:FPR2, and
complex*32 is returned in FPR1:FPR4. */
- if (TYPE_CODE (valtype) == TYPE_CODE_FLT
+ if (valtype->code () == TYPE_CODE_FLT
&& (TYPE_LENGTH (valtype) == 4 || TYPE_LENGTH (valtype) == 8))
{
struct type *regtype = register_type (gdbarch, tdep->ppc_fp0_regnum);
if (TYPE_LENGTH (valtype) == 8)
{
- gdb_assert (TYPE_CODE (valtype) != TYPE_CODE_FLT);
+ gdb_assert (valtype->code () != TYPE_CODE_FLT);
gdb_assert (tdep->wordsize == 4);
if (readbuf)
return (tdep->ppc_fp0_regnum >= 0
&& regnum >= tdep->ppc_fp0_regnum
&& regnum < tdep->ppc_fp0_regnum + ppc_num_fprs
- && TYPE_CODE (type) == TYPE_CODE_FLT
+ && type->code () == TYPE_CODE_FLT
&& TYPE_LENGTH (type)
!= TYPE_LENGTH (builtin_type (gdbarch)->builtin_double));
}
struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte from[PPC_MAX_REGISTER_SIZE];
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
+ gdb_assert (type->code () == TYPE_CODE_FLT);
if (!get_frame_register_bytes (frame, regnum, 0,
register_size (gdbarch, regnum),
struct gdbarch *gdbarch = get_frame_arch (frame);
gdb_byte to[PPC_MAX_REGISTER_SIZE];
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
+ gdb_assert (type->code () == TYPE_CODE_FLT);
target_float_convert (from, type,
to, builtin_type (gdbarch)->builtin_double);
call expression. */
rust_op_vector *params = operation->right.params;
- if (TYPE_CODE (type) != TYPE_CODE_NAMESPACE)
+ if (type->code () != TYPE_CODE_NAMESPACE)
{
if (!rust_tuple_struct_type_p (type))
error (_("Type %s is not a tuple struct"), varname);
error (_("No symbol '%s' in current context"), varname);
if (!want_type
- && TYPE_CODE (type) == TYPE_CODE_STRUCT
+ && type->code () == TYPE_CODE_STRUCT
&& TYPE_NFIELDS (type) == 0)
{
/* A unit-like struct. */
if (type == NULL)
error (_("Could not find type '%s'"), operation->left.sval.ptr);
- if (TYPE_CODE (type) != TYPE_CODE_STRUCT
+ if (type->code () != TYPE_CODE_STRUCT
|| rust_tuple_type_p (type)
|| rust_tuple_struct_type_p (type))
error (_("Struct expression applied to non-struct type"));
/* The current implementation is a bit of a hack, but there's
nothing else in the debuginfo to distinguish a tuple from a
struct. */
- return (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ return (type->code () == TYPE_CODE_STRUCT
&& TYPE_NAME (type) != NULL
&& TYPE_NAME (type)[0] == '(');
}
field_number = 0;
- if (TYPE_CODE (type) != TYPE_CODE_STRUCT)
+ if (type->code () != TYPE_CODE_STRUCT)
return false;
for (i = 0; i < TYPE_NFIELDS (type); ++i)
{
static bool
rust_slice_type_p (struct type *type)
{
- return (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ return (type->code () == TYPE_CODE_STRUCT
&& TYPE_NAME (type) != NULL
&& (strncmp (TYPE_NAME (type), "&[", 2) == 0
|| strcmp (TYPE_NAME (type), "&str") == 0));
{
int i;
- if (TYPE_CODE (type) != TYPE_CODE_STRUCT
+ if (type->code () != TYPE_CODE_STRUCT
|| TYPE_NFIELDS (type) > 2
|| TYPE_NAME (type) == NULL
|| strstr (TYPE_NAME (type), "::Range") == NULL)
static bool
rust_u8_type_p (struct type *type)
{
- return (TYPE_CODE (type) == TYPE_CODE_INT
+ return (type->code () == TYPE_CODE_INT
&& TYPE_UNSIGNED (type)
&& TYPE_LENGTH (type) == 1);
}
static bool
rust_chartype_p (struct type *type)
{
- return (TYPE_CODE (type) == TYPE_CODE_CHAR
+ return (type->code () == TYPE_CODE_CHAR
&& TYPE_LENGTH (type) == 4
&& TYPE_UNSIGNED (type));
}
LONGEST low_bound, high_bound;
type = check_typedef (type);
- return ((TYPE_CODE (type) == TYPE_CODE_STRING)
- || (TYPE_CODE (type) == TYPE_CODE_PTR
- && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY
+ return ((type->code () == TYPE_CODE_STRING)
+ || (type->code () == TYPE_CODE_PTR
+ && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ARRAY
&& rust_u8_type_p (TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (type)))
&& get_array_bounds (TYPE_TARGET_TYPE (type), &low_bound,
&high_bound)))
- || (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ || (type->code () == TYPE_CODE_STRUCT
&& !rust_enum_p (type)
&& rust_slice_type_p (type)
&& strcmp (TYPE_NAME (type), "&str") == 0));
{
struct type *type = check_typedef (value_type (value));
- if (TYPE_CODE (type) != TYPE_CODE_STRUCT || TYPE_NFIELDS (type) != 2)
+ if (type->code () != TYPE_CODE_STRUCT || TYPE_NFIELDS (type) != 2)
return NULL;
/* Try to be a bit resilient if the ABI changes. */
? Val_prettyformat : Val_no_prettyformat);
struct type *type = check_typedef (value_type (val));
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_PTR:
{
LONGEST low_bound, high_bound;
- if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ARRAY
+ if (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_ARRAY
&& rust_u8_type_p (TYPE_TARGET_TYPE (TYPE_TARGET_TYPE (type)))
&& get_array_bounds (TYPE_TARGET_TYPE (type), &low_bound,
&high_bound))
if (prop != nullptr && prop->kind == PROP_TYPE)
type = prop->data.original_type;
}
- else if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ else if (type->code () == TYPE_CODE_STRUCT)
fputs_filtered ("struct ", stream);
else
fputs_filtered ("union ", stream);
{
/* Rust calls the unit type "void" in its debuginfo,
but we don't want to print it as that. */
- if (TYPE_CODE (type) == TYPE_CODE_VOID)
+ if (type->code () == TYPE_CODE_VOID)
fputs_filtered ("()", stream);
else
fputs_filtered (TYPE_NAME (type), stream);
}
type = check_typedef (type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_VOID:
/* If we have an enum, we've already printed the type's
}
fputs_filtered (")", stream);
/* If it returns unit, we can omit the return type. */
- if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
+ if (TYPE_TARGET_TYPE (type)->code () != TYPE_CODE_VOID)
{
fputs_filtered (" -> ", stream);
rust_internal_print_type (TYPE_TARGET_TYPE (type), "", stream,
args[0] = arg0;
/* We don't yet implement real Deref semantics. */
- while (TYPE_CODE (value_type (args[0])) == TYPE_CODE_PTR)
+ while (value_type (args[0])->code () == TYPE_CODE_PTR)
args[0] = value_ind (args[0]);
type = value_type (args[0]);
- if ((TYPE_CODE (type) != TYPE_CODE_STRUCT
- && TYPE_CODE (type) != TYPE_CODE_UNION
- && TYPE_CODE (type) != TYPE_CODE_ENUM)
+ if ((type->code () != TYPE_CODE_STRUCT
+ && type->code () != TYPE_CODE_UNION
+ && type->code () != TYPE_CODE_ENUM)
|| rust_tuple_type_p (type))
error (_("Method calls only supported on struct or enum types"));
if (TYPE_NAME (type) == NULL)
if (TYPE_NFIELDS (fn_type) == 0)
error (_("Function '%s' takes no arguments"), name.c_str ());
- if (TYPE_CODE (TYPE_FIELD_TYPE (fn_type, 0)) == TYPE_CODE_PTR)
+ if (TYPE_FIELD_TYPE (fn_type, 0)->code () == TYPE_CODE_PTR)
args[0] = value_addr (args[0]);
function = address_of_variable (sym.symbol, block);
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
struct type *base_type = nullptr;
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ if (type->code () == TYPE_CODE_ARRAY)
base_type = TYPE_TARGET_TYPE (type);
else if (rust_slice_type_p (type))
{
if (base_type == nullptr)
error (_("Could not find 'data_ptr' in slice type"));
}
- else if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ else if (type->code () == TYPE_CODE_PTR)
base_type = TYPE_TARGET_TYPE (type);
else
error (_("Cannot subscript non-array type"));
LONGEST low_bound;
struct value *base;
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ if (type->code () == TYPE_CODE_ARRAY)
{
base = lhs;
if (!get_array_bounds (type, &low_bound, &high_bound))
low_bound = 0;
high_bound = value_as_long (len);
}
- else if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ else if (type->code () == TYPE_CODE_PTR)
{
base = lhs;
low_bound = 0;
/* Preserving the type is enough. */
return value;
}
- if (TYPE_CODE (value_type (value)) == TYPE_CODE_BOOL)
+ if (value_type (value)->code () == TYPE_CODE_BOOL)
result = value_from_longest (value_type (value),
value_logical_not (value));
else
type = value_type (lhs);
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ if (type->code () == TYPE_CODE_STRUCT)
{
struct type *outer_type = NULL;
const char *field_name = &exp->elts[pc + 2].string;
type = value_type (lhs);
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT && rust_enum_p (type))
+ if (type->code () == TYPE_CODE_STRUCT && rust_enum_p (type))
{
gdb::array_view<const gdb_byte> view (value_contents (lhs),
TYPE_LENGTH (type));
struct type *func_type = value_type (function);
/* Dereference function pointer types. */
- while (TYPE_CODE (func_type) == TYPE_CODE_PTR)
+ while (func_type->code () == TYPE_CODE_PTR)
func_type = TYPE_TARGET_TYPE (func_type);
/* The end result had better be a function or a method. */
- gdb_assert (TYPE_CODE (func_type) == TYPE_CODE_FUNC
- || TYPE_CODE (func_type) == TYPE_CODE_METHOD);
+ gdb_assert (func_type->code () == TYPE_CODE_FUNC
+ || func_type->code () == TYPE_CODE_METHOD);
/* Functions with a variable number of arguments have all of their
variable arguments and the last non-variable argument passed
{
struct type *return_type = TYPE_TARGET_TYPE (func_type);
- gdb_assert (TYPE_CODE (return_type) == TYPE_CODE_STRUCT
- || TYPE_CODE (func_type) == TYPE_CODE_UNION);
+ gdb_assert (return_type->code () == TYPE_CODE_STRUCT
+ || func_type->code () == TYPE_CODE_UNION);
if (TYPE_LENGTH (return_type) > 16
|| TYPE_LENGTH (return_type) % 4 != 0)
if (i == 0 && struct_addr != 0
&& return_method != return_method_struct
- && TYPE_CODE (arg_type) == TYPE_CODE_PTR
+ && arg_type->code () == TYPE_CODE_PTR
&& extract_unsigned_integer (arg_bits, 4,
byte_order) == struct_addr)
{
regcache_cooked_write_unsigned (regcache, RX_R15_REGNUM,
struct_addr);
}
- else if (TYPE_CODE (arg_type) != TYPE_CODE_STRUCT
- && TYPE_CODE (arg_type) != TYPE_CODE_UNION
+ else if (arg_type->code () != TYPE_CODE_STRUCT
+ && arg_type->code () != TYPE_CODE_UNION
&& arg_size <= 8)
{
/* Argument is a scalar. */
ULONGEST valtype_len = TYPE_LENGTH (valtype);
if (TYPE_LENGTH (valtype) > 16
- || ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT
- || TYPE_CODE (valtype) == TYPE_CODE_UNION)
+ || ((valtype->code () == TYPE_CODE_STRUCT
+ || valtype->code () == TYPE_CODE_UNION)
&& TYPE_LENGTH (valtype) % 4 != 0))
return RETURN_VALUE_STRUCT_CONVENTION;
struct type *type, struct regcache *regcache,
gdb_byte *readbuf, const gdb_byte *writebuf)
{
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION
- || TYPE_CODE (type) == TYPE_CODE_ARRAY
+ if (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION
+ || type->code () == TYPE_CODE_ARRAY
|| TYPE_LENGTH (type) > 4)
return RETURN_VALUE_STRUCT_CONVENTION;
if (TYPE_LENGTH (t) > 8)
{
- switch (TYPE_CODE (t))
+ switch (t->code ())
{
case TYPE_CODE_INT:
case TYPE_CODE_RANGE:
static struct type *
s390_effective_inner_type (struct type *type, unsigned int min_size)
{
- while (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ while (type->code () == TYPE_CODE_STRUCT)
{
struct type *inner = NULL;
or double. */
type = s390_effective_inner_type (type, 0);
- return (TYPE_CODE (type) == TYPE_CODE_FLT
- || TYPE_CODE (type) == TYPE_CODE_DECFLOAT);
+ return (type->code () == TYPE_CODE_FLT
+ || type->code () == TYPE_CODE_DECFLOAT);
}
/* Return non-zero if TYPE should be passed like a vector. */
/* Structs containing just a vector are passed like a vector. */
type = s390_effective_inner_type (type, TYPE_LENGTH (type));
- return TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type);
+ return type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type);
}
/* Determine whether N is a power of two. */
static int
s390_function_arg_integer (struct type *type)
{
- enum type_code code = TYPE_CODE (type);
+ enum type_code code = type->code ();
if (TYPE_LENGTH (type) > 8)
return 0;
CORE_ADDR param_area_start, new_sp;
struct type *ftype = check_typedef (value_type (function));
- if (TYPE_CODE (ftype) == TYPE_CODE_PTR)
+ if (ftype->code () == TYPE_CODE_PTR)
ftype = check_typedef (TYPE_TARGET_TYPE (ftype));
arg_prep.copy = sp;
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int word_size = gdbarch_ptr_bit (gdbarch) / 8;
int length = TYPE_LENGTH (type);
- int code = TYPE_CODE (type);
+ int code = type->code ();
if (code == TYPE_CODE_FLT || code == TYPE_CODE_DECFLOAT)
{
type = check_typedef (type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
struct type *type, struct regcache *regcache,
gdb_byte * readbuf, const gdb_byte * writebuf)
{
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION
- || TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ if (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION
+ || type->code () == TYPE_CODE_ARRAY)
return RETURN_VALUE_STRUCT_CONVENTION;
else
{
static int
score_type_needs_double_align (struct type *type)
{
- enum type_code typecode = TYPE_CODE (type);
+ enum type_code typecode = type->code ();
if ((typecode == TYPE_CODE_INT && TYPE_LENGTH (type) == 8)
|| (typecode == TYPE_CODE_FLT && TYPE_LENGTH (type) == 8))
{
struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg));
- enum type_code typecode = TYPE_CODE (arg_type);
+ enum type_code typecode = arg_type->code ();
const gdb_byte *val = value_contents (arg);
int downward_offset = 0;
int arg_last_part_p = 0;
{
func_type = check_typedef (func_type);
- if (TYPE_CODE (func_type) == TYPE_CODE_PTR)
+ if (func_type->code () == TYPE_CODE_PTR)
func_type = check_typedef (TYPE_TARGET_TYPE (func_type));
- if (TYPE_CODE (func_type) == TYPE_CODE_FUNC
+ if (func_type->code () == TYPE_CODE_FUNC
&& TYPE_CALLING_CONVENTION (func_type) == DW_CC_GNU_renesas_sh)
val = 1;
}
int nelem = TYPE_NFIELDS (type);
/* The Renesas ABI returns aggregate types always on stack. */
- if (renesas_abi && (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION))
+ if (renesas_abi && (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION))
return 1;
/* Non-power of 2 length types and types bigger than 8 bytes (which don't
sh_treat_as_flt_p (struct type *type)
{
/* Ordinary float types are obviously treated as float. */
- if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ if (type->code () == TYPE_CODE_FLT)
return 1;
/* Otherwise non-struct types are not treated as float. */
- if (TYPE_CODE (type) != TYPE_CODE_STRUCT)
+ if (type->code () != TYPE_CODE_STRUCT)
return 0;
/* Otherwise structs with more than one member are not treated as float. */
if (TYPE_NFIELDS (type) != 1)
return 0;
/* Otherwise if the type of that member is float, the whole type is
treated as float. */
- if (TYPE_CODE (TYPE_FIELD_TYPE (type, 0)) == TYPE_CODE_FLT)
+ if (TYPE_FIELD_TYPE (type, 0)->code () == TYPE_CODE_FLT)
return 1;
/* Otherwise it's not treated as float. */
return 0;
/* In Renesas ABI, long longs and aggregate types are always passed
on stack. */
else if (sh_is_renesas_calling_convention (func_type)
- && ((TYPE_CODE (type) == TYPE_CODE_INT && len == 8)
- || TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION))
+ && ((type->code () == TYPE_CODE_INT && len == 8)
+ || type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION))
pass_on_stack = 1;
/* In contrast to non-FPU CPUs, arguments are never split between
registers and stack. If an argument doesn't fit in the remaining
/* Renesas ABI pushes doubles and long longs entirely on stack.
Same goes for aggregate types. */
if (sh_is_renesas_calling_convention (func_type)
- && ((TYPE_CODE (type) == TYPE_CODE_INT && len >= 8)
- || (TYPE_CODE (type) == TYPE_CODE_FLT && len >= 8)
- || TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION))
+ && ((type->code () == TYPE_CODE_INT && len >= 8)
+ || (type->code () == TYPE_CODE_FLT && len >= 8)
+ || type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION))
pass_on_stack = 1;
while (len > 0)
{
{
int len = TYPE_LENGTH (type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_INT:
case TYPE_CODE_BOOL:
static int
sparc_floating_p (const struct type *type)
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_FLT:
{
static int
sparc_complex_floating_p (const struct type *type)
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_COMPLEX:
{
static int
sparc_structure_or_union_p (const struct type *type)
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
static bool
sparc_structure_return_p (const struct type *type)
{
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type))
+ if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type))
{
/* Float vectors are always returned by memory. */
if (sparc_floating_p (check_typedef (TYPE_TARGET_TYPE (type))))
static bool
sparc_arg_by_memory_p (const struct type *type)
{
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type))
+ if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type))
{
/* Float vectors are always passed by memory. */
if (sparc_floating_p (check_typedef (TYPE_TARGET_TYPE (type))))
sparc32_struct_return_from_sym (struct symbol *sym)
{
struct type *type = check_typedef (SYMBOL_TYPE (sym));
- enum type_code code = TYPE_CODE (type);
+ enum type_code code = type->code ();
if (code == TYPE_CODE_FUNC || code == TYPE_CODE_METHOD)
{
gdb_assert (!sparc_structure_return_p (type));
if (sparc_floating_p (type) || sparc_complex_floating_p (type)
- || TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ || type->code () == TYPE_CODE_ARRAY)
{
/* Floating return values. */
regcache->cooked_read (SPARC_F0_REGNUM, buf);
static int
sparc64_integral_or_pointer_p (const struct type *type)
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_INT:
case TYPE_CODE_BOOL:
static int
sparc64_floating_p (const struct type *type)
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_FLT:
{
static int
sparc64_complex_floating_p (const struct type *type)
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_COMPLEX:
{
static int
sparc64_structure_or_union_p (const struct type *type)
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
static int
sparc64_16_byte_align_p (struct type *type)
{
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ if (type->code () == TYPE_CODE_ARRAY)
{
struct type *t = check_typedef (TYPE_TARGET_TYPE (type));
gdb_assert (element < 16);
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ if (type->code () == TYPE_CODE_ARRAY)
{
gdb_byte buf[8];
int regnum = SPARC_F0_REGNUM + element * 2 + bitpos / 32;
{
struct gdbarch *gdbarch = regcache->arch ();
- if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ if (type->code () == TYPE_CODE_ARRAY)
{
int len = TYPE_LENGTH (type);
int regnum = SPARC_F0_REGNUM + bitpos / 32;
for (i = 0; i < ((len + 7) / 8); i++)
regcache->cooked_read (SPARC_O0_REGNUM + i, buf + i * 8);
- if (TYPE_CODE (type) != TYPE_CODE_UNION)
+ if (type->code () != TYPE_CODE_UNION)
sparc64_extract_floating_fields (regcache, type, buf, 0);
memcpy (valbuf, buf, len);
}
regcache->cooked_read (SPARC_F0_REGNUM + i, buf + i * 4);
memcpy (valbuf, buf, len);
}
- else if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ else if (type->code () == TYPE_CODE_ARRAY)
{
/* Small arrays are returned the same way as small structures. */
gdb_assert (len <= 32);
memcpy (buf, valbuf, len);
for (i = 0; i < ((len + 7) / 8); i++)
regcache->cooked_write (SPARC_O0_REGNUM + i, buf + i * 8);
- if (TYPE_CODE (type) != TYPE_CODE_UNION)
+ if (type->code () != TYPE_CODE_UNION)
sparc64_store_floating_fields (regcache, type, buf, 0, 0);
}
else if (sparc64_floating_p (type) || sparc64_complex_floating_p (type))
for (i = 0; i < len / 4; i++)
regcache->cooked_write (SPARC_F0_REGNUM + i, buf + i * 4);
}
- else if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ else if (type->code () == TYPE_CODE_ARRAY)
{
/* Small arrays are returned the same way as small structures. */
gdb_assert (len <= 32);
/* Function result types are described as the result type in stabs.
We need to convert this to the function-returning-type-X type
in GDB. E.g. "int" is converted to "function returning int". */
- if (TYPE_CODE (SYMBOL_TYPE (sym)) != TYPE_CODE_FUNC)
+ if (SYMBOL_TYPE (sym)->code () != TYPE_CODE_FUNC)
SYMBOL_TYPE (sym) = lookup_function_type (SYMBOL_TYPE (sym));
/* All functions in C++ have prototypes. Stabs does not offer an
a TYPE_CODE_VOID type by read_type, and we have to turn
it back into builtin_int here.
FIXME: Do we need a new builtin_promoted_int_arg ? */
- if (TYPE_CODE (ptype) == TYPE_CODE_VOID)
+ if (ptype->code () == TYPE_CODE_VOID)
ptype = objfile_type (objfile)->builtin_int;
TYPE_FIELD_TYPE (ftype, nparams) = ptype;
TYPE_FIELD_ARTIFICIAL (ftype, nparams++) = 0;
really an int. */
if (TYPE_LENGTH (SYMBOL_TYPE (sym))
< gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT
- && TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_INT)
+ && SYMBOL_TYPE (sym)->code () == TYPE_CODE_INT)
{
SYMBOL_TYPE (sym) =
TYPE_UNSIGNED (SYMBOL_TYPE (sym))
derived class was output. We fill in the derived class's
base part member's name here in that case. */
if (TYPE_NAME (SYMBOL_TYPE (sym)) != NULL)
- if ((TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT
- || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_UNION)
+ if ((SYMBOL_TYPE (sym)->code () == TYPE_CODE_STRUCT
+ || SYMBOL_TYPE (sym)->code () == TYPE_CODE_UNION)
&& TYPE_N_BASECLASSES (SYMBOL_TYPE (sym)))
{
int j;
if (TYPE_NAME (SYMBOL_TYPE (sym)) == NULL)
{
- if ((TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_PTR
+ if ((SYMBOL_TYPE (sym)->code () == TYPE_CODE_PTR
&& strcmp (sym->linkage_name (), vtbl_ptr_name))
- || TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_FUNC)
+ || SYMBOL_TYPE (sym)->code () == TYPE_CODE_FUNC)
{
/* If we are giving a name to a type such as "pointer to
foo" or "function returning foo", we better not set
/* If this is a forward reference, arrange to complain if it
doesn't get patched up by the time we're done
reading. */
- if (TYPE_CODE (type) == TYPE_CODE_UNDEF)
+ if (type->code () == TYPE_CODE_UNDEF)
add_undefined_type (type, typenums);
return type;
if (SYMBOL_CLASS (sym) == LOC_TYPEDEF
&& SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN
- && (TYPE_CODE (SYMBOL_TYPE (sym)) == code)
+ && (SYMBOL_TYPE (sym)->code () == code)
&& strcmp (sym->linkage_name (), type_name) == 0)
{
obstack_free (&objfile->objfile_obstack, type_name);
that's just an empty argument list. */
if (arg_types
&& ! arg_types->next
- && TYPE_CODE (arg_types->type) == TYPE_CODE_VOID)
+ && arg_types->type->code () == TYPE_CODE_VOID)
num_args = 0;
TYPE_FIELDS (func_type)
}
/* These are methods, not functions. */
- if (TYPE_CODE (new_sublist->fn_field.type) == TYPE_CODE_FUNC)
+ if (new_sublist->fn_field.type->code () == TYPE_CODE_FUNC)
new_sublist->fn_field.type->set_code (TYPE_CODE_METHOD);
else
- gdb_assert (TYPE_CODE (new_sublist->fn_field.type)
+ gdb_assert (new_sublist->fn_field.type->code ()
== TYPE_CODE_METHOD);
/* If this is just a stub, then we don't have the real name here. */
struct type *field_type = check_typedef (FIELD_TYPE (fip->list->field));
- if (TYPE_CODE (field_type) != TYPE_CODE_INT
- && TYPE_CODE (field_type) != TYPE_CODE_RANGE
- && TYPE_CODE (field_type) != TYPE_CODE_BOOL
- && TYPE_CODE (field_type) != TYPE_CODE_ENUM)
+ if (field_type->code () != TYPE_CODE_INT
+ && field_type->code () != TYPE_CODE_RANGE
+ && field_type->code () != TYPE_CODE_BOOL
+ && field_type->code () != TYPE_CODE_ENUM)
{
FIELD_BITSIZE (fip->list->field) = 0;
}
if ((FIELD_BITSIZE (fip->list->field)
== TARGET_CHAR_BIT * TYPE_LENGTH (field_type)
- || (TYPE_CODE (field_type) == TYPE_CODE_ENUM
+ || (field_type->code () == TYPE_CODE_ENUM
&& FIELD_BITSIZE (fip->list->field)
== gdbarch_int_bit (gdbarch))
)
if (TYPE_NAME (type))
{
name = TYPE_NAME (type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_STRUCT: kind = "struct "; break;
case TYPE_CODE_UNION: kind = "union "; break;
Obviously, GDB can't fix this by itself, but it can at least avoid
scribbling on existing structure type objects when new definitions
appear. */
- if (! (TYPE_CODE (type) == TYPE_CODE_UNDEF
+ if (! (type->code () == TYPE_CODE_UNDEF
|| TYPE_STUB (type)))
{
complain_about_struct_wipeout (type);
complaint (_("Invalid (empty) method arguments"));
*varargsp = 0;
}
- else if (TYPE_CODE (types[n - 1]) != TYPE_CODE_VOID)
+ else if (types[n - 1]->code () != TYPE_CODE_VOID)
*varargsp = 1;
else
{
struct type **type;
type = dbx_lookup_type (nat.typenums, objfile);
- if (nat.type != *type && TYPE_CODE (*type) != TYPE_CODE_UNDEF)
+ if (nat.type != *type && (*type)->code () != TYPE_CODE_UNDEF)
{
/* The instance flags of the undefined type are still unset,
and needs to be copied over from the reference type.
for (type = undef_types; type < undef_types + undef_types_length; type++)
{
- switch (TYPE_CODE (*type))
+ switch ((*type)->code ())
{
case TYPE_CODE_STRUCT:
if (SYMBOL_CLASS (sym) == LOC_TYPEDEF
&& SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN
- && (TYPE_CODE (SYMBOL_TYPE (sym)) ==
- TYPE_CODE (*type))
+ && (SYMBOL_TYPE (sym)->code () ==
+ (*type)->code ())
&& (TYPE_INSTANCE_FLAGS (*type) ==
TYPE_INSTANCE_FLAGS (SYMBOL_TYPE (sym)))
&& strcmp (sym->linkage_name (), type_name) == 0)
{
complaint (_("forward-referenced types left unresolved, "
"type code %d."),
- TYPE_CODE (*type));
+ (*type)->code ());
}
break;
}
function = read_var_value (thisfun, NULL, thisframe);
rv_conv = RETURN_VALUE_REGISTER_CONVENTION;
- if (TYPE_CODE (return_type) == TYPE_CODE_VOID)
+ if (return_type->code () == TYPE_CODE_VOID)
/* If the return-type is "void", don't try to find the
return-value's location. However, do still evaluate the
return expression so that, even when the expression result
else
{
fprintf_filtered (outfile, "%s %s = ",
- (TYPE_CODE (SYMBOL_TYPE (symbol)) == TYPE_CODE_ENUM
+ (SYMBOL_TYPE (symbol)->code () == TYPE_CODE_ENUM
? "enum"
- : (TYPE_CODE (SYMBOL_TYPE (symbol)) == TYPE_CODE_STRUCT
+ : (SYMBOL_TYPE (symbol)->code () == TYPE_CODE_STRUCT
? "struct" : "union")),
symbol->linkage_name ());
LA_PRINT_TYPE (SYMBOL_TYPE (symbol), "", outfile, 1, depth,
/* Print details of types, except for enums where it's clutter. */
LA_PRINT_TYPE (SYMBOL_TYPE (symbol), symbol->print_name (),
outfile,
- TYPE_CODE (SYMBOL_TYPE (symbol)) != TYPE_CODE_ENUM,
+ SYMBOL_TYPE (symbol)->code () != TYPE_CODE_ENUM,
depth,
&type_print_raw_options);
fprintf_filtered (outfile, "; ");
/* I'm not really sure that type of this can ever
be typedefed; just be safe. */
t = check_typedef (t);
- if (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t))
+ if (t->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t))
t = TYPE_TARGET_TYPE (t);
- if (TYPE_CODE (t) != TYPE_CODE_STRUCT
- && TYPE_CODE (t) != TYPE_CODE_UNION)
+ if (t->code () != TYPE_CODE_STRUCT
+ && t->code () != TYPE_CODE_UNION)
error (_("Internal error: `%s' is not an aggregate"),
langdef->la_name_of_this);
members. We only want to skip enums
here. */
&& !(SYMBOL_CLASS (sym) == LOC_CONST
- && (TYPE_CODE (SYMBOL_TYPE (sym))
+ && (SYMBOL_TYPE (sym)->code ()
== TYPE_CODE_ENUM))
&& (!treg.has_value ()
|| treg_matches_sym_type_name (*treg, sym)))
For the struct printing case below, things are worse, we force
printing of the ";" in this function, which is going to be wrong
for languages that don't require a ";" between statements. */
- if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_TYPEDEF)
+ if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_TYPEDEF)
typedef_print (SYMBOL_TYPE (sym), sym, &tmp_stream);
else
type_print (SYMBOL_TYPE (sym), "", &tmp_stream, -1);
if (SYMBOL_CLASS (sym) == LOC_TYPEDEF)
{
struct type *t = SYMBOL_TYPE (sym);
- enum type_code c = TYPE_CODE (t);
+ enum type_code c = t->code ();
int j;
if (c == TYPE_CODE_UNION || c == TYPE_CODE_STRUCT)
bool
symbol_is_function_or_method (symbol *sym)
{
- switch (TYPE_CODE (SYMBOL_TYPE (sym)))
+ switch (SYMBOL_TYPE (sym)->code ())
{
case TYPE_CODE_FUNC:
case TYPE_CODE_METHOD:
if (code == TYPE_CODE_UNDEF
|| (SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN
- && TYPE_CODE (SYMBOL_TYPE (sym)) == code))
+ && SYMBOL_TYPE (sym)->code () == code))
completion_list_add_symbol (tracker, sym,
lookup_name,
text, word);
sym_text, word);
}
else if (SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN
- && TYPE_CODE (SYMBOL_TYPE (sym)) == code)
+ && SYMBOL_TYPE (sym)->code () == code)
completion_list_add_symbol (tracker, sym, lookup_name,
sym_text, word);
}
static void
match_endianness (const gdb_byte *from, const struct type *type, gdb_byte *to)
{
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_DECFLOAT);
+ gdb_assert (type->code () == TYPE_CODE_DECFLOAT);
int len = TYPE_LENGTH (type);
int i;
static void
set_decnumber_context (decContext *ctx, const struct type *type)
{
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_DECFLOAT);
+ gdb_assert (type->code () == TYPE_CODE_DECFLOAT);
switch (TYPE_LENGTH (type))
{
target_float_same_category_p (const struct type *type1,
const struct type *type2)
{
- return TYPE_CODE (type1) == TYPE_CODE (type2);
+ return type1->code () == type2->code ();
}
/* Return whether TYPE1 and TYPE2 use the same floating-point format. */
if (!target_float_same_category_p (type1, type2))
return false;
- switch (TYPE_CODE (type1))
+ switch (type1->code ())
{
case TYPE_CODE_FLT:
return floatformat_from_type (type1) == floatformat_from_type (type2);
static int
target_float_format_length (const struct type *type)
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_FLT:
return floatformat_totalsize_bytes (floatformat_from_type (type));
static enum target_float_ops_kind
get_target_float_ops_kind (const struct type *type)
{
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_FLT:
{
static const target_float_ops *
get_target_float_ops (const struct type *type1, const struct type *type2)
{
- gdb_assert (TYPE_CODE (type1) == TYPE_CODE (type2));
+ gdb_assert (type1->code () == type2->code ());
enum target_float_ops_kind kind1 = get_target_float_ops_kind (type1);
enum target_float_ops_kind kind2 = get_target_float_ops_kind (type2);
bool
target_float_is_valid (const gdb_byte *addr, const struct type *type)
{
- if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ if (type->code () == TYPE_CODE_FLT)
return floatformat_is_valid (floatformat_from_type (type), addr);
- if (TYPE_CODE (type) == TYPE_CODE_DECFLOAT)
+ if (type->code () == TYPE_CODE_DECFLOAT)
return true;
gdb_assert_not_reached ("unexpected type code");
bool
target_float_is_zero (const gdb_byte *addr, const struct type *type)
{
- if (TYPE_CODE (type) == TYPE_CODE_FLT)
+ if (type->code () == TYPE_CODE_FLT)
return (floatformat_classify (floatformat_from_type (type), addr)
== float_zero);
- if (TYPE_CODE (type) == TYPE_CODE_DECFLOAT)
+ if (type->code () == TYPE_CODE_DECFLOAT)
return decimal_is_zero (addr, type);
gdb_assert_not_reached ("unexpected type code");
{
/* Unless we need to adhere to a specific format, provide special
output for special cases of binary floating-point numbers. */
- if (format == nullptr && TYPE_CODE (type) == TYPE_CODE_FLT)
+ if (format == nullptr && type->code () == TYPE_CODE_FLT)
{
const struct floatformat *fmt = floatformat_from_type (type);
tic6x_arg_type_alignment (struct type *type)
{
int len = TYPE_LENGTH (check_typedef (type));
- enum type_code typecode = TYPE_CODE (check_typedef (type));
+ enum type_code typecode = check_typedef (type)->code ();
if (typecode == TYPE_CODE_STRUCT || typecode == TYPE_CODE_UNION)
{
/* Determine the type of this function. */
func_type = check_typedef (func_type);
- if (TYPE_CODE (func_type) == TYPE_CODE_PTR)
+ if (func_type->code () == TYPE_CODE_PTR)
func_type = check_typedef (TYPE_TARGET_TYPE (func_type));
- gdb_assert (TYPE_CODE (func_type) == TYPE_CODE_FUNC
- || TYPE_CODE (func_type) == TYPE_CODE_METHOD);
+ gdb_assert (func_type->code () == TYPE_CODE_FUNC
+ || func_type->code () == TYPE_CODE_METHOD);
/* For a variadic C function, the last explicitly declared argument and all
remaining arguments are passed on the stack. */
struct value *arg = args[argnum];
struct type *arg_type = check_typedef (value_type (arg));
int len = TYPE_LENGTH (arg_type);
- enum type_code typecode = TYPE_CODE (arg_type);
+ enum type_code typecode = arg_type->code ();
val = value_contents (arg);
static int
tilegx_type_is_scalar (struct type *t)
{
- return (TYPE_CODE(t) != TYPE_CODE_STRUCT
- && TYPE_CODE(t) != TYPE_CODE_UNION
- && TYPE_CODE(t) != TYPE_CODE_ARRAY);
+ return (t->code () != TYPE_CODE_STRUCT
+ && t->code () != TYPE_CODE_UNION
+ && t->code () != TYPE_CODE_ARRAY);
}
/* Returns non-zero if the given struct type will be returned using
}
/* A struct may be a C++ class with static fields, go to general
expression handling. */
- if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_STRUCT)
+ if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_STRUCT)
treat_as_expr = 1;
else
add_memrange (gdbarch, memrange_absolute, offset, len, scope);
add_local_register (gdbarch, reg, scope);
/* Check for doubles stored in two registers. */
/* FIXME: how about larger types stored in 3 or more regs? */
- if (TYPE_CODE (SYMBOL_TYPE (sym)) == TYPE_CODE_FLT &&
+ if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_FLT &&
len > register_size (gdbarch, reg))
add_local_register (gdbarch, reg + 1, scope);
break;
}
struct type *ftype = check_typedef (TYPE_FIELD_TYPE (type, field_idx));
- if (TYPE_CODE (type) == TYPE_CODE_UNION)
+ if (type->code () == TYPE_CODE_UNION)
{
/* Since union fields don't have the concept of offsets, we just
print their sizes. */
Use check_typedef to resolve stubs, but ignore its result
because we do not want to dig past all typedefs. */
check_typedef (type);
- if (TYPE_CODE (type) == TYPE_CODE_TYPEDEF)
+ if (type->code () == TYPE_CODE_TYPEDEF)
type = TYPE_TARGET_TYPE (type);
/* If the expression is actually a type, then there's no
get_user_print_options (&opts);
if (val != NULL && opts.objectprint)
{
- if (((TYPE_CODE (type) == TYPE_CODE_PTR) || TYPE_IS_REFERENCE (type))
- && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT))
+ if (((type->code () == TYPE_CODE_PTR) || TYPE_IS_REFERENCE (type))
+ && (TYPE_TARGET_TYPE (type)->code () == TYPE_CODE_STRUCT))
real_type = value_rtti_indirect_type (val, &full, &top, &using_enc);
- else if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
+ else if (type->code () == TYPE_CODE_STRUCT)
real_type = value_rtti_type (val, &full, &top, &using_enc);
}
if (flags.print_offsets
- && (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION))
+ && (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION))
fprintf_filtered (gdb_stdout, "/* offset | size */ ");
printf_filtered ("type = ");
type = check_typedef (type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_ENUM:
static int
v850_type_is_scalar (struct type *t)
{
- return (TYPE_CODE (t) != TYPE_CODE_STRUCT
- && TYPE_CODE (t) != TYPE_CODE_UNION
- && TYPE_CODE (t) != TYPE_CODE_ARRAY);
+ return (t->code () != TYPE_CODE_STRUCT
+ && t->code () != TYPE_CODE_UNION
+ && t->code () != TYPE_CODE_ARRAY);
}
/* Should call_function allocate stack space for a struct return? */
/* The value is a structure or union with a single element and that
element is either a single basic type or an array of a single basic
type whose size is greater than or equal to 4 -> returned in register. */
- if ((TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION)
+ if ((type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION)
&& TYPE_NFIELDS (type) == 1)
{
fld_type = TYPE_FIELD_TYPE (type, 0);
if (v850_type_is_scalar (fld_type) && TYPE_LENGTH (fld_type) >= 4)
return 0;
- if (TYPE_CODE (fld_type) == TYPE_CODE_ARRAY)
+ if (fld_type->code () == TYPE_CODE_ARRAY)
{
tgt_type = TYPE_TARGET_TYPE (fld_type);
if (v850_type_is_scalar (tgt_type) && TYPE_LENGTH (tgt_type) >= 4)
/* The value is a structure whose first element is an integer or a float,
and which contains no arrays of more than two elements -> returned in
register. */
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT
+ if (type->code () == TYPE_CODE_STRUCT
&& v850_type_is_scalar (TYPE_FIELD_TYPE (type, 0))
&& TYPE_LENGTH (TYPE_FIELD_TYPE (type, 0)) == 4)
{
for (i = 1; i < TYPE_NFIELDS (type); ++i)
{
fld_type = TYPE_FIELD_TYPE (type, 0);
- if (TYPE_CODE (fld_type) == TYPE_CODE_ARRAY)
+ if (fld_type->code () == TYPE_CODE_ARRAY)
{
tgt_type = TYPE_TARGET_TYPE (fld_type);
if (TYPE_LENGTH (tgt_type) > 0
/* The value is a union which contains at least one field which
would be returned in registers according to these rules ->
returned in register. */
- if (TYPE_CODE (type) == TYPE_CODE_UNION)
+ if (type->code () == TYPE_CODE_UNION)
{
for (i = 0; i < TYPE_NFIELDS (type); ++i)
{
LONGEST sz = -1;
struct type *ptr_target;
- gdb_assert (TYPE_CODE (ptr_type) == TYPE_CODE_PTR);
+ gdb_assert (ptr_type->code () == TYPE_CODE_PTR);
ptr_target = check_typedef (TYPE_TARGET_TYPE (ptr_type));
sz = type_length_units (ptr_target);
if (sz == 0)
{
- if (TYPE_CODE (ptr_type) == TYPE_CODE_VOID)
+ if (ptr_type->code () == TYPE_CODE_VOID)
sz = 1;
else
{
type1 = check_typedef (value_type (arg1));
type2 = check_typedef (value_type (arg2));
- gdb_assert (TYPE_CODE (type1) == TYPE_CODE_PTR);
- gdb_assert (TYPE_CODE (type2) == TYPE_CODE_PTR);
+ gdb_assert (type1->code () == TYPE_CODE_PTR);
+ gdb_assert (type2->code () == TYPE_CODE_PTR);
if (TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type1)))
!= TYPE_LENGTH (check_typedef (TYPE_TARGET_TYPE (type2))))
array = coerce_ref (array);
tarray = check_typedef (value_type (array));
- if (TYPE_CODE (tarray) == TYPE_CODE_ARRAY
- || TYPE_CODE (tarray) == TYPE_CODE_STRING)
+ if (tarray->code () == TYPE_CODE_ARRAY
+ || tarray->code () == TYPE_CODE_STRING)
{
struct type *range_type = TYPE_INDEX_TYPE (tarray);
LONGEST lowerbound, upperbound;
if (TYPE_IS_REFERENCE (type2))
type2 = check_typedef (TYPE_TARGET_TYPE (type2));
- return (TYPE_CODE (type1) == TYPE_CODE_STRUCT
- || TYPE_CODE (type2) == TYPE_CODE_STRUCT);
+ return (type1->code () == TYPE_CODE_STRUCT
+ || type2->code () == TYPE_CODE_STRUCT);
}
/* Check to see if either argument is a structure, or a reference to
type1 = check_typedef (value_type (arg1));
if (TYPE_IS_REFERENCE (type1))
type1 = check_typedef (TYPE_TARGET_TYPE (type1));
- return TYPE_CODE (type1) == TYPE_CODE_STRUCT;
+ return type1->code () == TYPE_CODE_STRUCT;
}
/* Try to find an operator named OPERATOR which takes NARGS arguments
/* now we know that what we have to do is construct our
arg vector and find the right function to call it with. */
- if (TYPE_CODE (check_typedef (value_type (arg1))) != TYPE_CODE_STRUCT)
+ if (check_typedef (value_type (arg1))->code () != TYPE_CODE_STRUCT)
error (_("Can't do that binary op on that type")); /* FIXME be explicit */
value *argvec_storage[3];
argvec[1] = argvec[0];
argvec = argvec.slice (1);
}
- if (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_XMETHOD)
+ if (value_type (argvec[0])->code () == TYPE_CODE_XMETHOD)
{
/* Static xmethods are not supported yet. */
gdb_assert (static_memfuncp == 0);
/* now we know that what we have to do is construct our
arg vector and find the right function to call it with. */
- if (TYPE_CODE (check_typedef (value_type (arg1))) != TYPE_CODE_STRUCT)
+ if (check_typedef (value_type (arg1))->code () != TYPE_CODE_STRUCT)
error (_("Can't do that unary op on that type")); /* FIXME be explicit */
value *argvec_storage[3];
argvec[1] = argvec[0];
argvec = argvec.slice (1);
}
- if (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_XMETHOD)
+ if (value_type (argvec[0])->code () == TYPE_CODE_XMETHOD)
{
/* Static xmethods are not supported yet. */
gdb_assert (static_memfuncp == 0);
to the second of the two concatenated values or the value to be
repeated. */
- if (TYPE_CODE (type2) == TYPE_CODE_INT)
+ if (type2->code () == TYPE_CODE_INT)
{
struct type *tmp = type1;
/* Now process the input values. */
- if (TYPE_CODE (type1) == TYPE_CODE_INT)
+ if (type1->code () == TYPE_CODE_INT)
{
/* We have a repeat count. Validate the second value and then
construct a value repeated that many times. */
- if (TYPE_CODE (type2) == TYPE_CODE_STRING
- || TYPE_CODE (type2) == TYPE_CODE_CHAR)
+ if (type2->code () == TYPE_CODE_STRING
+ || type2->code () == TYPE_CODE_CHAR)
{
count = longest_to_int (value_as_long (inval1));
inval2len = TYPE_LENGTH (type2);
std::vector<char> ptr (count * inval2len);
- if (TYPE_CODE (type2) == TYPE_CODE_CHAR)
+ if (type2->code () == TYPE_CODE_CHAR)
{
char_type = type2;
}
outval = value_string (ptr.data (), count * inval2len, char_type);
}
- else if (TYPE_CODE (type2) == TYPE_CODE_BOOL)
+ else if (type2->code () == TYPE_CODE_BOOL)
{
error (_("unimplemented support for boolean repeats"));
}
error (_("can't repeat values of that type"));
}
}
- else if (TYPE_CODE (type1) == TYPE_CODE_STRING
- || TYPE_CODE (type1) == TYPE_CODE_CHAR)
+ else if (type1->code () == TYPE_CODE_STRING
+ || type1->code () == TYPE_CODE_CHAR)
{
/* We have two character strings to concatenate. */
- if (TYPE_CODE (type2) != TYPE_CODE_STRING
- && TYPE_CODE (type2) != TYPE_CODE_CHAR)
+ if (type2->code () != TYPE_CODE_STRING
+ && type2->code () != TYPE_CODE_CHAR)
{
error (_("Strings can only be concatenated with other strings."));
}
inval1len = TYPE_LENGTH (type1);
inval2len = TYPE_LENGTH (type2);
std::vector<char> ptr (inval1len + inval2len);
- if (TYPE_CODE (type1) == TYPE_CODE_CHAR)
+ if (type1->code () == TYPE_CODE_CHAR)
{
char_type = type1;
memcpy (ptr.data (), value_contents (inval1), inval1len);
}
- if (TYPE_CODE (type2) == TYPE_CODE_CHAR)
+ if (type2->code () == TYPE_CODE_CHAR)
{
ptr[inval1len] =
(char) unpack_long (type2, value_contents (inval2));
}
outval = value_string (ptr.data (), inval1len + inval2len, char_type);
}
- else if (TYPE_CODE (type1) == TYPE_CODE_BOOL)
+ else if (type1->code () == TYPE_CODE_BOOL)
{
/* We have two bitstrings to concatenate. */
- if (TYPE_CODE (type2) != TYPE_CODE_BOOL)
+ if (type2->code () != TYPE_CODE_BOOL)
{
error (_("Booleans can only be concatenated "
"with other bitstrings or booleans."));
gdb_assert (is_floating_type (type1) || is_floating_type (type2));
if (is_floating_type (type1) && is_floating_type (type2)
- && TYPE_CODE (type1) != TYPE_CODE (type2))
+ && type1->code () != type2->code ())
/* The DFP extension to the C language does not allow mixing of
* decimal float types with other float types in expressions
* (see WDTR 24732, page 12). */
struct type *arg2_type = check_typedef (value_type (arg2));
struct value *arg1_real, *arg1_imag, *arg2_real, *arg2_imag;
- if (TYPE_CODE (arg1_type) == TYPE_CODE_COMPLEX)
+ if (arg1_type->code () == TYPE_CODE_COMPLEX)
{
arg1_real = value_real_part (arg1);
arg1_imag = value_imaginary_part (arg1);
arg1_real = arg1;
arg1_imag = value_zero (arg1_type, not_lval);
}
- if (TYPE_CODE (arg2_type) == TYPE_CODE_COMPLEX)
+ if (arg2_type->code () == TYPE_CODE_COMPLEX)
{
arg2_real = value_real_part (arg2);
arg2_imag = value_imaginary_part (arg2);
case BINOP_DIV:
{
- if (TYPE_CODE (arg2_type) == TYPE_CODE_COMPLEX)
+ if (arg2_type->code () == TYPE_CODE_COMPLEX)
{
struct value *conjugate = value_complement (arg2);
/* We have to reconstruct ARG1, in case the type was
type1 = check_typedef (value_type (arg1));
type2 = check_typedef (value_type (arg2));
- if (TYPE_CODE (type1) == TYPE_CODE_COMPLEX
- || TYPE_CODE (type2) == TYPE_CODE_COMPLEX)
+ if (type1->code () == TYPE_CODE_COMPLEX
+ || type2->code () == TYPE_CODE_COMPLEX)
return complex_binop (arg1, arg2, op);
if ((!is_floating_value (arg1) && !is_integral_type (type1))
v2.data (), eff_type_v2,
value_contents_raw (val), result_type);
}
- else if (TYPE_CODE (type1) == TYPE_CODE_BOOL
- || TYPE_CODE (type2) == TYPE_CODE_BOOL)
+ else if (type1->code () == TYPE_CODE_BOOL
+ || type2->code () == TYPE_CODE_BOOL)
{
LONGEST v1, v2, v = 0;
vector_type = check_typedef (vector_type);
- gdb_assert (TYPE_CODE (vector_type) == TYPE_CODE_ARRAY
+ gdb_assert (vector_type->code () == TYPE_CODE_ARRAY
&& TYPE_VECTOR (vector_type));
if (!get_array_bounds (vector_type, &low_bound, &high_bound))
type1 = check_typedef (value_type (val1));
type2 = check_typedef (value_type (val2));
- t1_is_vec = (TYPE_CODE (type1) == TYPE_CODE_ARRAY
+ t1_is_vec = (type1->code () == TYPE_CODE_ARRAY
&& TYPE_VECTOR (type1)) ? 1 : 0;
- t2_is_vec = (TYPE_CODE (type2) == TYPE_CODE_ARRAY
+ t2_is_vec = (type2->code () == TYPE_CODE_ARRAY
&& TYPE_VECTOR (type2)) ? 1 : 0;
if (!t1_is_vec || !t2_is_vec)
eltype2 = check_typedef (TYPE_TARGET_TYPE (type2));
elsize = TYPE_LENGTH (eltype1);
- if (TYPE_CODE (eltype1) != TYPE_CODE (eltype2)
+ if (eltype1->code () != eltype2->code ()
|| elsize != TYPE_LENGTH (eltype2)
|| TYPE_UNSIGNED (eltype1) != TYPE_UNSIGNED (eltype2)
|| low_bound1 != low_bound2 || high_bound1 != high_bound2)
struct value *val;
struct type *type1 = check_typedef (value_type (arg1));
struct type *type2 = check_typedef (value_type (arg2));
- int t1_is_vec = (TYPE_CODE (type1) == TYPE_CODE_ARRAY
+ int t1_is_vec = (type1->code () == TYPE_CODE_ARRAY
&& TYPE_VECTOR (type1));
- int t2_is_vec = (TYPE_CODE (type2) == TYPE_CODE_ARRAY
+ int t2_is_vec = (type2->code () == TYPE_CODE_ARRAY
&& TYPE_VECTOR (type2));
if (!t1_is_vec && !t2_is_vec)
struct value **v = t1_is_vec ? &arg2 : &arg1;
struct type *t = t1_is_vec ? type2 : type1;
- if (TYPE_CODE (t) != TYPE_CODE_FLT
- && TYPE_CODE (t) != TYPE_CODE_DECFLOAT
+ if (t->code () != TYPE_CODE_FLT
+ && t->code () != TYPE_CODE_DECFLOAT
&& !is_integral_type (t))
error (_("Argument to operation not a number or boolean."));
type1 = check_typedef (value_type (arg1));
type2 = check_typedef (value_type (arg2));
- code1 = TYPE_CODE (type1);
- code2 = TYPE_CODE (type2);
+ code1 = type1->code ();
+ code2 = type2->code ();
is_int1 = is_integral_type (type1);
is_int2 = is_integral_type (type2);
type1 = check_typedef (value_type (arg1));
type2 = check_typedef (value_type (arg2));
- return (TYPE_CODE (type1) == TYPE_CODE (type2)
+ return (type1->code () == type2->code ()
&& TYPE_LENGTH (type1) == TYPE_LENGTH (type2)
&& memcmp (value_contents (arg1), value_contents (arg2),
TYPE_LENGTH (type1)) == 0);
type1 = check_typedef (value_type (arg1));
type2 = check_typedef (value_type (arg2));
- code1 = TYPE_CODE (type1);
- code2 = TYPE_CODE (type2);
+ code1 = type1->code ();
+ code2 = type2->code ();
is_int1 = is_integral_type (type1);
is_int2 = is_integral_type (type2);
type = check_typedef (value_type (arg1));
if (is_integral_type (type) || is_floating_value (arg1)
- || (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type))
- || TYPE_CODE (type) == TYPE_CODE_COMPLEX)
+ || (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type))
+ || type->code () == TYPE_CODE_COMPLEX)
return value_from_contents (type, value_contents (arg1));
else
error (_("Argument to positive operation not a number."));
if (is_integral_type (type) || is_floating_type (type))
return value_binop (value_from_longest (type, 0), arg1, BINOP_SUB);
- else if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type))
+ else if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type))
{
struct value *tmp, *val = allocate_value (type);
struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type));
}
return val;
}
- else if (TYPE_CODE (type) == TYPE_CODE_COMPLEX)
+ else if (type->code () == TYPE_CODE_COMPLEX)
{
struct value *real = value_real_part (arg1);
struct value *imag = value_imaginary_part (arg1);
if (is_integral_type (type))
val = value_from_longest (type, ~value_as_long (arg1));
- else if (TYPE_CODE (type) == TYPE_CODE_ARRAY && TYPE_VECTOR (type))
+ else if (type->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type))
{
struct value *tmp;
struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type));
value_contents_all (tmp), TYPE_LENGTH (eltype));
}
}
- else if (TYPE_CODE (type) == TYPE_CODE_COMPLEX)
+ else if (type->code () == TYPE_CODE_COMPLEX)
{
/* GCC has an extension that treats ~complex as the complex
conjugate. */
struct type *settype = check_typedef (value_type (set));
struct type *eltype = check_typedef (value_type (element));
- if (TYPE_CODE (eltype) == TYPE_CODE_RANGE)
+ if (eltype->code () == TYPE_CODE_RANGE)
eltype = TYPE_TARGET_TYPE (eltype);
- if (TYPE_CODE (settype) != TYPE_CODE_SET)
+ if (settype->code () != TYPE_CODE_SET)
error (_("Second argument of 'IN' has wrong type"));
- if (TYPE_CODE (eltype) != TYPE_CODE_INT
- && TYPE_CODE (eltype) != TYPE_CODE_CHAR
- && TYPE_CODE (eltype) != TYPE_CODE_ENUM
- && TYPE_CODE (eltype) != TYPE_CODE_BOOL)
+ if (eltype->code () != TYPE_CODE_INT
+ && eltype->code () != TYPE_CODE_CHAR
+ && eltype->code () != TYPE_CODE_ENUM
+ && eltype->code () != TYPE_CODE_BOOL)
error (_("First argument of 'IN' has wrong type"));
member = value_bit_index (settype, value_contents (set),
value_as_long (element));
t2 = check_typedef (value_type (v2));
/* Check preconditions. */
- gdb_assert ((TYPE_CODE (t1) == TYPE_CODE_STRUCT
- || TYPE_CODE (t1) == TYPE_CODE_UNION)
+ gdb_assert ((t1->code () == TYPE_CODE_STRUCT
+ || t1->code () == TYPE_CODE_UNION)
&& !!"Precondition is that type is of STRUCT or UNION kind.");
- gdb_assert ((TYPE_CODE (t2) == TYPE_CODE_STRUCT
- || TYPE_CODE (t2) == TYPE_CODE_UNION)
+ gdb_assert ((t2->code () == TYPE_CODE_STRUCT
+ || t2->code () == TYPE_CODE_UNION)
&& !!"Precondition is that value is of STRUCT or UNION kind");
if (TYPE_NAME (t1) != NULL
struct type *t1 = check_typedef (TYPE_TARGET_TYPE (type1));
struct type *t2 = check_typedef (TYPE_TARGET_TYPE (type2));
- if (TYPE_CODE (t1) == TYPE_CODE_STRUCT
- && TYPE_CODE (t2) == TYPE_CODE_STRUCT
+ if (t1->code () == TYPE_CODE_STRUCT
+ && t2->code () == TYPE_CODE_STRUCT
&& (subclass_check || !value_logical_not (arg2)))
{
struct value *v2;
v2 = coerce_ref (arg2);
else
v2 = value_ind (arg2);
- gdb_assert (TYPE_CODE (check_typedef (value_type (v2)))
+ gdb_assert (check_typedef (value_type (v2))->code ()
== TYPE_CODE_STRUCT && !!"Why did coercion fail?");
v2 = value_cast_structs (t1, v2);
/* At this point we have what we can have, un-dereference if needed. */
struct type *dereftype = check_typedef (TYPE_TARGET_TYPE (t1));
struct value *val = value_cast (dereftype, arg2);
- return value_ref (val, TYPE_CODE (t1));
+ return value_ref (val, t1->code ());
}
if (TYPE_IS_REFERENCE (check_typedef (value_type (arg2))))
struct type *to_type = type;
type = check_typedef (type);
- code1 = TYPE_CODE (type);
+ code1 = type->code ();
arg2 = coerce_ref (arg2);
type2 = check_typedef (value_type (arg2));
}
if (current_language->c_style_arrays
- && TYPE_CODE (type2) == TYPE_CODE_ARRAY
+ && type2->code () == TYPE_CODE_ARRAY
&& !TYPE_VECTOR (type2))
arg2 = value_coerce_array (arg2);
- if (TYPE_CODE (type2) == TYPE_CODE_FUNC)
+ if (type2->code () == TYPE_CODE_FUNC)
arg2 = value_coerce_function (arg2);
type2 = check_typedef (value_type (arg2));
- code2 = TYPE_CODE (type2);
+ code2 = type2->code ();
if (code1 == TYPE_CODE_COMPLEX)
return cast_into_complex (to_type, arg2);
arg_type = value_type (arg);
- dest_code = TYPE_CODE (real_type);
- arg_code = TYPE_CODE (arg_type);
+ dest_code = real_type->code ();
+ arg_code = arg_type->code ();
/* We can convert pointer types, or any pointer type to int, or int
type to pointer. */
if (is_ref)
result = value_cast (type, value_ref (value_ind (result),
- TYPE_CODE (type)));
+ type->code ()));
return result;
}
CORE_ADDR addr;
int is_ref = TYPE_IS_REFERENCE (resolved_type);
- if (TYPE_CODE (resolved_type) != TYPE_CODE_PTR
+ if (resolved_type->code () != TYPE_CODE_PTR
&& !TYPE_IS_REFERENCE (resolved_type))
error (_("Argument to dynamic_cast must be a pointer or reference type"));
- if (TYPE_CODE (TYPE_TARGET_TYPE (resolved_type)) != TYPE_CODE_VOID
- && TYPE_CODE (TYPE_TARGET_TYPE (resolved_type)) != TYPE_CODE_STRUCT)
+ if (TYPE_TARGET_TYPE (resolved_type)->code () != TYPE_CODE_VOID
+ && TYPE_TARGET_TYPE (resolved_type)->code () != TYPE_CODE_STRUCT)
error (_("Argument to dynamic_cast must be pointer to class or `void *'"));
class_type = check_typedef (TYPE_TARGET_TYPE (resolved_type));
- if (TYPE_CODE (resolved_type) == TYPE_CODE_PTR)
+ if (resolved_type->code () == TYPE_CODE_PTR)
{
- if (TYPE_CODE (arg_type) != TYPE_CODE_PTR
- && ! (TYPE_CODE (arg_type) == TYPE_CODE_INT
+ if (arg_type->code () != TYPE_CODE_PTR
+ && ! (arg_type->code () == TYPE_CODE_INT
&& value_as_long (arg) == 0))
error (_("Argument to dynamic_cast does not have pointer type"));
- if (TYPE_CODE (arg_type) == TYPE_CODE_PTR)
+ if (arg_type->code () == TYPE_CODE_PTR)
{
arg_type = check_typedef (TYPE_TARGET_TYPE (arg_type));
- if (TYPE_CODE (arg_type) != TYPE_CODE_STRUCT)
+ if (arg_type->code () != TYPE_CODE_STRUCT)
error (_("Argument to dynamic_cast does "
"not have pointer to class type"));
}
}
else
{
- if (TYPE_CODE (arg_type) != TYPE_CODE_STRUCT)
+ if (arg_type->code () != TYPE_CODE_STRUCT)
error (_("Argument to dynamic_cast does not have class type"));
}
/* dynamic_cast<void *> means to return a pointer to the
most-derived object. */
- if (TYPE_CODE (resolved_type) == TYPE_CODE_PTR
- && TYPE_CODE (TYPE_TARGET_TYPE (resolved_type)) == TYPE_CODE_VOID)
+ if (resolved_type->code () == TYPE_CODE_PTR
+ && TYPE_TARGET_TYPE (resolved_type)->code () == TYPE_CODE_VOID)
return value_at_lazy (type, addr);
tem = value_at (type, addr);
&result) == 1)
return value_cast (type,
is_ref
- ? value_ref (result, TYPE_CODE (resolved_type))
+ ? value_ref (result, resolved_type->code ())
: value_addr (result));
}
rtti_type, &result) == 1)
return value_cast (type,
is_ref
- ? value_ref (result, TYPE_CODE (resolved_type))
+ ? value_ref (result, resolved_type->code ())
: value_addr (result));
- if (TYPE_CODE (resolved_type) == TYPE_CODE_PTR)
+ if (resolved_type->code () == TYPE_CODE_PTR)
return value_zero (type, not_lval);
error (_("dynamic_cast failed"));
{
val = value_from_longest (type, (LONGEST) 1);
}
- else if (TYPE_CODE (type1) == TYPE_CODE_ARRAY && TYPE_VECTOR (type1))
+ else if (type1->code () == TYPE_CODE_ARRAY && TYPE_VECTOR (type1))
{
struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type1));
int i;
{
struct value *val;
- if (TYPE_CODE (check_typedef (type)) == TYPE_CODE_VOID)
+ if (check_typedef (type)->code () == TYPE_CODE_VOID)
error (_("Attempt to dereference a generic pointer."));
val = value_from_contents_and_address (type, NULL, addr);
in the case of pointer types. For object types, the enclosing type
and embedded offset must *not* be copied: the target object refered
to by TOVAL retains its original dynamic type after assignment. */
- if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ if (type->code () == TYPE_CODE_PTR)
{
set_value_enclosing_type (val, value_enclosing_type (fromval));
set_value_pointed_to_offset (val, value_pointed_to_offset (fromval));
type = value_type (val);
if ((VALUE_LVAL (val) == lval_memory && value_lazy (val))
- || TYPE_CODE (type) == TYPE_CODE_FUNC)
+ || type->code () == TYPE_CODE_FUNC)
{
CORE_ADDR addr = value_address (val);
valtype = check_typedef (value_type (val));
- switch (TYPE_CODE (valtype))
+ switch (valtype->code ())
{
case TYPE_CODE_ARRAY:
return TYPE_VECTOR (valtype) ? 0 : 1;
return arg2;
}
}
- if (TYPE_CODE (type) == TYPE_CODE_FUNC)
+ if (type->code () == TYPE_CODE_FUNC)
return value_coerce_function (arg1);
/* If this is an array that has not yet been pushed to the target,
gdb_assert (refcode == TYPE_CODE_REF || refcode == TYPE_CODE_RVALUE_REF);
- if ((TYPE_CODE (type) == TYPE_CODE_REF
- || TYPE_CODE (type) == TYPE_CODE_RVALUE_REF)
- && TYPE_CODE (type) == refcode)
+ if ((type->code () == TYPE_CODE_REF
+ || type->code () == TYPE_CODE_RVALUE_REF)
+ && type->code () == refcode)
return arg1;
arg2 = value_addr (arg1);
}
}
- if (TYPE_CODE (base_type) == TYPE_CODE_PTR)
+ if (base_type->code () == TYPE_CODE_PTR)
{
struct type *enc_type;
enc_type = check_typedef (value_enclosing_type (arg1));
enc_type = TYPE_TARGET_TYPE (enc_type);
- if (TYPE_CODE (check_typedef (enc_type)) == TYPE_CODE_FUNC
- || TYPE_CODE (check_typedef (enc_type)) == TYPE_CODE_METHOD)
+ if (check_typedef (enc_type)->code () == TYPE_CODE_FUNC
+ || check_typedef (enc_type)->code () == TYPE_CODE_METHOD)
/* For functions, go through find_function_addr, which knows
how to handle function descriptors. */
arg2 = value_at_lazy (enc_type,
t2 ++;
for (i = 0;
- (i < nargs) && TYPE_CODE (t1[i].type) != TYPE_CODE_VOID;
+ (i < nargs) && t1[i].type->code () != TYPE_CODE_VOID;
i++)
{
struct type *tt1, *tt2;
if (TYPE_IS_REFERENCE (tt1)
/* We should be doing hairy argument matching, as below. */
- && (TYPE_CODE (check_typedef (TYPE_TARGET_TYPE (tt1)))
- == TYPE_CODE (tt2)))
+ && (check_typedef (TYPE_TARGET_TYPE (tt1))->code ()
+ == tt2->code ()))
{
- if (TYPE_CODE (tt2) == TYPE_CODE_ARRAY)
+ if (tt2->code () == TYPE_CODE_ARRAY)
t2[i] = value_coerce_array (t2[i]);
else
- t2[i] = value_ref (t2[i], TYPE_CODE (tt1));
+ t2[i] = value_ref (t2[i], tt1->code ());
continue;
}
char *>, and properly access map["hello"], because the
argument to [] will be a reference to a pointer to a char,
and the argument will be a pointer to a char. */
- while (TYPE_IS_REFERENCE (tt1) || TYPE_CODE (tt1) == TYPE_CODE_PTR)
+ while (TYPE_IS_REFERENCE (tt1) || tt1->code () == TYPE_CODE_PTR)
{
- tt1 = check_typedef( TYPE_TARGET_TYPE(tt1) );
+ tt1 = check_typedef ( TYPE_TARGET_TYPE (tt1) );
}
- while (TYPE_CODE(tt2) == TYPE_CODE_ARRAY
- || TYPE_CODE(tt2) == TYPE_CODE_PTR
+ while (tt2->code () == TYPE_CODE_ARRAY
+ || tt2->code () == TYPE_CODE_PTR
|| TYPE_IS_REFERENCE (tt2))
{
- tt2 = check_typedef (TYPE_TARGET_TYPE(tt2));
+ tt2 = check_typedef (TYPE_TARGET_TYPE (tt2));
}
- if (TYPE_CODE (tt1) == TYPE_CODE (tt2))
+ if (tt1->code () == tt2->code ())
continue;
/* Array to pointer is a `trivial conversion' according to the
ARM. */
/* We should be doing much hairier argument matching (see
section 13.2 of the ARM), but as a quick kludge, just check
for the same type code. */
- if (TYPE_CODE (t1[i].type) != TYPE_CODE (value_type (t2[i])))
+ if (t1[i].type->code () != value_type (t2[i])->code ())
return i + 1;
}
if (varargs || t2[i] == NULL)
{
struct type *field_type = TYPE_FIELD_TYPE (type, i);
- if (TYPE_CODE (field_type) == TYPE_CODE_UNION
- || TYPE_CODE (field_type) == TYPE_CODE_STRUCT)
+ if (field_type->code () == TYPE_CODE_UNION
+ || field_type->code () == TYPE_CODE_STRUCT)
{
/* Look for a match through the fields of an anonymous
union, or anonymous struct. C++ provides anonymous
from GDB) implementation of variant records, the
bitpos is zero in an anonymous union field, so we
have to add the offset of the union here. */
- if (TYPE_CODE (field_type) == TYPE_CODE_STRUCT
+ if (field_type->code () == TYPE_CODE_STRUCT
|| (TYPE_NFIELDS (field_type) > 0
&& TYPE_FIELD_BITPOS (field_type, 0) == 0))
new_offset += TYPE_FIELD_BITPOS (type, i) / 8;
/* Follow pointers until we get to a non-pointer. */
- while (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t))
+ while (t->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t))
{
*argp = value_ind (*argp);
/* Don't coerce fn pointer to fn and then back again! */
- if (TYPE_CODE (check_typedef (value_type (*argp))) != TYPE_CODE_FUNC)
+ if (check_typedef (value_type (*argp))->code () != TYPE_CODE_FUNC)
*argp = coerce_array (*argp);
t = check_typedef (value_type (*argp));
}
- if (TYPE_CODE (t) != TYPE_CODE_STRUCT
- && TYPE_CODE (t) != TYPE_CODE_UNION)
+ if (t->code () != TYPE_CODE_STRUCT
+ && t->code () != TYPE_CODE_UNION)
error (_("Attempt to extract a component of a value that is not a %s."),
err);
t = check_typedef (value_type (*argp));
- while (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t))
+ while (t->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t))
{
*argp = value_ind (*argp);
- if (TYPE_CODE (check_typedef (value_type (*argp))) != TYPE_CODE_FUNC)
+ if (check_typedef (value_type (*argp))->code () != TYPE_CODE_FUNC)
*argp = coerce_array (*argp);
t = check_typedef (value_type (*argp));
}
- if (TYPE_CODE (t) != TYPE_CODE_STRUCT
- && TYPE_CODE (t) != TYPE_CODE_UNION)
+ if (t->code () != TYPE_CODE_STRUCT
+ && t->code () != TYPE_CODE_UNION)
error (_("Attempt to extract a component of a value that is not a %s."),
err);
t = check_typedef (value_type (*argp));
/* Code snarfed from value_struct_elt. */
- while (TYPE_CODE (t) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t))
+ while (t->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (t))
{
*argp = value_ind (*argp);
/* Don't coerce fn pointer to fn and then back again! */
- if (TYPE_CODE (check_typedef (value_type (*argp))) != TYPE_CODE_FUNC)
+ if (check_typedef (value_type (*argp))->code () != TYPE_CODE_FUNC)
*argp = coerce_array (*argp);
t = check_typedef (value_type (*argp));
}
- if (TYPE_CODE (t) != TYPE_CODE_STRUCT
- && TYPE_CODE (t) != TYPE_CODE_UNION)
+ if (t->code () != TYPE_CODE_STRUCT
+ && t->code () != TYPE_CODE_UNION)
error (_("Attempt to extract a component of a "
"value that is not a struct or union"));
/* OBJ may be a pointer value rather than the object itself. */
obj = coerce_ref (obj);
- while (TYPE_CODE (check_typedef (value_type (obj))) == TYPE_CODE_PTR)
+ while (check_typedef (value_type (obj))->code () == TYPE_CODE_PTR)
obj = coerce_ref (value_ind (obj));
obj_type_name = TYPE_NAME (value_type (obj));
/* First check whether this is a data member, e.g. a pointer to
a function. */
- if (TYPE_CODE (check_typedef (value_type (obj))) == TYPE_CODE_STRUCT)
+ if (check_typedef (value_type (obj))->code () == TYPE_CODE_STRUCT)
{
*valp = search_struct_field (name, obj,
check_typedef (value_type (obj)), 0);
the function part. Do not try this for non-functions (e.g.
function pointers). */
if (qualified_name
- && TYPE_CODE (check_typedef (SYMBOL_TYPE (fsym)))
- == TYPE_CODE_FUNC)
+ && (check_typedef (SYMBOL_TYPE (fsym))->code ()
+ == TYPE_CODE_FUNC))
{
temp_func = cp_func_name (qualified_name);
struct type *temp_type = check_typedef (value_type (temp));
struct type *objtype = check_typedef (obj_type);
- if (TYPE_CODE (temp_type) != TYPE_CODE_PTR
- && (TYPE_CODE (objtype) == TYPE_CODE_PTR
+ if (temp_type->code () != TYPE_CODE_PTR
+ && (objtype->code () == TYPE_CODE_PTR
|| TYPE_IS_REFERENCE (objtype)))
{
temp = value_addr (temp);
int i;
int name_len = strlen (name);
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_ENUM
+ gdb_assert (type->code () == TYPE_CODE_ENUM
&& TYPE_DECLARED_CLASS (type));
for (i = TYPE_N_BASECLASSES (type); i < TYPE_NFIELDS (type); ++i)
struct type *expect_type, int want_address,
enum noside noside)
{
- switch (TYPE_CODE (curtype))
+ switch (curtype->code ())
{
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
/* Special case: a method taking void. T1 will contain no
non-artificial fields, and T2 will contain TYPE_CODE_VOID. */
if ((TYPE_NFIELDS (t1) - start) == 0 && TYPE_NFIELDS (t2) == 1
- && TYPE_CODE (TYPE_FIELD_TYPE (t2, 0)) == TYPE_CODE_VOID)
+ && TYPE_FIELD_TYPE (t2, 0)->code () == TYPE_CODE_VOID)
return 1;
if ((TYPE_NFIELDS (t1) - start) == TYPE_NFIELDS (t2))
int i;
struct value *result;
- if (TYPE_CODE (t) != TYPE_CODE_STRUCT
- && TYPE_CODE (t) != TYPE_CODE_UNION)
+ if (t->code () != TYPE_CODE_STRUCT
+ && t->code () != TYPE_CODE_UNION)
error (_("Internal error: non-aggregate type "
"to value_struct_elt_for_reference"));
ptr = value_aggregate_elt (domain, name, NULL, 1, noside);
type = check_typedef (value_type (ptr));
gdb_assert (type != NULL
- && TYPE_CODE (type) == TYPE_CODE_MEMBERPTR);
+ && type->code () == TYPE_CODE_MEMBERPTR);
tmp = lookup_pointer_type (TYPE_SELF_TYPE (type));
v = value_cast_pointers (tmp, v, 1);
mem_offset = value_as_long (ptr);
as a pointer to a method. */
/* Perform all necessary dereferencing. */
- while (intype && TYPE_CODE (intype) == TYPE_CODE_PTR)
+ while (intype && intype->code () == TYPE_CODE_PTR)
intype = TYPE_TARGET_TYPE (intype);
for (i = TYPE_NFN_FIELDS (t) - 1; i >= 0; --i)
type = check_typedef (type);
if (TYPE_IS_REFERENCE (type))
target = coerce_ref (v);
- else if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ else if (type->code () == TYPE_CODE_PTR)
{
try
real_type = make_cv_type (TYPE_CONST (target_type),
TYPE_VOLATILE (target_type), real_type, NULL);
if (TYPE_IS_REFERENCE (type))
- real_type = lookup_reference_type (real_type, TYPE_CODE (type));
- else if (TYPE_CODE (type) == TYPE_CODE_PTR)
+ real_type = lookup_reference_type (real_type, type->code ());
+ else if (type->code () == TYPE_CODE_PTR)
real_type = lookup_pointer_type (real_type);
else
internal_error (__FILE__, __LINE__, _("Unexpected value type."));
struct type *array_type;
array_type = check_typedef (value_type (array));
- if (TYPE_CODE (array_type) != TYPE_CODE_ARRAY
- && TYPE_CODE (array_type) != TYPE_CODE_STRING)
+ if (array_type->code () != TYPE_CODE_ARRAY
+ && array_type->code () != TYPE_CODE_STRING)
error (_("cannot take slice of non-array"));
if (type_not_allocated (array_type))
slice_type = create_array_type (NULL,
element_type,
slice_range_type);
- slice_type->set_code (TYPE_CODE (array_type));
+ slice_type->set_code (array_type->code ());
if (VALUE_LVAL (array) == lval_memory && value_lazy (array))
slice = allocate_value_lazy (slice_type);
struct type *type = check_typedef (value_type (value));
struct type *ttype = TYPE_TARGET_TYPE (type);
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_COMPLEX);
+ gdb_assert (type->code () == TYPE_CODE_COMPLEX);
return value_from_component (value, ttype, 0);
}
struct type *type = check_typedef (value_type (value));
struct type *ttype = TYPE_TARGET_TYPE (type);
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_COMPLEX);
+ gdb_assert (type->code () == TYPE_CODE_COMPLEX);
return value_from_component (value, ttype,
TYPE_LENGTH (check_typedef (ttype)));
}
{
struct type *real_type = TYPE_TARGET_TYPE (type);
- if (TYPE_CODE (value_type (val)) == TYPE_CODE_COMPLEX)
+ if (value_type (val)->code () == TYPE_CODE_COMPLEX)
{
struct type *val_real_type = TYPE_TARGET_TYPE (value_type (val));
struct value *re_val = allocate_value (val_real_type);
return value_literal_complex (re_val, im_val, type);
}
- else if (TYPE_CODE (value_type (val)) == TYPE_CODE_FLT
- || TYPE_CODE (value_type (val)) == TYPE_CODE_INT)
+ else if (value_type (val)->code () == TYPE_CODE_FLT
+ || value_type (val)->code () == TYPE_CODE_INT)
return value_literal_complex (val,
value_zero (real_type, not_lval),
type);
type = TYPE_TARGET_TYPE (type);
type = check_typedef (type);
}
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_ARRAY:
case TYPE_CODE_STRUCT:
return 0;
}
- if (TYPE_CODE (type) != TYPE_CODE_UNION
- && TYPE_CODE (type) != TYPE_CODE_STRUCT
- && TYPE_CODE (type) != TYPE_CODE_ARRAY)
+ if (type->code () != TYPE_CODE_UNION
+ && type->code () != TYPE_CODE_STRUCT
+ && type->code () != TYPE_CODE_ARRAY)
{
if (value_bits_any_optimized_out (val,
TARGET_CHAR_BIT * embedded_offset,
if (value_bits_synthetic_pointer (val, TARGET_CHAR_BIT * embedded_offset,
TARGET_CHAR_BIT * TYPE_LENGTH (type)))
{
- const int is_ref = TYPE_CODE (type) == TYPE_CODE_REF;
+ const int is_ref = type->code () == TYPE_CODE_REF;
int ref_is_addressable = 0;
if (is_ref)
{
struct gdbarch *gdbarch = get_type_arch (type);
- if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
+ if (elttype->code () == TYPE_CODE_FUNC)
{
/* Try to print what function it points to. */
print_function_pointer_address (options, gdbarch, address, stream);
TARGET_CHAR_BIT * TYPE_LENGTH (type));
const int must_coerce_ref = ((options->addressprint && value_is_synthetic)
|| options->deref_ref);
- const int type_is_defined = TYPE_CODE (elttype) != TYPE_CODE_UNDEF;
+ const int type_is_defined = elttype->code () != TYPE_CODE_UNDEF;
const gdb_byte *valaddr = value_contents_for_printing (original_value);
if (must_coerce_ref && type_is_defined)
struct type *type = value_type (val);
type = check_typedef (type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_ARRAY:
generic_val_print_array (val, stream, recurse, options, decorations);
case TYPE_CODE_METHODPTR:
default:
error (_("Unhandled type code %d in symbol table."),
- TYPE_CODE (type));
+ type->code ());
}
}
return 0;
}
- if (TYPE_CODE (value_type (val)) == TYPE_CODE_INTERNAL_FUNCTION)
+ if (value_type (val)->code () == TYPE_CODE_INTERNAL_FUNCTION)
{
fprintf_styled (stream, metadata_style.style (),
_("<internal function %s>"),
fprintf_filtered (stream, " %ps=",
styled_string (variable_name_style.style (),
TYPE_FIELD_NAME (type, field)));
- if (TYPE_CODE (field_type) == TYPE_CODE_ENUM)
+ if (field_type->code () == TYPE_CODE_ENUM)
generic_val_print_enum_1 (field_type, field_val, stream);
else
print_longest (stream, 'd', 0, field_val);
if (get_array_bounds (type, &low_bound, &high_bound))
{
- if (TYPE_CODE (index_type) == TYPE_CODE_RANGE)
+ if (index_type->code () == TYPE_CODE_RANGE)
base_index_type = TYPE_TARGET_TYPE (index_type);
else
base_index_type = index_type;
{
/* If result's target type is TYPE_CODE_STRUCT, proceed to
fetch its rtti type. */
- if ((TYPE_CODE (result) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (result))
- && TYPE_CODE (check_typedef (TYPE_TARGET_TYPE (result)))
- == TYPE_CODE_STRUCT
+ if ((result->code () == TYPE_CODE_PTR || TYPE_IS_REFERENCE (result))
+ && (check_typedef (TYPE_TARGET_TYPE (result))->code ()
+ == TYPE_CODE_STRUCT)
&& !value_optimized_out (value))
{
struct type *real_type;
{
struct type *type = check_typedef (value_type (var->u.value));
- if (TYPE_CODE (type) == TYPE_CODE_INT)
+ if (type->code () == TYPE_CODE_INT)
{
*result = value_as_long (var->u.value);
return 1;
error (_("Cannot overwrite convenience function %s"), var->name);
/* Prepare new contents. */
- switch (TYPE_CODE (check_typedef (value_type (val))))
+ switch (check_typedef (value_type (val))->code ())
{
case TYPE_CODE_VOID:
new_kind = INTERNALVAR_VOID;
struct type *
result_type_of_xmethod (struct value *method, gdb::array_view<value *> argv)
{
- gdb_assert (TYPE_CODE (value_type (method)) == TYPE_CODE_XMETHOD
+ gdb_assert (value_type (method)->code () == TYPE_CODE_XMETHOD
&& method->lval == lval_xcallable && !argv.empty ());
return method->location.xm_worker->get_result_type (argv[0], argv.slice (1));
struct value *
call_xmethod (struct value *method, gdb::array_view<value *> argv)
{
- gdb_assert (TYPE_CODE (value_type (method)) == TYPE_CODE_XMETHOD
+ gdb_assert (value_type (method)->code () == TYPE_CODE_XMETHOD
&& method->lval == lval_xcallable && !argv.empty ());
return method->location.xm_worker->invoke (argv[0], argv.slice (1));
The following shortcut avoids this whole mess. If VAL is a
function, just return its address directly. */
- if (TYPE_CODE (value_type (val)) == TYPE_CODE_FUNC
- || TYPE_CODE (value_type (val)) == TYPE_CODE_METHOD)
+ if (value_type (val)->code () == TYPE_CODE_FUNC
+ || value_type (val)->code () == TYPE_CODE_METHOD)
return value_address (val);
val = coerce_array (val);
converted to pointers; usually, the ABI doesn't either, but
ABI-specific code is a more reasonable place to handle it. */
- if (TYPE_CODE (value_type (val)) != TYPE_CODE_PTR
+ if (value_type (val)->code () != TYPE_CODE_PTR
&& !TYPE_IS_REFERENCE (value_type (val))
&& gdbarch_integer_to_address_p (gdbarch))
return gdbarch_integer_to_address (gdbarch, value_type (val),
unpack_long (struct type *type, const gdb_byte *valaddr)
{
enum bfd_endian byte_order = type_byte_order (type);
- enum type_code code = TYPE_CODE (type);
+ enum type_code code = type->code ();
int len = TYPE_LENGTH (type);
int nosign = TYPE_UNSIGNED (type);
type = check_typedef (type);
len = TYPE_LENGTH (type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_RANGE:
num -= TYPE_RANGE_DATA (type)->bias;
default:
error (_("Unexpected type (%d) encountered for integer constant."),
- TYPE_CODE (type));
+ type->code ());
}
}
len = TYPE_LENGTH (type);
byte_order = type_byte_order (type);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_INT:
case TYPE_CODE_CHAR:
default:
error (_("Unexpected type (%d) encountered "
"for unsigned integer constant."),
- TYPE_CODE (type));
+ type->code ());
}
}
value_from_host_double (struct type *type, double d)
{
struct value *value = allocate_value (type);
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT);
+ gdb_assert (type->code () == TYPE_CODE_FLT);
target_float_from_host_double (value_contents_raw (value),
value_type (value), d);
return value;
arg = coerce_ref (arg);
type = check_typedef (value_type (arg));
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_ARRAY:
if (!TYPE_VECTOR (type) && current_language->c_style_arrays)
struct_return_convention (struct gdbarch *gdbarch,
struct value *function, struct type *value_type)
{
- enum type_code code = TYPE_CODE (value_type);
+ enum type_code code = value_type->code ();
if (code == TYPE_CODE_ERROR)
error (_("Function return type unknown."));
using_struct_return (struct gdbarch *gdbarch,
struct value *function, struct type *value_type)
{
- if (TYPE_CODE (value_type) == TYPE_CODE_VOID)
+ if (value_type->code () == TYPE_CODE_VOID)
/* A void return value is never in memory. See also corresponding
code in "print_return_value". */
return 0;
if (argc != 1)
error (_("You must provide one argument for $_isvoid."));
- ret = TYPE_CODE (value_type (argv[0])) == TYPE_CODE_VOID;
+ ret = value_type (argv[0])->code () == TYPE_CODE_VOID;
return value_from_longest (builtin_type (gdbarch)->builtin_int, ret);
}
value *cval = argv[0];
type *ctype = check_typedef (value_type (cval));
- if (TYPE_CODE (ctype) != TYPE_CODE_COMPLEX)
+ if (ctype->code () != TYPE_CODE_COMPLEX)
error (_("expected a complex number"));
return value_real_part (cval);
}
value *cval = argv[0];
type *ctype = check_typedef (value_type (cval));
- if (TYPE_CODE (ctype) != TYPE_CODE_COMPLEX)
+ if (ctype->code () != TYPE_CODE_COMPLEX)
error (_("expected a complex number"));
return value_imaginary_part (cval);
}
if (value)
value = coerce_ref (value);
- if (var->type && TYPE_CODE (var->type) == TYPE_CODE_UNION)
+ if (var->type && var->type->code () == TYPE_CODE_UNION)
/* For unions, we need to fetch the value implicitly because
of implementation of union member fetch. When gdb
creates a value for a field and the value of the enclosing
type = varobj_get_value_type (var);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
type = varobj_get_value_type (var);
- switch (TYPE_CODE (type))
+ switch (type->code ())
{
case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION:
int len = TYPE_LENGTH (type);
gdb_byte buf[8];
- if (TYPE_CODE (type) == TYPE_CODE_STRUCT
- || TYPE_CODE (type) == TYPE_CODE_UNION
- || TYPE_CODE (type) == TYPE_CODE_ARRAY)
+ if (type->code () == TYPE_CODE_STRUCT
+ || type->code () == TYPE_CODE_UNION
+ || type->code () == TYPE_CODE_ARRAY)
{
/* The default on VAX is to return structures in static memory.
Consequently a function must return the address where we can
static int
xstormy16_type_is_scalar (struct type *t)
{
- return (TYPE_CODE(t) != TYPE_CODE_STRUCT
- && TYPE_CODE(t) != TYPE_CODE_UNION
- && TYPE_CODE(t) != TYPE_CODE_ARRAY);
+ return (t->code () != TYPE_CODE_STRUCT
+ && t->code () != TYPE_CODE_UNION
+ && t->code () != TYPE_CODE_ARRAY);
}
/* Function: xstormy16_use_struct_convention
struct type *type, const gdb_byte *buf)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type));
+ enum type_code target = TYPE_TARGET_TYPE (type)->code ();
CORE_ADDR addr
= extract_unsigned_integer (buf, TYPE_LENGTH (type), byte_order);
struct type *type, gdb_byte *buf, CORE_ADDR addr)
{
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
- enum type_code target = TYPE_CODE (TYPE_TARGET_TYPE (type));
+ enum type_code target = TYPE_TARGET_TYPE (type)->code ();
if (target == TYPE_CODE_FUNC || target == TYPE_CODE_METHOD)
{
{
/* Structures up to 16 bytes are returned in registers. */
- int struct_return = ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT
- || TYPE_CODE (valtype) == TYPE_CODE_UNION
- || TYPE_CODE (valtype) == TYPE_CODE_ARRAY)
+ int struct_return = ((valtype->code () == TYPE_CODE_STRUCT
+ || valtype->code () == TYPE_CODE_UNION
+ || valtype->code () == TYPE_CODE_ARRAY)
&& TYPE_LENGTH (valtype) > 16);
if (struct_return)
fprintf_unfiltered (gdb_stdlog, "%2d: %s %3s ", i,
host_address_to_string (arg),
pulongest (TYPE_LENGTH (arg_type)));
- switch (TYPE_CODE (arg_type))
+ switch (arg_type->code ())
{
case TYPE_CODE_INT:
fprintf_unfiltered (gdb_stdlog, "int");
fprintf_unfiltered (gdb_stdlog, "struct");
break;
default:
- fprintf_unfiltered (gdb_stdlog, "%3d", TYPE_CODE (arg_type));
+ fprintf_unfiltered (gdb_stdlog, "%3d", arg_type->code ());
break;
}
fprintf_unfiltered (gdb_stdlog, " %s\n",
struct value *arg = args[i];
struct type *arg_type = check_typedef (value_type (arg));
- switch (TYPE_CODE (arg_type))
+ switch (arg_type->code ())
{
case TYPE_CODE_INT:
case TYPE_CODE_BOOL: