mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-26 05:47:26 +08:00
Introduce typeof_operation
This adds class typeof_operation, which implements OP_TYPEOF. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class typeof_operation): New.
This commit is contained in:
@ -1,3 +1,7 @@
|
|||||||
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* expop.h (class typeof_operation): New.
|
||||||
|
|
||||||
2021-03-08 Tom Tromey <tom@tromey.com>
|
2021-03-08 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* expop.h (class type_operation): New.
|
* expop.h (class type_operation): New.
|
||||||
|
25
gdb/expop.h
25
gdb/expop.h
@ -1445,6 +1445,31 @@ public:
|
|||||||
{ return true; }
|
{ return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Implement the "typeof" operation. */
|
||||||
|
class typeof_operation
|
||||||
|
: public maybe_constant_operation<operation_up>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
|
||||||
|
using maybe_constant_operation::maybe_constant_operation;
|
||||||
|
|
||||||
|
value *evaluate (struct type *expect_type,
|
||||||
|
struct expression *exp,
|
||||||
|
enum noside noside) override
|
||||||
|
{
|
||||||
|
if (noside == EVAL_SKIP)
|
||||||
|
return eval_skip_value (exp);
|
||||||
|
else if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
||||||
|
return std::get<0> (m_storage)->evaluate (nullptr, exp,
|
||||||
|
EVAL_AVOID_SIDE_EFFECTS);
|
||||||
|
else
|
||||||
|
error (_("Attempt to use a type as an expression"));
|
||||||
|
}
|
||||||
|
|
||||||
|
enum exp_opcode opcode () const override
|
||||||
|
{ return OP_TYPEOF; }
|
||||||
|
};
|
||||||
|
|
||||||
} /* namespace expr */
|
} /* namespace expr */
|
||||||
|
|
||||||
#endif /* EXPOP_H */
|
#endif /* EXPOP_H */
|
||||||
|
Reference in New Issue
Block a user