Like evaluate_expression, evaluate_type is also just a simple wrapper.
Removing it makes the code a little nicer.
}
if (expr != NULL && expr->first_opcode () == OP_TYPE)
- type = evaluate_type (expr.get ())->type ();
+ type = expr->evaluate_type ()->type ();
args.emplace_back (type, std::move (type_str), std::move (expr));
}
return retval;
}
-/* Evaluate an expression, avoiding all memory references
- and getting a value whose type alone is correct. */
-
-struct value *
-evaluate_type (struct expression *exp)
-{
- return exp->evaluate (nullptr, EVAL_AVOID_SIDE_EFFECTS);
-}
-
/* Find the current value of a watchpoint on EXP. Return the value in
*VALP and *RESULTP and the chain of intermediate and final values
in *VAL_CHAIN. RESULTP and VAL_CHAIN may be NULL if the caller does
struct value *evaluate (struct type *expect_type = nullptr,
enum noside noside = EVAL_NORMAL);
+ /* Evaluate an expression, avoiding all memory references
+ and getting a value whose type alone is correct. */
+ struct value *evaluate_type ()
+ { return evaluate (nullptr, EVAL_AVOID_SIDE_EFFECTS); }
+
/* Language it was entered in. */
const struct language_defn *language_defn;
/* Architecture it was parsed in. */
internal form to reconstruct the type somehow. */
std::string type_name = gnuv3_get_typename_from_type_info (type_info_ptr);
expression_up expr (parse_expression (type_name.c_str ()));
- struct value *type_val = evaluate_type (expr.get ());
+ struct value *type_val = expr->evaluate_type ();
return type_val->type ();
}
expression_up expr = parse_expression (expression);
if (values == PRINT_SIMPLE_VALUES)
- val = evaluate_type (expr.get ());
+ val = expr->evaluate_type ();
else
val = expr->evaluate ();
"whatis" prints the type of the expression without stripping
any typedef level. "ptype" always strips all levels of
typedefs. */
- val = evaluate_type (expr.get ());
+ val = expr->evaluate_type ();
type = val->type ();
if (show == -1 && expr->first_opcode () == OP_TYPE)
if (type_name != NULL)
{
expression_up expr = parse_expression (type_name);
- struct value *val = evaluate_type (expr.get ());
+ struct value *val = expr->evaluate_type ();
struct type *type = val->type ();
if (type != nullptr)
struct value *function,
struct type *value_type);
-extern struct value *evaluate_type (struct expression *exp);
-
extern value *evaluate_var_value (enum noside noside, const block *blk,
symbol *var);
{
/* Error getting the value. Try to at least get the
right type. */
- struct value *type_only_value = evaluate_type (var->root->exp.get ());
+ struct value *type_only_value = var->root->exp->evaluate_type ();
var->type = type_only_value->type ();
}