From aa5f053f971000f8748a2f0f10e89e4020615c9e Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 6 Sep 2025 13:12:05 -0600 Subject: Change dwarf_record_line_p to be a method This changes dwarf_record_line_p to be a method of lnp_state_machine. This simplifies it, as it can refer to members of the object. Approved-By: Simon Marchi --- gdb/dwarf2/line-program.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'gdb') diff --git a/gdb/dwarf2/line-program.c b/gdb/dwarf2/line-program.c index 46427b0..ac8b177 100644 --- a/gdb/dwarf2/line-program.c +++ b/gdb/dwarf2/line-program.c @@ -150,6 +150,8 @@ private: m_line_has_non_zero_discriminator = m_discriminator != 0; } + bool record_line_p (); + struct dwarf2_cu *m_cu; gdbarch *m_gdbarch; @@ -291,20 +293,17 @@ lnp_state_machine::handle_const_add_pc () Note: Addresses in the line number state machine can never go backwards within one sequence, thus this coalescing is ok. */ -static bool -dwarf_record_line_p (struct dwarf2_cu *cu, - unsigned int line, unsigned int last_line, - int line_has_non_zero_discriminator, - struct subfile *last_subfile) +bool +lnp_state_machine::record_line_p () { - if (cu->get_builder ()->get_current_subfile () != last_subfile) + if (m_cu->get_builder ()->get_current_subfile () != m_last_subfile) return true; - if (line != last_line) + if (m_line != m_last_line) return true; /* Same line for the same file that we've seen already. As a last check, for pr 17276, only record the line if the line has never had a non-zero discriminator. */ - if (!line_has_non_zero_discriminator) + if (!m_line_has_non_zero_discriminator) return true; return false; } @@ -418,9 +417,7 @@ lnp_state_machine::record_line (bool end_sequence) if (m_cu->producer_is_codewarrior ()) lte_flags |= LEF_IS_STMT; - if (dwarf_record_line_p (m_cu, m_line, m_last_line, - m_line_has_non_zero_discriminator, - m_last_subfile)) + if (record_line_p ()) { buildsym_compunit *builder = m_cu->get_builder (); dwarf_record_line_1 (m_gdbarch, -- cgit v1.1