dwarf2read.c: C++fy lnp_state_machine
authorPedro Alves <palves@redhat.com>
Tue, 4 Apr 2017 19:03:26 +0000 (20:03 +0100)
committerPedro Alves <palves@redhat.com>
Tue, 4 Apr 2017 19:03:26 +0000 (20:03 +0100)
commit6f77053d2ae56f16c10a8817732ed9fb43893507
treeb9374d6e2ed5e19c99322b683cfe868dd6dd1e0f
parent9c5417255690af00751c7d506172459afe856894
dwarf2read.c: C++fy lnp_state_machine

While I was looking at the file, I noticed that this struct could be
nicely converted to a class.  As I was progressing, I ended up moving
all state machine actual internal state manipulation to methods of
lnp_state_machine, essentially decoupling DWARF parsing from state
tracking.  I also noticed that the lnp_reader_state doesn't really
serve any good use, so that's eliminated in the process.

gdb/ChangeLog:
2017-04-04  Pedro Alves  <palves@redhat.com>

* dwarf2read.c (lnp_state_machine): Now a class.  Initialize all
data fields, make them private and add "m_" prefixes.
(lnp_state_machine::lnp_state_machine): New ctor.
(record_line, check_line_address, handle_set_discriminator)
(handle_set_address, handle_advance_pc, handle_special_opcode)
(handle_advance_line, handle_set_file, handle_negate_stmt)
(handle_const_add_pc, handle_fixed_advance_pc, handle_copy)
(end_sequence, advance_line): New methods.
(m_gdbarch, m_record_lines_p): New fields.
(lnp_reader_state): Delete.
(dwarf_record_line): Rename to ...
(lnp_state_machine::record_line): ... adjust.
(init_lnp_state_machine): Delete.
(lnp_state_machine::lnp_state_machine): New.
(check_line_address): Rename to ...
(lnp_state_machine::check_line_address): This.
(dwarf_decode_lines_1): Remove reference to "reader_state".
Adjust lnp_state_machine having a non-default ctor.  Use bool.
State machine internal state manipulation moved to
lnp_state_machine methods.
gdb/ChangeLog
gdb/dwarf2read.c