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:29 -0700
commite447908052f54164eec481d15a5274ddf385569d (patch)
tree869b45f3dba350e9a6097bac187c6ae9a77c46dc /gdb/eval.c
parent95d49dfbba00253382d0f7ad0ea2052b2b7bc445 (diff)
downloadgdb-e447908052f54164eec481d15a5274ddf385569d.zip
gdb-e447908052f54164eec481d15a5274ddf385569d.tar.gz
gdb-e447908052f54164eec481d15a5274ddf385569d.tar.bz2
Introduce class adl_func_operation
This adds class adl_func_operation, which implements argument-dependent lookup function calls. Other function calls will be handled in a different way. However, because ADL calls were created in a single spot in the C++ parser, and because they had different semantics from the other cases, it was convenient to treat them specially. gdb/ChangeLog 2021-03-08 Tom Tromey <tom@tromey.com> * expop.h (class adl_func_operation): New. * eval.c (adl_func_operation::evaluate): New method.
Diffstat (limited to 'gdb/eval.c')
-rw-r--r--gdb/eval.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gdb/eval.c b/gdb/eval.c
index 4438413..972e630 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -2549,6 +2549,29 @@ logical_or_operation::evaluate (struct type *expect_type,
}
}
+value *
+adl_func_operation::evaluate (struct type *expect_type,
+ struct expression *exp,
+ enum noside noside)
+{
+ std::vector<operation_up> &arg_ops = std::get<2> (m_storage);
+ std::vector<value *> args (arg_ops.size ());
+ for (int i = 0; i < arg_ops.size (); ++i)
+ args[i] = arg_ops[i]->evaluate_with_coercion (exp, noside);
+
+ struct symbol *symp;
+ find_overload_match (args, std::get<0> (m_storage).c_str (),
+ NON_METHOD,
+ nullptr, nullptr,
+ nullptr, &symp, nullptr, 0, noside);
+ if (SYMBOL_TYPE (symp)->code () == TYPE_CODE_ERROR)
+ error_unknown_type (symp->print_name ());
+ value *callee = evaluate_var_value (noside, std::get<1> (m_storage), symp);
+ return evaluate_subexp_do_call (exp, noside, callee, args,
+ nullptr, expect_type);
+
+}
+
}
struct value *