From 26f53cd385fab9dabec50b4a7be07041db929417 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 18 Feb 2021 11:23:33 -0700 Subject: Introduce expression::evaluate This introduces a new method, expression::evaluate, and changes the top-level expression-evaluation functions to use it. Stack temporary handling is moved into this new method, which makes sense because that handling was only done when "*pos == 0". This patch avoids some temporary regressions related to stack temporary in the larger expression rewrite series. I've pulled it out separately because it seems like a reasonable change in its own right, and because it's better to avoid making that series even longer. Regression tested on x86-64 Fedora 32. gdb/ChangeLog 2021-02-18 Tom Tromey * expression.h (struct expression) : Declare method. * eval.c (evaluate_subexp): Simplify. (expression::evaluate): New method. (evaluate_expression, evaluate_type): Use expression::evaluate. --- gdb/expression.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gdb/expression.h') diff --git a/gdb/expression.h b/gdb/expression.h index e70169e..397a0af 100644 --- a/gdb/expression.h +++ b/gdb/expression.h @@ -120,6 +120,11 @@ struct expression return elts[0].opcode; } + /* Evaluate the expression. EXPECT_TYPE is the context type of the + expression; normally this should be nullptr. NOSIDE controls how + evaluation is performed. */ + struct value *evaluate (struct type *expect_type, enum noside noside); + /* Language it was entered in. */ const struct language_defn *language_defn; /* Architecture it was parsed in. */ -- cgit v1.1