]> git.ipfire.org Git - thirdparty/gcc.git/commit
pretty-print: split up pretty_printer::format into subroutines
authorDavid Malcolm <dmalcolm@redhat.com>
Tue, 3 Sep 2024 19:11:06 +0000 (15:11 -0400)
committerDavid Malcolm <dmalcolm@redhat.com>
Tue, 3 Sep 2024 19:16:39 +0000 (15:16 -0400)
commit07e74798b93c256bea3a91895d3517223a58da61
tree1ab05a39f81406c8a1260aa8e22d30fef9b3f74a
parentd0891f3aa75d31744de728905f2f454e9d07ce54
pretty-print: split up pretty_printer::format into subroutines

The body of pretty_printer::format is almost 500 lines long,
mostly comprising two distinct phases.

This patch splits it up so that there are explicit subroutines
for the two different phases, reducing the scope of various
locals, and making it easier to e.g. put a breakpoint on phase 2.

No functional change intended.

gcc/ChangeLog:
* pretty-print-markup.h (pp_markup::context::context): Drop
params "buf" and "chunk_idx", initializing m_buf from pp.
(pp_markup::context::m_chunk_idx): Drop field.
* pretty-print.cc (pretty_printer::format): Convert param
from a text_info * to a text_info &.  Split out phase 1
and phase 2 into subroutines...
(format_phase_1): New, from pretty_printer::format.
(format_phase_2): Likewise.
* pretty-print.h (pretty_printer::format): Convert param
from a text_info * to a text_info &.
(pp_format): Update for above change.  Assert that text_info is
non-null.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/pretty-print-markup.h
gcc/pretty-print.cc
gcc/pretty-print.h