Extract symbol-writing function from parsers
authorTom Tromey <tom@tromey.com>
Fri, 5 Feb 2021 14:11:01 +0000 (07:11 -0700)
committerTom Tromey <tom@tromey.com>
Fri, 5 Feb 2021 14:11:01 +0000 (07:11 -0700)
commit1b30f42106cfd50ef1c020db2ca31f2fbe51ef8a
treef22193895e3e5c0683504ccc7a525459fccee6da
parente37d88e5e5666304d94b705af4301867df9bdab0
Extract symbol-writing function from parsers

I noticed that several parsers shared the same code to write a symbol
reference to an expression.  This patch factors this code out into a
new function.

Regression tested on x86-64 Fedora 32.

gdb/ChangeLog
2021-02-05  Tom Tromey  <tom@tromey.com>

* parser-defs.h (write_exp_symbol_reference): Declare.
* parse.c (write_exp_symbol_reference): New function.
* p-exp.y (variable): Use write_exp_symbol_reference.
* m2-exp.y (variable): Use write_exp_symbol_reference.
* f-exp.y (variable): Use write_exp_symbol_reference.
* d-exp.y (PrimaryExpression): Use write_exp_symbol_reference.
* c-exp.y (variable): Use write_exp_symbol_reference.
gdb/ChangeLog
gdb/c-exp.y
gdb/d-exp.y
gdb/f-exp.y
gdb/m2-exp.y
gdb/p-exp.y
gdb/parse.c
gdb/parser-defs.h