extern struct value *eval_op_register (struct type *expect_type,
struct expression *exp,
enum noside noside, const char *name);
-extern struct value *eval_op_string (struct type *expect_type,
- struct expression *exp,
- enum noside noside, int len,
- const char *string);
extern struct value *eval_op_ternop (struct type *expect_type,
struct expression *exp,
enum noside noside,
struct expression *exp,
enum noside noside,
struct value *arg1, struct value *arg2);
-extern struct value *eval_op_concat (struct type *expect_type,
- struct expression *exp,
- enum noside noside,
- struct value *arg1, struct value *arg2);
extern struct value *eval_op_add (struct type *expect_type,
struct expression *exp,
enum noside noside,
dump_for_expression (struct ui_file *stream, int depth,
const std::vector<T> &vals)
{
- fprintf_filtered (stream, _("%*sVector:\n"), depth, "");
+ gdb_printf (stream, _("%*sVector:\n"), depth, "");
for (auto &item : vals)
dump_for_expression (stream, depth + 1, item);
}
static inline bool
check_constant (struct symbol *sym)
{
- enum address_class sc = SYMBOL_CLASS (sym);
+ enum address_class sc = sym->aclass ();
return (sc == LOC_BLOCK
|| sc == LOC_CONST
|| sc == LOC_CONST_BYTES
value *evaluate (struct type *expect_type,
struct expression *exp,
- enum noside noside) override
- {
- const std::string &str = std::get<0> (m_storage);
- return eval_op_string (expect_type, exp, noside,
- str.size (), str.c_str ());
- }
+ enum noside noside) override;
enum exp_opcode opcode () const override
{ return OP_STRING; }
= std::get<0> (m_storage)->evaluate_with_coercion (exp, noside);
value *rhs
= std::get<1> (m_storage)->evaluate_with_coercion (exp, noside);
- return eval_op_concat (expect_type, exp, noside, lhs, rhs);
+ return value_concat (lhs, rhs);
}
enum exp_opcode opcode () const override
override;
};
+/* Not a cast! Extract a value of a given type from the contents of a
+ value. The new value is extracted from the least significant bytes
+ of the old value. The new value's type must be no bigger than the
+ old values type. */
+class unop_extract_operation
+ : public maybe_constant_operation<operation_up, struct type *>
+{
+public:
+
+ using maybe_constant_operation::maybe_constant_operation;
+
+ value *evaluate (struct type *expect_type, struct expression *exp,
+ enum noside noside) override;
+
+ enum exp_opcode opcode () const override
+ { return UNOP_EXTRACT; }
+
+ /* Return the type referenced by this object. */
+ struct type *get_type () const
+ {
+ return std::get<1> (m_storage);
+ }
+
+protected:
+
+ void do_generate_ax (struct expression *exp,
+ struct agent_expr *ax,
+ struct axs_value *value,
+ struct type *cast_type) override;
+};
+
/* A type cast. */
class unop_cast_operation
: public maybe_constant_operation<operation_up, struct type *>