Change functions in cp-name-parser.y into methods
authorTom Tromey <tom@tromey.com>
Fri, 1 Jun 2018 17:50:01 +0000 (11:50 -0600)
committerTom Tromey <tom@tromey.com>
Mon, 4 Jun 2018 13:15:11 +0000 (07:15 -0600)
commit214b073cedadbdc7a0d272dc5ede79a5ab7785ea
tree3762abb22ec7c50ad7d5fccb04596dfee359de10
parent3c5cd5c3b4dcb88da4ff980186b63fa169ba9263
Change functions in cp-name-parser.y into methods

Pedro pointed out in an earlier patch that it would be possible to
make some helper functions in cp-name-parser.y into methods on
cpname_state, cleaning up the code a bit.  This patch implements this
idea.

Doing this required moving the %union earlier in the .y file, so the
patch is somewhat bigger than you might expect.

Tested by building with both bison and byacc, and then running the
gdb.cp tests.

gdb/ChangeLog
2018-06-04  Tom Tromey  <tom@tromey.com>

* cp-name-parser.y (cpname_state): Add method declarations.
(HANDLE_QUAL): Update.
(cpname_state::d_grab, cpname_state::fill_comp)
(cpname_state::make_operator, cpname_state::make_dtor)
(cpname_state::make_builtin_type, cpname_state::make_name)
(cpname_state::d_qualify, cpname_state::d_int_type)
(cpname_state::d_unary, cpname_state::d_binary): Now methods.
(%union): Move earlier.
gdb/ChangeLog
gdb/cp-name-parser.y