aboutsummaryrefslogtreecommitdiff
path: root/gcc/pretty-print.h
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2024-09-03 15:11:06 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2024-09-03 15:16:39 -0400
commit07e74798b93c256bea3a91895d3517223a58da61 (patch)
tree1ab05a39f81406c8a1260aa8e22d30fef9b3f74a /gcc/pretty-print.h
parentd0891f3aa75d31744de728905f2f454e9d07ce54 (diff)
downloadgcc-07e74798b93c256bea3a91895d3517223a58da61.zip
gcc-07e74798b93c256bea3a91895d3517223a58da61.tar.gz
gcc-07e74798b93c256bea3a91895d3517223a58da61.tar.bz2
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>
Diffstat (limited to 'gcc/pretty-print.h')
-rw-r--r--gcc/pretty-print.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/pretty-print.h b/gcc/pretty-print.h
index 14a6c53..b5ded5c 100644
--- a/gcc/pretty-print.h
+++ b/gcc/pretty-print.h
@@ -282,7 +282,7 @@ public:
void emit_prefix ();
- void format (text_info *text);
+ void format (text_info &text);
void maybe_space ();
@@ -579,7 +579,8 @@ extern void pp_flush (pretty_printer *);
extern void pp_really_flush (pretty_printer *);
inline void pp_format (pretty_printer *pp, text_info *text)
{
- pp->format (text);
+ gcc_assert (text);
+ pp->format (*text);
}
extern void pp_output_formatted_text (pretty_printer *,
const urlifier * = nullptr);