aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2024-06-12 09:15:09 -0400
committerDavid Malcolm <dmalcolm@redhat.com>2024-06-12 09:15:09 -0400
commit1cae1a5ce088c1fa351b5752d43de52f1f116a75 (patch)
tree17acbd2d1cab142f7b402b2d46e46a109808a69f /gcc/cp
parentc5e3be456888aa48f591512ec28183703e70978c (diff)
downloadgcc-1cae1a5ce088c1fa351b5752d43de52f1f116a75.zip
gcc-1cae1a5ce088c1fa351b5752d43de52f1f116a75.tar.gz
gcc-1cae1a5ce088c1fa351b5752d43de52f1f116a75.tar.bz2
pretty_printer: convert chunk_info into a class
No functional change intended. gcc/cp/ChangeLog: * error.cc (append_formatted_chunk): Move part of body into chunk_info::append_formatted_chunk. gcc/ChangeLog: * dumpfile.cc (dump_pretty_printer::emit_items): Update for changes to chunk_info. * pretty-print.cc (chunk_info::append_formatted_chunk): New, based on code in cp/error.cc's append_formatted_chunk. (chunk_info::pop_from_output_buffer): New, based on code in pp_output_formatted_text and dump_pretty_printer::emit_items. (on_begin_quote): Convert to... (chunk_info::on_begin_quote): ...this. (on_end_quote): Convert to... (chunk_info::on_end_quote): ...this. (pretty_printer::format): Update for chunk_info becoming a class and its fields gaining "m_" prefixes. Update for on_begin_quote and on_end_quote moving to chunk_info. (quoting_info::handle_phase_3): Update for changes to chunk_info. (pp_output_formatted_text): Likewise. Move cleanup code to chunk_info::pop_from_output_buffer. * pretty-print.h (class output_buffer): New forward decl. (class urlifier): New forward decl. (struct chunk_info): Convert to... (class chunk_info): ...this. Add friend class pretty_printer. (chunk_info::get_args): New accessor. (chunk_info::get_quoting_info): New accessor. (chunk_info::append_formatted_chunk): New decl. (chunk_info::pop_from_output_buffer): New decl. (chunk_info::on_begin_quote): New decl. (chunk_info::on_end_quote): New decl. (chunk_info::prev): Rename to... (chunk_info::m_prev): ...this. (chunk_info::args): Rename to... (chunk_info::m_args): ...this. (output_buffer::cur_chunk_array): Drop "struct" from decl. Signed-off-by: David Malcolm <dmalcolm@redhat.com>
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/error.cc10
1 files changed, 2 insertions, 8 deletions
diff --git a/gcc/cp/error.cc b/gcc/cp/error.cc
index 01ad794..171a352 100644
--- a/gcc/cp/error.cc
+++ b/gcc/cp/error.cc
@@ -4307,14 +4307,8 @@ static void
append_formatted_chunk (pretty_printer *pp, const char *content)
{
output_buffer *buffer = pp_buffer (pp);
- struct chunk_info *chunk_array = buffer->cur_chunk_array;
- const char **args = chunk_array->args;
-
- unsigned int chunk_idx;
- for (chunk_idx = 0; args[chunk_idx]; chunk_idx++)
- ;
- args[chunk_idx++] = content;
- args[chunk_idx] = NULL;
+ chunk_info *chunk_array = buffer->cur_chunk_array;
+ chunk_array->append_formatted_chunk (content);
}
/* Create a copy of CONTENT, with quotes added, and,