aboutsummaryrefslogtreecommitdiff
path: root/gcc/pretty-print.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/pretty-print.c')
-rw-r--r--gcc/pretty-print.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/pretty-print.c b/gcc/pretty-print.c
index 511ef0a..084e03c 100644
--- a/gcc/pretty-print.c
+++ b/gcc/pretty-print.c
@@ -1590,6 +1590,32 @@ pretty_printer::pretty_printer (int maximum_length)
pp_set_prefix (this, NULL);
}
+/* Copy constructor for pretty_printer. */
+
+pretty_printer::pretty_printer (const pretty_printer &other)
+: buffer (new (XCNEW (output_buffer)) output_buffer ()),
+ prefix (),
+ padding (other.padding),
+ maximum_length (other.maximum_length),
+ indent_skip (other.indent_skip),
+ wrapping (other.wrapping),
+ format_decoder (other.format_decoder),
+ m_format_postprocessor (NULL),
+ emitted_prefix (other.emitted_prefix),
+ need_newline (other.need_newline),
+ translate_identifiers (other.translate_identifiers),
+ show_color (other.show_color),
+ show_urls (other.show_urls)
+{
+ pp_line_cutoff (this) = maximum_length;
+ /* By default, we emit prefixes once per message. */
+ pp_prefixing_rule (this) = pp_prefixing_rule (&other);
+ pp_set_prefix (this, NULL);
+
+ if (other.m_format_postprocessor)
+ m_format_postprocessor = other.m_format_postprocessor->clone ();
+}
+
pretty_printer::~pretty_printer ()
{
if (m_format_postprocessor)
@@ -1599,6 +1625,14 @@ pretty_printer::~pretty_printer ()
free (prefix);
}
+/* Base class implementation of pretty_printer::clone vfunc. */
+
+pretty_printer *
+pretty_printer::clone () const
+{
+ return new pretty_printer (*this);
+}
+
/* Append a string delimited by START and END to the output area of
PRETTY-PRINTER. No line wrapping is done. However, if beginning a
new line then emit PRETTY-PRINTER's prefix and skip any leading