aboutsummaryrefslogtreecommitdiff
path: root/gdb/eval.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-03-08 07:27:57 -0700
committerTom Tromey <tom@tromey.com>2021-03-08 07:28:23 -0700
commit44b675c89b9d4e22ab60f51416b47634df2a3774 (patch)
tree724df2df3c2a5b6c35c8ae6dbd1f1c990e39b4b7 /gdb/eval.c
parentf6b4232691d79a9e4b54934529f4b34081d79d94 (diff)
downloadfsf-binutils-gdb-44b675c89b9d4e22ab60f51416b47634df2a3774.zip
fsf-binutils-gdb-44b675c89b9d4e22ab60f51416b47634df2a3774.tar.gz
fsf-binutils-gdb-44b675c89b9d4e22ab60f51416b47634df2a3774.tar.bz2
Introduce type_instance_operation
This adds class type_instance_operation, which implements TYPE_INSTANCE. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class type_instance_operation): New. * eval.c (type_instance_operation::evaluate): New method.
Diffstat (limited to 'gdb/eval.c')
-rw-r--r--gdb/eval.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/eval.c b/gdb/eval.c
index 2781e1d..f0bad85 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -636,6 +636,24 @@ fake_method::~fake_method ()
xfree (m_type.fields ());
}
+namespace expr
+{
+
+value *
+type_instance_operation::evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside)
+{
+ type_instance_flags flags = std::get<0> (m_storage);
+ std::vector<type *> &types = std::get<1> (m_storage);
+
+ fake_method fake_expect_type (flags, types.size (), types.data ());
+ return std::get<2> (m_storage)->evaluate (fake_expect_type.type (),
+ exp, noside);
+}
+
+}
+
/* Helper for evaluating an OP_VAR_VALUE. */
value *