+2021-03-08 Tom Tromey <tom@tromey.com>
+
+ * eval.c (objc_msgcall_operation::evaluate): New method.
+ * c-exp.h (class objc_msgcall_operation): New.
+
2021-03-08 Tom Tromey <tom@tromey.com>
* expop.h (class var_value_operation): New.
{ return OP_OBJC_SELECTOR; }
};
+/* An Objective C message call. */
+class objc_msgcall_operation
+ : public tuple_holding_operation<CORE_ADDR, operation_up,
+ std::vector<operation_up>>
+{
+public:
+
+ using tuple_holding_operation::tuple_holding_operation;
+
+ value *evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside) override;
+
+ enum exp_opcode opcode () const override
+ { return OP_OBJC_MSGCALL; }
+};
+
}/* namespace expr */
#endif /* C_EXP_H */
return (arg1);
}
+namespace expr
+{
+
+value *
+objc_msgcall_operation::evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside)
+{
+ enum noside sub_no_side = EVAL_NORMAL;
+ struct type *selector_type = builtin_type (exp->gdbarch)->builtin_data_ptr;
+
+ if (noside == EVAL_AVOID_SIDE_EFFECTS)
+ sub_no_side = EVAL_NORMAL;
+ else
+ sub_no_side = noside;
+ value *target
+ = std::get<1> (m_storage)->evaluate (selector_type, exp, sub_no_side);
+
+ if (value_as_long (target) == 0)
+ sub_no_side = EVAL_AVOID_SIDE_EFFECTS;
+ else
+ sub_no_side = noside;
+ std::vector<operation_up> &args = std::get<2> (m_storage);
+ value **argvec = XALLOCAVEC (struct value *, args.size () + 3);
+ argvec[0] = nullptr;
+ argvec[1] = nullptr;
+ for (int i = 0; i < args.size (); ++i)
+ argvec[i + 2] = args[i]->evaluate_with_coercion (exp, sub_no_side);
+ argvec[args.size () + 2] = nullptr;
+
+ return eval_op_objc_msgcall (expect_type, exp, noside, std::
+ get<0> (m_storage), target,
+ gdb::make_array_view (argvec,
+ args.size () + 3));
+}
+
+}
+
+
struct value *
evaluate_subexp_standard (struct type *expect_type,
struct expression *exp, int *pos,