aboutsummaryrefslogtreecommitdiff
path: root/gdb/c-exp.y
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2021-04-15 10:05:00 -0600
committerTom Tromey <tromey@adacore.com>2021-04-15 10:05:00 -0600
commit9e5e03df52968b416e09a59482409abfed9727c0 (patch)
treef7b84a83f5c0aa2f636927ef25efed33604c3f13 /gdb/c-exp.y
parent4c79248a46100016e902f1489ce1c38a42608460 (diff)
downloadgdb-9e5e03df52968b416e09a59482409abfed9727c0.zip
gdb-9e5e03df52968b416e09a59482409abfed9727c0.tar.gz
gdb-9e5e03df52968b416e09a59482409abfed9727c0.tar.bz2
Use block_symbol in var_value_operation
I noticed that var_value_operation takes a block and a symbol, and most callers destructure a block_symbol to pass in. It seems better for this class to simply hold a block_symbol instead. Tested on x86-64 Fedora 32. gdb/ChangeLog 2021-04-15 Tom Tromey <tromey@adacore.com> * rust-exp.y (rust_parser::convert_ast_to_expression): Update. * parse.c (parser_state::push_symbol, parser_state::push_dollar): Update. * p-exp.y (variable): Update. * m2-exp.y (variable): Update. * go-exp.y (variable): Update. * expprint.c (dump_for_expression): New overload. * expop.h (check_objfile): New overload. (check_constant): New overload. (class var_value_operation): Use block_symbol. <get_symbol>: Rewrite. * eval.c (var_value_operation::evaluate) (var_value_operation::evaluate_funcall) (var_value_operation::evaluate_for_address) (var_value_operation::evaluate_for_address) (var_value_operation::evaluate_with_coercion) (var_value_operation::evaluate_for_sizeof) (var_value_operation::evaluate_for_cast): Update. * d-exp.y (PrimaryExpression): Update. * c-exp.y (variable): Update. * ax-gdb.c (var_value_operation::do_generate_ax): Update. * ada-lang.c (ada_var_value_operation::evaluate_for_cast) (ada_var_value_operation::evaluate) (ada_var_value_operation::resolve) (ada_funcall_operation::resolve): Update. * ada-exp.y (write_var_from_sym, write_object_renaming) (write_ambiguous_var, write_var_or_type, write_name_assoc) (maybe_overload): Update. * ada-exp.h (class ada_var_value_operation) <get_block>: Rewrite.
Diffstat (limited to 'gdb/c-exp.y')
-rw-r--r--gdb/c-exp.y13
1 files changed, 7 insertions, 6 deletions
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index d6a2322..865b155 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -1125,8 +1125,7 @@ variable: block COLONCOLON name
if (symbol_read_needs_frame (sym.symbol))
pstate->block_tracker->update (sym);
- pstate->push_new<var_value_operation> (sym.symbol,
- sym.block);
+ pstate->push_new<var_value_operation> (sym);
}
;
@@ -1197,8 +1196,7 @@ variable: name_not_typename
pstate->push_new<var_msym_value_operation>
(resolver);
else
- pstate->push_new<var_value_operation>
- (sym.symbol, sym.block);
+ pstate->push_new<var_value_operation> (sym);
}
else if ($1.is_a_field_of_this)
{
@@ -1239,8 +1237,11 @@ variable: name_not_typename
? find_function_alias_target (msymbol)
: NULL);
if (alias_target != NULL)
- pstate->push_new<var_value_operation>
- (alias_target, SYMBOL_BLOCK_VALUE (alias_target));
+ {
+ block_symbol bsym { alias_target,
+ SYMBOL_BLOCK_VALUE (alias_target) };
+ pstate->push_new<var_value_operation> (bsym);
+ }
else
pstate->push_new<var_msym_value_operation>
(msymbol);