/* No superclass found, just change the pointer type. */
arg2 = value_copy (arg2);
deprecated_set_value_type (arg2, type);
- arg2 = value_change_enclosing_type (arg2, type);
+ set_value_enclosing_type (arg2, type);
set_value_pointed_to_offset (arg2, 0); /* pai: chk_val */
return arg2;
}
/* Widen the scalar to a vector. */
struct type *eltype;
struct value *val;
- int i, n;
+ LONGEST low_bound, high_bound;
+ int i;
+
+ if (!get_array_bounds (type, &low_bound, &high_bound))
+ error (_("Could not determine the vector bounds"));
eltype = check_typedef (TYPE_TARGET_TYPE (type));
arg2 = value_cast (eltype, arg2);
val = allocate_value (type);
- n = TYPE_LENGTH (type) / TYPE_LENGTH (eltype);
- for (i = 0; i < n; i++)
+ for (i = 0; i < high_bound - low_bound + 1; i++)
{
/* Duplicate the contents of arg2 into the destination vector. */
memcpy (value_contents_writeable (val) + (i * TYPE_LENGTH (eltype)),
arg2 = value_copy (arg2);
deprecated_set_value_type (arg2, type);
- arg2 = value_change_enclosing_type (arg2, type);
+ set_value_enclosing_type (arg2, type);
set_value_pointed_to_offset (arg2, 0); /* pai: chk_val */
return arg2;
}
{
val = value_from_longest (type, (LONGEST) 1);
}
+ else if (TYPE_CODE (type1) == TYPE_CODE_ARRAY && TYPE_VECTOR (type1))
+ {
+ struct type *eltype = check_typedef (TYPE_TARGET_TYPE (type1));
+ int i, n = TYPE_LENGTH (type1) / TYPE_LENGTH (eltype);
+ struct value *tmp;
+
+ val = allocate_value (type);
+ for (i = 0; i < n; i++)
+ {
+ tmp = value_one (eltype, lv);
+ memcpy (value_contents_writeable (val) + i * TYPE_LENGTH (eltype),
+ value_contents_all (tmp), TYPE_LENGTH (eltype));
+ }
+ }
else
{
error (_("Not a numeric type."));
case lval_internalvar:
set_internalvar (VALUE_INTERNALVAR (toval), fromval);
val = value_copy (fromval);
- val = value_change_enclosing_type (val,
- value_enclosing_type (fromval));
+ set_value_enclosing_type (val, value_enclosing_type (fromval));
set_value_embedded_offset (val, value_embedded_offset (fromval));
- set_value_pointed_to_offset (val,
- value_pointed_to_offset (fromval));
+ set_value_pointed_to_offset (val, value_pointed_to_offset (fromval));
return val;
case lval_internalvar_component:
memcpy (value_contents_raw (val), value_contents (fromval),
TYPE_LENGTH (type));
deprecated_set_value_type (val, type);
- val = value_change_enclosing_type (val,
- value_enclosing_type (fromval));
+ set_value_enclosing_type (val, value_enclosing_type (fromval));
set_value_embedded_offset (val, value_embedded_offset (fromval));
set_value_pointed_to_offset (val, value_pointed_to_offset (fromval));
/* This may be a pointer to a base subobject; so remember the
full derived object's type ... */
- arg2 = value_change_enclosing_type (arg2, lookup_pointer_type (value_enclosing_type (arg1)));
+ set_value_enclosing_type (arg2,
+ lookup_pointer_type (value_enclosing_type (arg1)));
/* ... and also the relative position of the subobject in the full
object. */
set_value_pointed_to_offset (arg2, value_embedded_offset (arg1));
base_type = check_typedef (value_type (arg1));
+ if (VALUE_LVAL (arg1) == lval_computed)
+ {
+ struct lval_funcs *funcs = value_computed_funcs (arg1);
+
+ if (funcs->indirect)
+ {
+ struct value *result = funcs->indirect (arg1);
+
+ if (result)
+ return result;
+ }
+ }
+
if (TYPE_CODE (base_type) == TYPE_CODE_PTR)
{
struct type *enc_type;
/* Re-adjust type. */
deprecated_set_value_type (arg2, TYPE_TARGET_TYPE (base_type));
/* Add embedding info. */
- arg2 = value_change_enclosing_type (arg2, enc_type);
+ set_value_enclosing_type (arg2, enc_type);
set_value_embedded_offset (arg2, value_pointed_to_offset (arg1));
/* We may be pointing to an object of some derived type. */
for (jj = 0; jj < nargs - static_offset; jj++)
fprintf_filtered (gdb_stderr,
"...Badness @ %d : %d\n",
- jj, bv->rank[jj]);
+ jj, bv->rank[jj].rank);
fprintf_filtered (gdb_stderr,
"Overload resolution champion is %d, ambiguous? %d\n",
oload_champ, oload_ambiguous);
for (ix = 1; ix <= nargs - static_offset; ix++)
{
- if (oload_champ_bv->rank[ix] >= 100)
+ /* If this conversion is as bad as INCOMPATIBLE_TYPE_BADNESS
+ or worse return INCOMPATIBLE. */
+ if (compare_ranks (oload_champ_bv->rank[ix],
+ INCOMPATIBLE_TYPE_BADNESS) <= 0)
return INCOMPATIBLE; /* Truly mismatched types. */
- else if (oload_champ_bv->rank[ix] >= 10)
+ /* Otherwise If this conversion is as bad as
+ NS_POINTER_CONVERSION_BADNESS or worse return NON_STANDARD. */
+ else if (compare_ranks (oload_champ_bv->rank[ix],
+ NS_POINTER_CONVERSION_BADNESS) <= 0)
return NON_STANDARD; /* Non-standard type conversions
needed. */
}
for (i = 0; i < TYPE_NFIELDS (t2); ++i)
{
- if (rank_one_type (TYPE_FIELD_TYPE (t1, start + i),
- TYPE_FIELD_TYPE (t2, i))
- != 0)
+ if (compare_ranks (rank_one_type (TYPE_FIELD_TYPE (t1, start + i),
+ TYPE_FIELD_TYPE (t2, i)),
+ EXACT_MATCH_BADNESS) != 0)
return 0;
}
/* pai: FIXME -- sounds iffy */
if (full)
{
- argp = value_change_enclosing_type (argp, real_type);
+ argp = value_copy (argp);
+ set_value_enclosing_type (argp, real_type);
return argp;
}