aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/cxx-pretty-print.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2019-12-11 19:06:39 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2019-12-11 19:06:39 +0000
commit368877a11b789a74b1ae5b878e3bd30039118c30 (patch)
tree616fe464613c54fdd3f9145a99dc1e15724d8745 /gcc/cp/cxx-pretty-print.c
parent34a53788fec49e0a85bd32b51b057cfaae0200c8 (diff)
downloadgcc-368877a11b789a74b1ae5b878e3bd30039118c30.zip
gcc-368877a11b789a74b1ae5b878e3bd30039118c30.tar.gz
gcc-368877a11b789a74b1ae5b878e3bd30039118c30.tar.bz2
Introduce pretty_printer::clone vfunc
This patch provides a way to clone a pretty_printer. This is needed so that we can capture text in a label_text and make layout decisions based on it, using the policy of global_dc's printer, whilst within a call to diagnostic_show_locus. We can't print with the pretty_printer itself within a call to diagnostic_show_locus since it has partly-buffered content. gcc/c-family/ChangeLog: * c-pretty-print.c (c_pretty_printer::clone): New vfunc implementation. * c-pretty-print.h (c_pretty_printer::clone): New vfunc decl. gcc/cp/ChangeLog: * cxx-pretty-print.c (cxx_pretty_printer::clone): New vfunc implementation. * cxx-pretty-print.h (cxx_pretty_printer::clone): New vfunc decl. * error.c (cxx_format_postprocessor::clone): New vfunc. gcc/ChangeLog: * pretty-print.c (pretty_printer::pretty_printer): New copy-ctor. (pretty_printer::clone): New vfunc implementation. * pretty-print.h (format_postprocessor::clone): New pure vfunc decl. (pretty_printer::pretty_printer): New copy-ctor decl. (pretty_printer::clone): New vfunc decl. From-SVN: r279244
Diffstat (limited to 'gcc/cp/cxx-pretty-print.c')
-rw-r--r--gcc/cp/cxx-pretty-print.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c
index 6280544..b14aa96 100644
--- a/gcc/cp/cxx-pretty-print.c
+++ b/gcc/cp/cxx-pretty-print.c
@@ -2968,3 +2968,11 @@ cxx_pretty_printer::cxx_pretty_printer ()
type_specifier_seq = (pp_fun) pp_cxx_type_specifier_seq;
parameter_list = (pp_fun) pp_cxx_parameter_declaration_clause;
}
+
+/* cxx_pretty_printer's implementation of pretty_printer::clone vfunc. */
+
+pretty_printer *
+cxx_pretty_printer::clone () const
+{
+ return new cxx_pretty_printer (*this);
+}