Remove EVAL_SKIP

EVAL_SKIP was needed in the old expression implementation due to its
linearized tree structure.  This is not needed in the new
implementation, because it is trivial to not evaluate a subexpression.
This patch removes the last vestiges of EVAL_SKIP.

gdb/ChangeLog
2021-03-08  Tom Tromey  <tom@tromey.com>

	* value.h (eval_skip_value): Don't declare.
	* opencl-lang.c (eval_opencl_assign): Update.
	* m2-lang.c (eval_op_m2_high, eval_op_m2_subscript): Update.
	* f-lang.c (eval_op_f_abs, eval_op_f_mod, eval_op_f_ceil)
	(eval_op_f_floor, eval_op_f_modulo, eval_op_f_cmplx): Remove.
	* expression.h (enum noside) <EVAL_SKIP>: Remove.
	* expop.h (typeof_operation::evaluate)
	(decltype_operation::evaluate, unop_addr_operation::evaluate)
	(unop_sizeof_operation::evaluate, assign_operation::evaluate)
	(cxx_cast_operation::evaluate): Update.
	* eval.c (eval_skip_value): Remove.
	(eval_op_scope, eval_op_var_entry_value)
	(eval_op_func_static_var, eval_op_string, eval_op_objc_selector)
	(eval_op_concat, eval_op_ternop, eval_op_structop_struct)
	(eval_op_structop_ptr, eval_op_member, eval_op_add, eval_op_sub)
	(eval_op_binary, eval_op_subscript, eval_op_equal)
	(eval_op_notequal, eval_op_less, eval_op_gtr, eval_op_geq)
	(eval_op_leq, eval_op_repeat, eval_op_plus, eval_op_neg)
	(eval_op_complement, eval_op_lognot, eval_op_ind)
	(eval_op_memval, eval_op_preinc, eval_op_predec)
	(eval_op_postinc, eval_op_postdec, eval_op_type)
	(eval_binop_assign_modify, eval_op_objc_msgcall)
	(eval_multi_subscript, logical_and_operation::evaluate)
	(logical_or_operation::evaluate, array_operation::evaluate)
	(operation::evaluate_for_cast)
	(var_msym_value_operation::evaluate_for_cast)
	(var_value_operation::evaluate_for_cast): Update.
	* c-lang.c (c_string_operation::evaluate): Update.
	* c-exp.h (objc_nsstring_operation::evaluate)
	(objc_selector_operation::evaluate): Update.
	* ada-lang.c (ada_assign_operation::evaluate)
	(eval_ternop_in_range, ada_unop_neg, ada_unop_in_range)
	(ada_atr_size): Update.
This commit is contained in:
Tom Tromey 2021-03-08 07:27:57 -07:00
parent 96db551d06
commit 0b2b0b8220
11 changed files with 56 additions and 164 deletions

View File

@ -1,3 +1,39 @@
2021-03-08 Tom Tromey <tom@tromey.com>
* value.h (eval_skip_value): Don't declare.
* opencl-lang.c (eval_opencl_assign): Update.
* m2-lang.c (eval_op_m2_high, eval_op_m2_subscript): Update.
* f-lang.c (eval_op_f_abs, eval_op_f_mod, eval_op_f_ceil)
(eval_op_f_floor, eval_op_f_modulo, eval_op_f_cmplx): Remove.
* expression.h (enum noside) <EVAL_SKIP>: Remove.
* expop.h (typeof_operation::evaluate)
(decltype_operation::evaluate, unop_addr_operation::evaluate)
(unop_sizeof_operation::evaluate, assign_operation::evaluate)
(cxx_cast_operation::evaluate): Update.
* eval.c (eval_skip_value): Remove.
(eval_op_scope, eval_op_var_entry_value)
(eval_op_func_static_var, eval_op_string, eval_op_objc_selector)
(eval_op_concat, eval_op_ternop, eval_op_structop_struct)
(eval_op_structop_ptr, eval_op_member, eval_op_add, eval_op_sub)
(eval_op_binary, eval_op_subscript, eval_op_equal)
(eval_op_notequal, eval_op_less, eval_op_gtr, eval_op_geq)
(eval_op_leq, eval_op_repeat, eval_op_plus, eval_op_neg)
(eval_op_complement, eval_op_lognot, eval_op_ind)
(eval_op_memval, eval_op_preinc, eval_op_predec)
(eval_op_postinc, eval_op_postdec, eval_op_type)
(eval_binop_assign_modify, eval_op_objc_msgcall)
(eval_multi_subscript, logical_and_operation::evaluate)
(logical_or_operation::evaluate, array_operation::evaluate)
(operation::evaluate_for_cast)
(var_msym_value_operation::evaluate_for_cast)
(var_value_operation::evaluate_for_cast): Update.
* c-lang.c (c_string_operation::evaluate): Update.
* c-exp.h (objc_nsstring_operation::evaluate)
(objc_selector_operation::evaluate): Update.
* ada-lang.c (ada_assign_operation::evaluate)
(eval_ternop_in_range, ada_unop_neg, ada_unop_in_range)
(ada_atr_size): Update.
2021-03-08 Tom Tromey <tom@tromey.com> 2021-03-08 Tom Tromey <tom@tromey.com>
* eval.c: Merge "namespace" scopes. * eval.c: Merge "namespace" scopes.

View File

@ -9360,7 +9360,7 @@ ada_assign_operation::evaluate (struct type *expect_type,
if (VALUE_LVAL (arg1) == lval_internalvar) if (VALUE_LVAL (arg1) == lval_internalvar)
type = NULL; type = NULL;
value *arg2 = std::get<1> (m_storage)->evaluate (type, exp, noside); value *arg2 = std::get<1> (m_storage)->evaluate (type, exp, noside);
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return arg1; return arg1;
if (VALUE_LVAL (arg1) == lval_internalvar) if (VALUE_LVAL (arg1) == lval_internalvar)
{ {
@ -9684,9 +9684,6 @@ eval_ternop_in_range (struct type *expect_type, struct expression *exp,
enum noside noside, enum noside noside,
value *arg1, value *arg2, value *arg3) value *arg1, value *arg2, value *arg3)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2); binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg2);
binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg3); binop_promote (exp->language_defn, exp->gdbarch, &arg1, &arg3);
struct type *type = language_bool_type (exp->language_defn, exp->gdbarch); struct type *type = language_bool_type (exp->language_defn, exp->gdbarch);
@ -9706,8 +9703,6 @@ ada_unop_neg (struct type *expect_type,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1) struct value *arg1)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
unop_promote (exp->language_defn, exp->gdbarch, &arg1); unop_promote (exp->language_defn, exp->gdbarch, &arg1);
return value_neg (arg1); return value_neg (arg1);
} }
@ -9720,9 +9715,6 @@ ada_unop_in_range (struct type *expect_type,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1, struct type *type) struct value *arg1, struct type *type)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
struct value *arg2, *arg3; struct value *arg2, *arg3;
switch (type->code ()) switch (type->code ())
{ {
@ -9779,9 +9771,7 @@ ada_atr_size (struct type *expect_type,
if (type->code () == TYPE_CODE_REF) if (type->code () == TYPE_CODE_REF)
type = TYPE_TARGET_TYPE (type); type = TYPE_TARGET_TYPE (type);
if (noside == EVAL_SKIP) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return eval_skip_value (exp);
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (builtin_type (exp->gdbarch)->builtin_int, not_lval); return value_zero (builtin_type (exp->gdbarch)->builtin_int, not_lval);
else else
return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, return value_from_longest (builtin_type (exp->gdbarch)->builtin_int,

View File

@ -74,8 +74,6 @@ public:
struct expression *exp, struct expression *exp,
enum noside noside) override enum noside noside) override
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
const std::string &str = std::get<0> (m_storage); const std::string &str = std::get<0> (m_storage);
return value_nsstring (exp->gdbarch, str.c_str (), str.size () + 1); return value_nsstring (exp->gdbarch, str.c_str (), str.size () + 1);
} }
@ -95,8 +93,6 @@ public:
struct expression *exp, struct expression *exp,
enum noside noside) override enum noside noside) override
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
return eval_op_objc_selector (expect_type, exp, noside, return eval_op_objc_selector (expect_type, exp, noside,
std::get<0> (m_storage).c_str ()); std::get<0> (m_storage).c_str ());
} }

View File

@ -637,24 +637,9 @@ c_string_operation::evaluate (struct type *expect_type,
dest_charset = charset_for_string_type (dest_type, exp->gdbarch); dest_charset = charset_for_string_type (dest_type, exp->gdbarch);
if (noside != EVAL_SKIP) for (const std::string &item : std::get<1> (m_storage))
{ parse_one_string (&output, item.c_str (), item.size (),
for (const std::string &item : std::get<1> (m_storage)) dest_charset, type);
parse_one_string (&output, item.c_str (), item.size (),
dest_charset, type);
}
if (noside == EVAL_SKIP)
{
/* Return a dummy value of the appropriate type. */
if (expect_type != NULL)
result = allocate_value (expect_type);
else if ((dest_type & C_CHAR) != 0)
result = allocate_value (type);
else
result = value_cstring ("", 0, type);
return result;
}
if ((dest_type & C_CHAR) != 0) if ((dest_type & C_CHAR) != 0)
{ {

View File

@ -601,14 +601,6 @@ evaluate_var_msym_value (enum noside noside,
return value_at_lazy (the_type, address); return value_at_lazy (the_type, address);
} }
/* Helper for returning a value when handling EVAL_SKIP. */
value *
eval_skip_value (expression *exp)
{
return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1);
}
/* See expression.h. */ /* See expression.h. */
value * value *
@ -983,8 +975,6 @@ eval_op_scope (struct type *expect_type, struct expression *exp,
enum noside noside, enum noside noside,
struct type *type, const char *string) struct type *type, const char *string)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
struct value *arg1 = value_aggregate_elt (type, string, expect_type, struct value *arg1 = value_aggregate_elt (type, string, expect_type,
0, noside); 0, noside);
if (arg1 == NULL) if (arg1 == NULL)
@ -998,8 +988,6 @@ struct value *
eval_op_var_entry_value (struct type *expect_type, struct expression *exp, eval_op_var_entry_value (struct type *expect_type, struct expression *exp,
enum noside noside, symbol *sym) enum noside noside, symbol *sym)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (SYMBOL_TYPE (sym), not_lval); return value_zero (SYMBOL_TYPE (sym), not_lval);
@ -1035,8 +1023,6 @@ eval_op_func_static_var (struct type *expect_type, struct expression *exp,
enum noside noside, enum noside noside,
value *func, const char *var) value *func, const char *var)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
CORE_ADDR addr = value_address (func); CORE_ADDR addr = value_address (func);
const block *blk = block_for_pc (addr); const block *blk = block_for_pc (addr);
struct block_symbol sym = lookup_symbol (var, blk, VAR_DOMAIN, NULL); struct block_symbol sym = lookup_symbol (var, blk, VAR_DOMAIN, NULL);
@ -1081,8 +1067,6 @@ struct value *
eval_op_string (struct type *expect_type, struct expression *exp, eval_op_string (struct type *expect_type, struct expression *exp,
enum noside noside, int len, const char *string) enum noside noside, int len, const char *string)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
struct type *type = language_string_char_type (exp->language_defn, struct type *type = language_string_char_type (exp->language_defn,
exp->gdbarch); exp->gdbarch);
return value_string (string, len, type); return value_string (string, len, type);
@ -1095,9 +1079,6 @@ eval_op_objc_selector (struct type *expect_type, struct expression *exp,
enum noside noside, enum noside noside,
const char *sel) const char *sel)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
struct type *selector_type = builtin_type (exp->gdbarch)->builtin_data_ptr; struct type *selector_type = builtin_type (exp->gdbarch)->builtin_data_ptr;
return value_from_longest (selector_type, return value_from_longest (selector_type,
lookup_child_selector (exp->gdbarch, sel)); lookup_child_selector (exp->gdbarch, sel));
@ -1109,8 +1090,6 @@ struct value *
eval_op_concat (struct type *expect_type, struct expression *exp, eval_op_concat (struct type *expect_type, struct expression *exp,
enum noside noside, struct value *arg1, struct value *arg2) enum noside noside, struct value *arg1, struct value *arg2)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
if (binop_user_defined_p (BINOP_CONCAT, arg1, arg2)) if (binop_user_defined_p (BINOP_CONCAT, arg1, arg2))
return value_x_binop (arg1, arg2, BINOP_CONCAT, OP_NULL, noside); return value_x_binop (arg1, arg2, BINOP_CONCAT, OP_NULL, noside);
else else
@ -1124,8 +1103,6 @@ eval_op_ternop (struct type *expect_type, struct expression *exp,
enum noside noside, enum noside noside,
struct value *array, struct value *low, struct value *upper) struct value *array, struct value *low, struct value *upper)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
int lowbound = value_as_long (low); int lowbound = value_as_long (low);
int upperbound = value_as_long (upper); int upperbound = value_as_long (upper);
return value_slice (array, lowbound, upperbound - lowbound + 1); return value_slice (array, lowbound, upperbound - lowbound + 1);
@ -1138,8 +1115,6 @@ eval_op_structop_struct (struct type *expect_type, struct expression *exp,
enum noside noside, enum noside noside,
struct value *arg1, const char *string) struct value *arg1, const char *string)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
struct value *arg3 = value_struct_elt (&arg1, NULL, string, struct value *arg3 = value_struct_elt (&arg1, NULL, string,
NULL, "structure"); NULL, "structure");
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
@ -1154,9 +1129,6 @@ eval_op_structop_ptr (struct type *expect_type, struct expression *exp,
enum noside noside, enum noside noside,
struct value *arg1, const char *string) struct value *arg1, const char *string)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
/* Check to see if operator '->' has been overloaded. If so replace /* Check to see if operator '->' has been overloaded. If so replace
arg1 with the value returned by evaluating operator->(). */ arg1 with the value returned by evaluating operator->(). */
while (unop_user_defined_p (STRUCTOP_PTR, arg1)) while (unop_user_defined_p (STRUCTOP_PTR, arg1))
@ -1215,9 +1187,6 @@ eval_op_member (struct type *expect_type, struct expression *exp,
{ {
long mem_offset; long mem_offset;
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
struct value *arg3; struct value *arg3;
struct type *type = check_typedef (value_type (arg2)); struct type *type = check_typedef (value_type (arg2));
switch (type->code ()) switch (type->code ())
@ -1256,8 +1225,6 @@ eval_op_add (struct type *expect_type, struct expression *exp,
enum noside noside, enum noside noside,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
if (binop_user_defined_p (BINOP_ADD, arg1, arg2)) if (binop_user_defined_p (BINOP_ADD, arg1, arg2))
return value_x_binop (arg1, arg2, BINOP_ADD, OP_NULL, noside); return value_x_binop (arg1, arg2, BINOP_ADD, OP_NULL, noside);
else if (ptrmath_type_p (exp->language_defn, value_type (arg1)) else if (ptrmath_type_p (exp->language_defn, value_type (arg1))
@ -1280,8 +1247,6 @@ eval_op_sub (struct type *expect_type, struct expression *exp,
enum noside noside, enum noside noside,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
if (binop_user_defined_p (BINOP_SUB, arg1, arg2)) if (binop_user_defined_p (BINOP_SUB, arg1, arg2))
return value_x_binop (arg1, arg2, BINOP_SUB, OP_NULL, noside); return value_x_binop (arg1, arg2, BINOP_SUB, OP_NULL, noside);
else if (ptrmath_type_p (exp->language_defn, value_type (arg1)) else if (ptrmath_type_p (exp->language_defn, value_type (arg1))
@ -1308,8 +1273,6 @@ eval_op_binary (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
if (binop_user_defined_p (op, arg1, arg2)) if (binop_user_defined_p (op, arg1, arg2))
return value_x_binop (arg1, arg2, op, OP_NULL, noside); return value_x_binop (arg1, arg2, op, OP_NULL, noside);
else else
@ -1355,8 +1318,6 @@ eval_op_subscript (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
if (binop_user_defined_p (op, arg1, arg2)) if (binop_user_defined_p (op, arg1, arg2))
return value_x_binop (arg1, arg2, op, OP_NULL, noside); return value_x_binop (arg1, arg2, op, OP_NULL, noside);
else else
@ -1391,8 +1352,6 @@ eval_op_equal (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
if (binop_user_defined_p (op, arg1, arg2)) if (binop_user_defined_p (op, arg1, arg2))
{ {
return value_x_binop (arg1, arg2, op, OP_NULL, noside); return value_x_binop (arg1, arg2, op, OP_NULL, noside);
@ -1414,8 +1373,6 @@ eval_op_notequal (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
if (binop_user_defined_p (op, arg1, arg2)) if (binop_user_defined_p (op, arg1, arg2))
{ {
return value_x_binop (arg1, arg2, op, OP_NULL, noside); return value_x_binop (arg1, arg2, op, OP_NULL, noside);
@ -1437,8 +1394,6 @@ eval_op_less (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
if (binop_user_defined_p (op, arg1, arg2)) if (binop_user_defined_p (op, arg1, arg2))
{ {
return value_x_binop (arg1, arg2, op, OP_NULL, noside); return value_x_binop (arg1, arg2, op, OP_NULL, noside);
@ -1460,8 +1415,6 @@ eval_op_gtr (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
if (binop_user_defined_p (op, arg1, arg2)) if (binop_user_defined_p (op, arg1, arg2))
{ {
return value_x_binop (arg1, arg2, op, OP_NULL, noside); return value_x_binop (arg1, arg2, op, OP_NULL, noside);
@ -1483,8 +1436,6 @@ eval_op_geq (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
if (binop_user_defined_p (op, arg1, arg2)) if (binop_user_defined_p (op, arg1, arg2))
{ {
return value_x_binop (arg1, arg2, op, OP_NULL, noside); return value_x_binop (arg1, arg2, op, OP_NULL, noside);
@ -1506,8 +1457,6 @@ eval_op_leq (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
if (binop_user_defined_p (op, arg1, arg2)) if (binop_user_defined_p (op, arg1, arg2))
{ {
return value_x_binop (arg1, arg2, op, OP_NULL, noside); return value_x_binop (arg1, arg2, op, OP_NULL, noside);
@ -1529,8 +1478,6 @@ eval_op_repeat (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
struct type *type = check_typedef (value_type (arg2)); struct type *type = check_typedef (value_type (arg2));
if (type->code () != TYPE_CODE_INT if (type->code () != TYPE_CODE_INT
&& type->code () != TYPE_CODE_ENUM) && type->code () != TYPE_CODE_ENUM)
@ -1551,8 +1498,6 @@ eval_op_plus (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1) struct value *arg1)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
if (unop_user_defined_p (op, arg1)) if (unop_user_defined_p (op, arg1))
return value_x_unop (arg1, op, noside); return value_x_unop (arg1, op, noside);
else else
@ -1569,8 +1514,6 @@ eval_op_neg (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1) struct value *arg1)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
if (unop_user_defined_p (op, arg1)) if (unop_user_defined_p (op, arg1))
return value_x_unop (arg1, op, noside); return value_x_unop (arg1, op, noside);
else else
@ -1587,8 +1530,6 @@ eval_op_complement (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1) struct value *arg1)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
if (unop_user_defined_p (UNOP_COMPLEMENT, arg1)) if (unop_user_defined_p (UNOP_COMPLEMENT, arg1))
return value_x_unop (arg1, UNOP_COMPLEMENT, noside); return value_x_unop (arg1, UNOP_COMPLEMENT, noside);
else else
@ -1605,8 +1546,6 @@ eval_op_lognot (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1) struct value *arg1)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
if (unop_user_defined_p (op, arg1)) if (unop_user_defined_p (op, arg1))
return value_x_unop (arg1, op, noside); return value_x_unop (arg1, op, noside);
else else
@ -1629,8 +1568,6 @@ eval_op_ind (struct type *expect_type, struct expression *exp,
|| type->code () == TYPE_CODE_MEMBERPTR) || type->code () == TYPE_CODE_MEMBERPTR)
error (_("Attempt to dereference pointer " error (_("Attempt to dereference pointer "
"to member without an object")); "to member without an object"));
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
if (unop_user_defined_p (UNOP_IND, arg1)) if (unop_user_defined_p (UNOP_IND, arg1))
return value_x_unop (arg1, UNOP_IND, noside); return value_x_unop (arg1, UNOP_IND, noside);
else if (noside == EVAL_AVOID_SIDE_EFFECTS) else if (noside == EVAL_AVOID_SIDE_EFFECTS)
@ -1694,8 +1631,6 @@ eval_op_memval (struct type *expect_type, struct expression *exp,
enum noside noside, enum noside noside,
struct value *arg1, struct type *type) struct value *arg1, struct type *type)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return value_zero (type, lval_memory); return value_zero (type, lval_memory);
else else
@ -1709,7 +1644,7 @@ eval_op_preinc (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1) struct value *arg1)
{ {
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return arg1; return arg1;
else if (unop_user_defined_p (op, arg1)) else if (unop_user_defined_p (op, arg1))
{ {
@ -1740,7 +1675,7 @@ eval_op_predec (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1) struct value *arg1)
{ {
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return arg1; return arg1;
else if (unop_user_defined_p (op, arg1)) else if (unop_user_defined_p (op, arg1))
{ {
@ -1771,7 +1706,7 @@ eval_op_postinc (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1) struct value *arg1)
{ {
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return arg1; return arg1;
else if (unop_user_defined_p (op, arg1)) else if (unop_user_defined_p (op, arg1))
{ {
@ -1805,7 +1740,7 @@ eval_op_postdec (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1) struct value *arg1)
{ {
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return arg1; return arg1;
else if (unop_user_defined_p (op, arg1)) else if (unop_user_defined_p (op, arg1))
{ {
@ -1838,9 +1773,7 @@ struct value *
eval_op_type (struct type *expect_type, struct expression *exp, eval_op_type (struct type *expect_type, struct expression *exp,
enum noside noside, struct type *type) enum noside noside, struct type *type)
{ {
if (noside == EVAL_SKIP) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return eval_skip_value (exp);
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
return allocate_value (type); return allocate_value (type);
else else
error (_("Attempt to use a type name as an expression")); error (_("Attempt to use a type name as an expression"));
@ -1853,7 +1786,7 @@ eval_binop_assign_modify (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return arg1; return arg1;
if (binop_user_defined_p (op, arg1, arg2)) if (binop_user_defined_p (op, arg1, arg2))
return value_x_binop (arg1, arg2, BINOP_ASSIGN_MODIFY, op, noside); return value_x_binop (arg1, arg2, BINOP_ASSIGN_MODIFY, op, noside);
@ -2103,8 +2036,6 @@ eval_op_objc_msgcall (struct type *expect_type, struct expression *exp,
called_method = msg_send; called_method = msg_send;
} }
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
if (noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
{ {
@ -2160,8 +2091,6 @@ eval_multi_subscript (struct type *expect_type, struct expression *exp,
enum noside noside, value *arg1, enum noside noside, value *arg1,
gdb::array_view<value *> args) gdb::array_view<value *> args)
{ {
if (noside == EVAL_SKIP)
return arg1;
for (value *arg2 : args) for (value *arg2 : args)
{ {
if (binop_user_defined_p (MULTI_SUBSCRIPT, arg1, arg2)) if (binop_user_defined_p (MULTI_SUBSCRIPT, arg1, arg2))
@ -2249,8 +2178,6 @@ logical_and_operation::evaluate (struct type *expect_type,
enum noside noside) enum noside noside)
{ {
value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside); value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
value *arg2 = std::get<1> (m_storage)->evaluate (nullptr, exp, value *arg2 = std::get<1> (m_storage)->evaluate (nullptr, exp,
EVAL_AVOID_SIDE_EFFECTS); EVAL_AVOID_SIDE_EFFECTS);
@ -2280,8 +2207,6 @@ logical_or_operation::evaluate (struct type *expect_type,
enum noside noside) enum noside noside)
{ {
value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside); value *arg1 = std::get<0> (m_storage)->evaluate (nullptr, exp, noside);
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
value *arg2 = std::get<1> (m_storage)->evaluate (nullptr, exp, value *arg2 = std::get<1> (m_storage)->evaluate (nullptr, exp,
EVAL_AVOID_SIDE_EFFECTS); EVAL_AVOID_SIDE_EFFECTS);
@ -2406,7 +2331,7 @@ array_operation::evaluate (struct type *expect_type,
int nargs = tem3 - tem2 + 1; int nargs = tem3 - tem2 + 1;
struct type *type = expect_type ? check_typedef (expect_type) : nullptr; struct type *type = expect_type ? check_typedef (expect_type) : nullptr;
if (expect_type != nullptr && noside != EVAL_SKIP if (expect_type != nullptr
&& type->code () == TYPE_CODE_STRUCT) && type->code () == TYPE_CODE_STRUCT)
{ {
struct value *rec = allocate_value (expect_type); struct value *rec = allocate_value (expect_type);
@ -2415,7 +2340,7 @@ array_operation::evaluate (struct type *expect_type,
return evaluate_struct_tuple (rec, exp, noside, nargs); return evaluate_struct_tuple (rec, exp, noside, nargs);
} }
if (expect_type != nullptr && noside != EVAL_SKIP if (expect_type != nullptr
&& type->code () == TYPE_CODE_ARRAY) && type->code () == TYPE_CODE_ARRAY)
{ {
struct type *range_type = type->index_type (); struct type *range_type = type->index_type ();
@ -2451,7 +2376,7 @@ array_operation::evaluate (struct type *expect_type,
return array; return array;
} }
if (expect_type != nullptr && noside != EVAL_SKIP if (expect_type != nullptr
&& type->code () == TYPE_CODE_SET) && type->code () == TYPE_CODE_SET)
{ {
struct value *set = allocate_value (expect_type); struct value *set = allocate_value (expect_type);
@ -2524,8 +2449,6 @@ array_operation::evaluate (struct type *expect_type,
objects. */ objects. */
argvec[tem] = in_args[tem]->evaluate_with_coercion (exp, noside); argvec[tem] = in_args[tem]->evaluate_with_coercion (exp, noside);
} }
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
return value_array (tem2, tem3, argvec); return value_array (tem2, tem3, argvec);
} }
@ -2564,8 +2487,6 @@ operation::evaluate_for_cast (struct type *expect_type,
enum noside noside) enum noside noside)
{ {
value *val = evaluate (expect_type, exp, noside); value *val = evaluate (expect_type, exp, noside);
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
return value_cast (expect_type, val); return value_cast (expect_type, val);
} }
@ -2833,9 +2754,6 @@ var_msym_value_operation::evaluate_for_cast (struct type *to_type,
std::get<1> (m_storage), std::get<1> (m_storage),
std::get<0> (m_storage)); std::get<0> (m_storage));
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
val = value_cast (to_type, val); val = value_cast (to_type, val);
/* Don't allow e.g. '&(int)var_with_no_debug_info'. */ /* Don't allow e.g. '&(int)var_with_no_debug_info'. */
@ -2857,9 +2775,6 @@ var_value_operation::evaluate_for_cast (struct type *to_type,
std::get<1> (m_storage), std::get<1> (m_storage),
std::get<0> (m_storage)); std::get<0> (m_storage));
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
val = value_cast (to_type, val); val = value_cast (to_type, val);
/* Don't allow e.g. '&(int)var_with_no_debug_info'. */ /* Don't allow e.g. '&(int)var_with_no_debug_info'. */

View File

@ -1581,9 +1581,7 @@ public:
struct expression *exp, struct expression *exp,
enum noside noside) override enum noside noside) override
{ {
if (noside == EVAL_SKIP) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return eval_skip_value (exp);
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
return std::get<0> (m_storage)->evaluate (nullptr, exp, return std::get<0> (m_storage)->evaluate (nullptr, exp,
EVAL_AVOID_SIDE_EFFECTS); EVAL_AVOID_SIDE_EFFECTS);
else else
@ -1606,9 +1604,7 @@ public:
struct expression *exp, struct expression *exp,
enum noside noside) override enum noside noside) override
{ {
if (noside == EVAL_SKIP) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return eval_skip_value (exp);
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
{ {
value *result value *result
= std::get<0> (m_storage)->evaluate (nullptr, exp, = std::get<0> (m_storage)->evaluate (nullptr, exp,
@ -1683,10 +1679,7 @@ public:
enum noside noside) override enum noside noside) override
{ {
/* C++: check for and handle pointer to members. */ /* C++: check for and handle pointer to members. */
if (noside == EVAL_SKIP) return std::get<0> (m_storage)->evaluate_for_address (exp, noside);
return eval_skip_value (exp);
else
return std::get<0> (m_storage)->evaluate_for_address (exp, noside);
} }
enum exp_opcode opcode () const override enum exp_opcode opcode () const override
@ -1724,8 +1717,6 @@ public:
struct expression *exp, struct expression *exp,
enum noside noside) override enum noside noside) override
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
return std::get<0> (m_storage)->evaluate_for_sizeof (exp, noside); return std::get<0> (m_storage)->evaluate_for_sizeof (exp, noside);
} }
@ -1908,7 +1899,7 @@ public:
: value_type (lhs)); : value_type (lhs));
value *rhs = std::get<1> (m_storage)->evaluate (xtype, exp, noside); value *rhs = std::get<1> (m_storage)->evaluate (xtype, exp, noside);
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return lhs; return lhs;
if (binop_user_defined_p (BINOP_ASSIGN, lhs, rhs)) if (binop_user_defined_p (BINOP_ASSIGN, lhs, rhs))
return value_x_binop (lhs, rhs, BINOP_ASSIGN, OP_NULL, noside); return value_x_binop (lhs, rhs, BINOP_ASSIGN, OP_NULL, noside);
@ -2049,8 +2040,6 @@ public:
EVAL_AVOID_SIDE_EFFECTS); EVAL_AVOID_SIDE_EFFECTS);
struct type *type = value_type (val); struct type *type = value_type (val);
value *rhs = std::get<1> (m_storage)->evaluate (type, exp, noside); value *rhs = std::get<1> (m_storage)->evaluate (type, exp, noside);
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
return FUNC (type, rhs); return FUNC (type, rhs);
} }

View File

@ -54,9 +54,6 @@ enum exp_opcode : uint8_t
enum noside enum noside
{ {
EVAL_NORMAL, EVAL_NORMAL,
EVAL_SKIP, /* Only effect is to increment pos.
Return type information where
possible. */
EVAL_AVOID_SIDE_EFFECTS /* Don't modify any variables or EVAL_AVOID_SIDE_EFFECTS /* Don't modify any variables or
call any functions. The value call any functions. The value
returned will have the correct returned will have the correct

View File

@ -586,8 +586,6 @@ eval_op_f_abs (struct type *expect_type, struct expression *exp,
enum exp_opcode opcode, enum exp_opcode opcode,
struct value *arg1) struct value *arg1)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
struct type *type = value_type (arg1); struct type *type = value_type (arg1);
switch (type->code ()) switch (type->code ())
{ {
@ -616,8 +614,6 @@ eval_op_f_mod (struct type *expect_type, struct expression *exp,
enum exp_opcode opcode, enum exp_opcode opcode,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
struct type *type = value_type (arg1); struct type *type = value_type (arg1);
if (type->code () != value_type (arg2)->code ()) if (type->code () != value_type (arg2)->code ())
error (_("non-matching types for parameters to MOD ()")); error (_("non-matching types for parameters to MOD ()"));
@ -655,8 +651,6 @@ eval_op_f_ceil (struct type *expect_type, struct expression *exp,
enum exp_opcode opcode, enum exp_opcode opcode,
struct value *arg1) struct value *arg1)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
struct type *type = value_type (arg1); struct type *type = value_type (arg1);
if (type->code () != TYPE_CODE_FLT) if (type->code () != TYPE_CODE_FLT)
error (_("argument to CEILING must be of type float")); error (_("argument to CEILING must be of type float"));
@ -675,8 +669,6 @@ eval_op_f_floor (struct type *expect_type, struct expression *exp,
enum exp_opcode opcode, enum exp_opcode opcode,
struct value *arg1) struct value *arg1)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
struct type *type = value_type (arg1); struct type *type = value_type (arg1);
if (type->code () != TYPE_CODE_FLT) if (type->code () != TYPE_CODE_FLT)
error (_("argument to FLOOR must be of type float")); error (_("argument to FLOOR must be of type float"));
@ -695,8 +687,6 @@ eval_op_f_modulo (struct type *expect_type, struct expression *exp,
enum exp_opcode opcode, enum exp_opcode opcode,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
struct type *type = value_type (arg1); struct type *type = value_type (arg1);
if (type->code () != value_type (arg2)->code ()) if (type->code () != value_type (arg2)->code ())
error (_("non-matching types for parameters to MODULO ()")); error (_("non-matching types for parameters to MODULO ()"));
@ -737,8 +727,6 @@ eval_op_f_cmplx (struct type *expect_type, struct expression *exp,
enum exp_opcode opcode, enum exp_opcode opcode,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
struct type *type = builtin_f_type(exp->gdbarch)->builtin_complex_s16; struct type *type = builtin_f_type(exp->gdbarch)->builtin_complex_s16;
return value_literal_complex (arg1, arg2, type); return value_literal_complex (arg1, arg2, type);
} }

View File

@ -37,7 +37,7 @@ eval_op_m2_high (struct type *expect_type, struct expression *exp,
enum noside noside, enum noside noside,
struct value *arg1) struct value *arg1)
{ {
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return arg1; return arg1;
else else
{ {
@ -68,8 +68,6 @@ eval_op_m2_subscript (struct type *expect_type, struct expression *exp,
enum noside noside, enum noside noside,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
if (noside == EVAL_SKIP)
return eval_skip_value (exp);
/* If the user attempts to subscript something that is not an /* If the user attempts to subscript something that is not an
array or pointer type (like a plain int variable for example), array or pointer type (like a plain int variable for example),
then report this as an error. */ then report this as an error. */

View File

@ -681,7 +681,7 @@ eval_opencl_assign (struct type *expect_type, struct expression *exp,
enum noside noside, enum exp_opcode op, enum noside noside, enum exp_opcode op,
struct value *arg1, struct value *arg2) struct value *arg1, struct value *arg2)
{ {
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS) if (noside == EVAL_AVOID_SIDE_EFFECTS)
return arg1; return arg1;
struct type *type1 = value_type (arg1); struct type *type1 = value_type (arg1);

View File

@ -921,8 +921,6 @@ extern value *evaluate_var_msym_value (enum noside noside,
struct objfile *objfile, struct objfile *objfile,
minimal_symbol *msymbol); minimal_symbol *msymbol);
extern value *eval_skip_value (expression *exp);
namespace expr { class operation; }; namespace expr { class operation; };
extern void fetch_subexp_value (struct expression *exp, extern void fetch_subexp_value (struct expression *exp,
expr::operation *op, expr::operation *op,