aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-pretty-print.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-pretty-print.c')
-rw-r--r--gcc/tree-pretty-print.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/tree-pretty-print.c b/gcc/tree-pretty-print.c
index 990cc21..2c089b1 100644
--- a/gcc/tree-pretty-print.c
+++ b/gcc/tree-pretty-print.c
@@ -162,6 +162,16 @@ print_generic_expr (FILE *file, tree t, dump_flags_t flags)
pp_flush (tree_pp);
}
+/* Print a single expression T to string, and return it. */
+
+char *
+print_generic_expr_to_str (tree t)
+{
+ pretty_printer pp;
+ dump_generic_node (&pp, t, 0, TDF_VOPS|TDF_MEMSYMS, false);
+ return xstrdup (pp_formatted_text (&pp));
+}
+
/* Dump NAME, an IDENTIFIER_POINTER, sanitized so that D<num> sequences
in it are replaced with Dxxxx, as long as they are at the start or
preceded by $ and at the end or followed by $. See make_fancy_name