+Mon Dec 30 10:57:02 1991 Per Bothner (bothner at cygnus.com)
+
+ Mainly stuff to improve handling of TYPE_CODE_REF values.
+ * valops.c (value_addr): If taking the addres of a
+ TYPE_CODE_REF, just cast the object to the corresponding
+ TYPE_CODE_PTR. This yields correct C++ semantics, and
+ preserves the location information, which has the nice effect
+ that &(&R) given the location containing R.
+ * values.c (value_copy): Make non-static (used by value_addr).
+ * eval.c (evaluate_subexp_for_address): Use the default
+ scheme (with value_addr) for a variable if it has TYPE_CODE_REF.
+ * valops.c (value_addr), eval.c (evaluate_subexp_for_address,
+ evaluate_subexp_with_coercion): Factor out some common
+ expressions into variables, for easier reading.
+ * findvar.c (locate_var_value): Remove code to handle
+ TYPE_CODE_REF - it should no longer be needed.
+ * valops.c (value_assign): Do a COERCE_REF on the
+ destination operand, for correct C++ semantics.
+ * valarith.c (value_x_binop): Ditto: De-reference C++
+ references in the arguments.
+ * valops.c: ANSI-fy: bcopy->memcpy, bzero->memset.
+
Sat Dec 28 11:30:26 1991 Per Bothner (bothner at cygnus.com)
* dwarfread.c, coffread.c: Use INIT_CPLUS_SPECIFIC.
{
register value val = allocate_value (type);
- bzero (VALUE_CONTENTS (val), TYPE_LENGTH (type));
+ memset (VALUE_CONTENTS (val), 0, TYPE_LENGTH (type));
VALUE_LVAL (val) = lv;
return val;
int use_buffer = 0;
COERCE_ARRAY (fromval);
+ COERCE_REF (toval);
if (VALUE_LVAL (toval) != lval_internalvar)
fromval = value_cast (type, fromval);
int regno = VALUE_REGNO (toval);
if (VALUE_TYPE (fromval) != REGISTER_VIRTUAL_TYPE (regno))
fromval = value_cast (REGISTER_VIRTUAL_TYPE (regno), fromval);
- bcopy (VALUE_CONTENTS (fromval), virtual_buffer,
+ memcpy (virtual_buffer, VALUE_CONTENTS (fromval),
REGISTER_VIRTUAL_SIZE (regno));
target_convert_from_virtual (regno, virtual_buffer, raw_buffer);
use_buffer = REGISTER_RAW_SIZE (regno);
value_addr (arg1)
value arg1;
{
-
- COERCE_REF(arg1);
+ struct type *type = VALUE_TYPE (arg1);
+ if (TYPE_CODE (type) == TYPE_CODE_REF)
+ {
+ /* Copy the value, but change the type from (T&) to (T*).
+ We keep the same location information, which is efficient,
+ and allows &(&X) to get the location containing the reference. */
+ value arg2 = value_copy (arg1);
+ VALUE_TYPE (arg2) = lookup_pointer_type (TYPE_TARGET_TYPE (type));
+ return arg2;
+ }
if (VALUE_REPEATED (arg1)
- || TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_ARRAY)
+ || TYPE_CODE (type) == TYPE_CODE_ARRAY)
return value_coerce_array (arg1);
- if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_FUNC)
+ if (TYPE_CODE (type) == TYPE_CODE_FUNC)
return value_coerce_function (arg1);
if (VALUE_LVAL (arg1) != lval_memory)
error ("Attempt to take address of value not located in memory.");
- return value_from_longest (lookup_pointer_type (VALUE_TYPE (arg1)),
+ return value_from_longest (lookup_pointer_type (type),
(LONGEST) (VALUE_ADDRESS (arg1) + VALUE_OFFSET (arg1)));
}
error ("cannot resolve overloaded method `%s'", name);
while (j >= 0)
{
- if (TYPE_FLAGS (TYPE_FN_FIELD_TYPE (f, j)) & TYPE_FLAG_STUB)
+ if (TYPE_FN_FIELD_STUB (f, j))
check_stub_method (type, i, j);
if (!typecmp (TYPE_FN_FIELD_STATIC_P (f, j),
TYPE_FN_FIELD_ARGS (f, j), args))
else
j = 0;
- if (TYPE_FLAGS (TYPE_FN_FIELD_TYPE (f, j)) & TYPE_FLAG_STUB)
+ if (TYPE_FN_FIELD_STUB (f, j))
check_stub_method (t, i, j);
if (TYPE_FN_FIELD_VIRTUAL_P (f, j))
{