void pp_cxx_function_definition (cxx_pretty_printer *pp, tree t) { tree saved_scope = pp->enclosing_scope; pp_cxx_decl_specifier_seq (pp, t); pp_cxx_declarator (pp, t); pp_needs_newline (pp) = true; pp->enclosing_scope = DECL_CONTEXT (t); if (DECL_SAVED_TREE (t)) { tree body = DECL_SAVED_TREE (t); if (TREE_CODE (body) == COMPOUND_STMT && TREE_CODE (COMPOUND_BODY (body)) == CTOR_INITIALIZER) { body = COMPOUND_BODY (body); pp_cxx_ctor_initializer (pp, body); body = TREE_CHAIN (body); } pp_cxx_statement (pp, body); } else { pp_cxx_semicolon (pp); pp_needs_newline (pp) = true; } pp_flush (pp); pp->enclosing_scope = saved_scope; }
/* Emit a slim dump of X (an insn) to the file F, including any register note attached to the instruction. */ void dump_insn_slim (FILE *f, const_rtx x) { pretty_printer rtl_slim_pp; rtl_slim_pp.buffer->stream = f; print_insn_with_notes (&rtl_slim_pp, x); pp_flush (&rtl_slim_pp); }
void dump_value_slim (FILE *f, const_rtx x, int verbose) { pretty_printer rtl_slim_pp; rtl_slim_pp.buffer->stream = f; print_value (&rtl_slim_pp, x, verbose); pp_flush (&rtl_slim_pp); }
void pp_c_function_definition (c_pretty_printer *pp, tree t) { pp_declaration_specifiers (pp, t); pp_declarator (pp, t); pp_needs_newline (pp) = true; pp_statement (pp, DECL_SAVED_TREE (t)); pp_newline (pp); pp_flush (pp); }
/* Diagnostic finalizer for C/C++/Objective-C/Objective-C++. */ static void c_diagnostic_finalizer (diagnostic_context *context, diagnostic_info *diagnostic) { diagnostic_show_locus (context, diagnostic); /* By default print macro expansion contexts in the diagnostic finalizer -- for tokens resulting from macro expansion. */ virt_loc_aware_diagnostic_finalizer (context, diagnostic); pp_destroy_prefix (context->printer); pp_flush (context->printer); }
static void custom_diagnostic_finalizer (diagnostic_context *context, diagnostic_info *diagnostic) { bool old_show_color = pp_show_color (context->printer); if (force_show_locus_color) pp_show_color (context->printer) = true; diagnostic_show_locus (context, diagnostic); pp_show_color (context->printer) = old_show_color; pp_destroy_prefix (context->printer); pp_flush (context->printer); }
static void dot_rdg_1 (FILE *file, struct graph *rdg) { int i; pretty_printer buffer; pp_needs_newline (&buffer) = false; buffer.buffer->stream = file; fprintf (file, "digraph RDG {\n"); for (i = 0; i < rdg->n_vertices; i++) { struct vertex *v = &(rdg->vertices[i]); struct graph_edge *e; fprintf (file, "%d [label=\"[%d] ", i, i); pp_gimple_stmt_1 (&buffer, RDGV_STMT (v), 0, TDF_SLIM); pp_flush (&buffer); fprintf (file, "\"]\n"); /* Highlight reads from memory. */ if (RDG_MEM_READS_STMT (rdg, i)) fprintf (file, "%d [style=filled, fillcolor=green]\n", i); /* Highlight stores to memory. */ if (RDG_MEM_WRITE_STMT (rdg, i)) fprintf (file, "%d [style=filled, fillcolor=red]\n", i); if (v->succ) for (e = v->succ; e; e = e->succ_next) switch (RDGE_TYPE (e)) { case flow_dd: /* These are the most common dependences: don't print these. */ fprintf (file, "%d -> %d \n", i, e->dest); break; case control_dd: fprintf (file, "%d -> %d [label=control] \n", i, e->dest); break; default: gcc_unreachable (); } } fprintf (file, "}\n\n"); }
static void pp_cxx_function_definition (cxx_pretty_printer *pp, tree t) { tree saved_scope = pp->enclosing_scope; pp_cxx_decl_specifier_seq (pp, t); pp_cxx_declarator (pp, t); pp_needs_newline (pp) = true; pp->enclosing_scope = DECL_CONTEXT (t); if (DECL_SAVED_TREE (t)) pp_cxx_statement (pp, DECL_SAVED_TREE (t)); else { pp_cxx_semicolon (pp); pp_needs_newline (pp) = true; } pp_flush (pp); pp->enclosing_scope = saved_scope; }
void diagnostic_finish (diagnostic_context *context) { /* Some of the errors may actually have been warnings. */ if (context->some_warnings_are_errors) { /* -Werror was given. */ if (context->warning_as_error_requested) pp_verbatim (context->printer, _("%s: all warnings being treated as errors"), progname); /* At least one -Werror= was given. */ else pp_verbatim (context->printer, _("%s: some warnings being treated as errors"), progname); pp_flush (context->printer); } }
void dump_rtl_slim (FILE *f, const_rtx first, const_rtx last, int count, int flags ATTRIBUTE_UNUSED) { const_rtx insn, tail; pretty_printer rtl_slim_pp; rtl_slim_pp.buffer->stream = f; tail = last ? NEXT_INSN (last) : NULL_RTX; for (insn = first; (insn != NULL) && (insn != tail) && (count != 0); insn = NEXT_INSN (insn)) { print_insn_with_notes (&rtl_slim_pp, insn); if (count > 0) count--; } pp_flush (&rtl_slim_pp); }
PyObject* PyGccPrettyPrinter_as_string(PyObject *obj) { struct PyGccPrettyPrinter *ppobj; int len; /* FIXME: */ assert(Py_TYPE(obj) == &PyGccPrettyPrinter_TypeObj); ppobj = (struct PyGccPrettyPrinter *)obj; /* Flush the pp first. This forcibly adds a trailing newline: */ pp_flush(&ppobj->pp); /* Convert to a python string, leaving off the trailing newline: */ len = strlen(ppobj->buf); assert(len > 0); if ('\n' == ppobj->buf[len - 1]) { return PyGccString_FromString_and_size(ppobj->buf, len - 1); } else { return PyGccString_FromString(ppobj->buf); } }