* value.h (value_add, value_sub): Remove.
(value_ptradd, value_ptrsub, value_ptrdiff): Add prototypes. * valarith.c (value_add, value_sub): Remove. (value_ptradd, value_ptrsub, value_ptrdiff): New functions. (find_size_for_pointer_math): Add assertion. Update comment. (value_binop): Update comment. * eval.c (ptrmath_type_p): New function. (evaluate_subexp_standard): Replace value_add and value_sub by value_ptradd, value_ptrsub, value_ptrdiff or value_binop. Use builtin_type_uint8 instead of builtin_type_char to hold the increment for BINOP_{PRE,POST}{IN,DE}CREMENT operations. * valarith.c (value_subscript): Replace value_add by value_ptradd. Replace value_sub by value_binop. * ada-lang.c (ada_value_ptr_subscript): Likewise. (ada_tag_name_2): Replace value_add by value_ptradd. (ada_evaluate_subexp): Replace value_add and value_sub by value_binop. * m2-lang.c (evaluate_subexp_modula2): Replace value_add by value_ptradd. * gnu-v2-abi.c (gnuv2_virtual_fn_field): Likewise. * gnu-v3-abi.c (gnuv3_method_ptr_to_value): Likewise.
This commit is contained in:
parent
98b90dd888
commit
89eef11460
8 changed files with 158 additions and 92 deletions
|
@ -2362,8 +2362,10 @@ ada_value_ptr_subscript (struct value *arr, struct type *type, int arity,
|
|||
get_discrete_bounds (TYPE_INDEX_TYPE (type), &lwb, &upb);
|
||||
idx = value_pos_atr (ind[k]);
|
||||
if (lwb != 0)
|
||||
idx = value_sub (idx, value_from_longest (builtin_type_int, lwb));
|
||||
arr = value_add (arr, idx);
|
||||
idx = value_binop (idx, value_from_longest (value_type (idx), lwb),
|
||||
BINOP_SUB);
|
||||
|
||||
arr = value_ptradd (arr, idx);
|
||||
type = TYPE_TARGET_TYPE (type);
|
||||
}
|
||||
|
||||
|
@ -5726,7 +5728,8 @@ ada_tag_name_2 (struct tag_args *args)
|
|||
valp = value_cast (info_type, args->tag);
|
||||
if (valp == NULL)
|
||||
return 0;
|
||||
val = value_ind (value_add (valp, value_from_longest (builtin_type_int, -1)));
|
||||
val = value_ind (value_ptradd (valp,
|
||||
value_from_longest (builtin_type_int8, -1)));
|
||||
if (val == NULL)
|
||||
return 0;
|
||||
val = ada_value_struct_elt (val, "expanded_name", 1);
|
||||
|
@ -8460,7 +8463,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
|
|||
type = value_type (arg1);
|
||||
while (TYPE_CODE (type) == TYPE_CODE_REF)
|
||||
type = TYPE_TARGET_TYPE (type);
|
||||
return value_cast (type, value_add (arg1, arg2));
|
||||
return value_cast (type, value_binop (arg1, arg2, BINOP_ADD));
|
||||
|
||||
case BINOP_SUB:
|
||||
arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
|
||||
|
@ -8481,7 +8484,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
|
|||
type = value_type (arg1);
|
||||
while (TYPE_CODE (type) == TYPE_CODE_REF)
|
||||
type = TYPE_TARGET_TYPE (type);
|
||||
return value_cast (type, value_sub (arg1, arg2));
|
||||
return value_cast (type, value_binop (arg1, arg2, BINOP_SUB));
|
||||
|
||||
case BINOP_MUL:
|
||||
case BINOP_DIV:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue