GCC Middle and Back End API Reference
pretty-print.h File Reference
#include "obstack.h"
#include "input.h"
Include dependency graph for pretty-print.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  text_info
struct  chunk_info
struct  output_buffer
struct  pp_wrapping_mode_t
struct  pretty_printer

Macros

#define PP_NL_ARGMAX   30
#define pp_line_cutoff(PP)   (PP)->wrapping.line_cutoff
#define pp_prefixing_rule(PP)   (PP)->wrapping.rule
#define pp_wrapping_mode(PP)   (PP)->wrapping
#define pp_format_decoder(PP)   (PP)->format_decoder
#define pp_needs_newline(PP)   (PP)->need_newline
#define pp_is_wrapping_line(PP)   (pp_line_cutoff (PP) > 0)
#define pp_indentation(PP)   (PP)->indent_skip
#define pp_translate_identifiers(PP)   (PP)->translate_identifiers
#define pp_show_color(PP)   (PP)->show_color
#define pp_space(PP)   pp_character (PP, ' ')
#define pp_left_paren(PP)   pp_character (PP, '(')
#define pp_right_paren(PP)   pp_character (PP, ')')
#define pp_left_bracket(PP)   pp_character (PP, '[')
#define pp_right_bracket(PP)   pp_character (PP, ']')
#define pp_left_brace(PP)   pp_character (PP, '{')
#define pp_right_brace(PP)   pp_character (PP, '}')
#define pp_semicolon(PP)   pp_character (PP, ';')
#define pp_comma(PP)   pp_character (PP, ',')
#define pp_dot(PP)   pp_character (PP, '.')
#define pp_colon(PP)   pp_character (PP, ':')
#define pp_colon_colon(PP)   pp_string (PP, "::")
#define pp_arrow(PP)   pp_string (PP, "->")
#define pp_equal(PP)   pp_character (PP, '=')
#define pp_question(PP)   pp_character (PP, '?')
#define pp_bar(PP)   pp_character (PP, '|')
#define pp_bar_bar(PP)   pp_string (PP, "||")
#define pp_carret(PP)   pp_character (PP, '^')
#define pp_ampersand(PP)   pp_character (PP, '&')
#define pp_ampersand_ampersand(PP)   pp_string (PP, "&&")
#define pp_less(PP)   pp_character (PP, '<')
#define pp_less_equal(PP)   pp_string (PP, "<=")
#define pp_greater(PP)   pp_character (PP, '>')
#define pp_greater_equal(PP)   pp_string (PP, ">=")
#define pp_plus(PP)   pp_character (PP, '+')
#define pp_minus(PP)   pp_character (PP, '-')
#define pp_star(PP)   pp_character (PP, '*')
#define pp_slash(PP)   pp_character (PP, '/')
#define pp_modulo(PP)   pp_character (PP, '%')
#define pp_exclamation(PP)   pp_character (PP, '!')
#define pp_complement(PP)   pp_character (PP, '~')
#define pp_quote(PP)   pp_character (PP, '\'')
#define pp_backquote(PP)   pp_character (PP, '`')
#define pp_doublequote(PP)   pp_character (PP, '"')
#define pp_underscore(PP)   pp_character (PP, '_')
#define pp_maybe_newline_and_indent(PP, N)   if (pp_needs_newline (PP)) pp_newline_and_indent (PP, N)
#define pp_scalar(PP, FORMAT, SCALAR)
#define pp_decimal_int(PP, I)   pp_scalar (PP, "%d", I)
#define pp_unsigned_wide_integer(PP, I)   pp_scalar (PP, HOST_WIDE_INT_PRINT_UNSIGNED, (unsigned HOST_WIDE_INT) I)
#define pp_wide_integer(PP, I)   pp_scalar (PP, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) I)
#define pp_widest_integer(PP, I)   pp_scalar (PP, HOST_WIDEST_INT_PRINT_DEC, (HOST_WIDEST_INT) I)
#define pp_pointer(PP, P)   pp_scalar (PP, "%p", P)
#define pp_identifier(PP, ID)
#define pp_buffer(PP)   (PP)->buffer
#define GCC_PPDIAG_STYLE   __gcc_diag__
#define ATTRIBUTE_GCC_PPDIAG(m, n)   ATTRIBUTE_NONNULL(m)
#define pp_set_verbatim_wrapping(PP)   pp_set_verbatim_wrapping_ (PP)

Typedefs

typedef unsigned int pp_flags
typedef bool(* printer_fn )(pretty_printer *, text_info *, const char *, int, bool, bool, bool)

Enumerations

enum  diagnostic_prefixing_rule_t { DIAGNOSTICS_SHOW_PREFIX_ONCE = 0x0, DIAGNOSTICS_SHOW_PREFIX_NEVER = 0x1, DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE = 0x2 }
enum  pp_padding { pp_none, pp_before, pp_after }

Functions

static const char * pp_get_prefix (const pretty_printer *pp)
void pp_set_line_maximum_length (pretty_printer *, int)
void pp_set_prefix (pretty_printer *, const char *)
void pp_destroy_prefix (pretty_printer *)
int pp_remaining_character_count_for_line (pretty_printer *)
void pp_clear_output_area (pretty_printer *)
const char * pp_formatted_text (pretty_printer *)
const char * pp_last_position_in_text (const pretty_printer *)
void pp_emit_prefix (pretty_printer *)
void pp_append_text (pretty_printer *, const char *, const char *)
void pp_newline_and_flush (pretty_printer *)
void pp_newline_and_indent (pretty_printer *, int)
void pp_separate_with (pretty_printer *, char)
void pp_printf (pretty_printer *, const char *,...) ATTRIBUTE_GCC_PPDIAG(2
void void pp_verbatim (pretty_printer *, const char *,...) ATTRIBUTE_GCC_PPDIAG(2
void void void pp_flush (pretty_printer *)
void pp_format (pretty_printer *, text_info *)
void pp_output_formatted_text (pretty_printer *)
void pp_format_verbatim (pretty_printer *, text_info *)
void pp_indent (pretty_printer *)
void pp_newline (pretty_printer *)
void pp_character (pretty_printer *, int)
void pp_string (pretty_printer *, const char *)
void pp_write_text_to_stream (pretty_printer *)
void pp_write_text_as_dot_label_to_stream (pretty_printer *, bool)
void pp_maybe_space (pretty_printer *)
static pp_wrapping_mode_t pp_set_verbatim_wrapping_ ()
const char * identifier_to_locale (const char *)

Variables

void *(* identifier_to_locale_alloc )(size_t)
void(* identifier_to_locale_free )(void *)

Macro Definition Documentation

#define ATTRIBUTE_GCC_PPDIAG (   m,
 
)    ATTRIBUTE_NONNULL(m)

This header may be included before diagnostics-core.h, hence the duplicate definitions to allow for GCC-specific formats.

#define GCC_PPDIAG_STYLE   __gcc_diag__

If we haven't already defined a front-end-specific diagnostics style, use the generic one.

#define pp_ampersand (   PP)    pp_character (PP, '&')
#define pp_ampersand_ampersand (   PP)    pp_string (PP, "&&")
#define pp_arrow (   PP)    pp_string (PP, "->")
#define pp_backquote (   PP)    pp_character (PP, '`')
#define pp_bar (   PP)    pp_character (PP, '|')

Referenced by dump_rtl_slim().

#define pp_bar_bar (   PP)    pp_string (PP, "||")
#define pp_carret (   PP)    pp_character (PP, '^')
#define pp_colon (   PP)    pp_character (PP, ':')

Referenced by dump_ssaname_info().

#define pp_colon_colon (   PP)    pp_string (PP, "::")
#define pp_comma (   PP)    pp_character (PP, ',')
#define pp_complement (   PP)    pp_character (PP, '~')
#define pp_decimal_int (   PP,
  I 
)    pp_scalar (PP, "%d", I)
#define pp_dot (   PP)    pp_character (PP, '.')
#define pp_doublequote (   PP)    pp_character (PP, '"')
#define pp_equal (   PP)    pp_character (PP, '=')
#define pp_exclamation (   PP)    pp_character (PP, '!')
#define pp_format_decoder (   PP)    (PP)->format_decoder

Client supplied function used to decode formats.

#define pp_greater (   PP)    pp_character (PP, '>')

Referenced by dump_gimple_omp_teams().

#define pp_greater_equal (   PP)    pp_string (PP, ">=")
#define pp_identifier (   PP,
  ID 
)
#define pp_indentation (   PP)    (PP)->indent_skip

The amount of whitespace to be emitted when starting a new line.

Referenced by pp_maybe_wrap_text(), and pp_newline().

#define pp_is_wrapping_line (   PP)    (pp_line_cutoff (PP) > 0)

True if PRETTY-PRINTER is in line-wrapping mode.

Referenced by pp_remaining_character_count_for_line().

#define pp_left_brace (   PP)    pp_character (PP, '{')
#define pp_left_bracket (   PP)    pp_character (PP, '[')
#define pp_left_paren (   PP)    pp_character (PP, '(')
#define pp_less (   PP)    pp_character (PP, '<')
#define pp_less_equal (   PP)    pp_string (PP, "<=")
#define pp_line_cutoff (   PP)    (PP)->wrapping.line_cutoff

Maximum characters per line in automatic line wrapping mode. Zero means don't wrap lines.

Referenced by pp_emit_prefix().

#define pp_maybe_newline_and_indent (   PP,
  N 
)    if (pp_needs_newline (PP)) pp_newline_and_indent (PP, N)
#define pp_minus (   PP)    pp_character (PP, '-')
#define pp_modulo (   PP)    pp_character (PP, '%')

Referenced by print_value().

#define pp_needs_newline (   PP)    (PP)->need_newline

TRUE if a newline character needs to be added before further formatting.

Referenced by debug_gimple_stmt(), dump_rdg(), pp_last_position_in_text(), and pp_newline().

#define PP_NL_ARGMAX   30

Various declarations for language-independent pretty-print subroutines. Copyright (C) 2002-2013 Free Software Foundation, Inc. Contributed by Gabriel Dos Reis gdr@i.nosp@m.nteg.nosp@m.rable.nosp@m.-sol.nosp@m.ution.nosp@m.s.ne.nosp@m.t

This file is part of GCC.

GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.

GCC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with GCC; see the file COPYING3. If not see http://www.gnu.org/licenses/. Maximum number of format string arguments.

Referenced by pp_indent().

#define pp_plus (   PP)    pp_character (PP, '+')
#define pp_pointer (   PP,
 
)    pp_scalar (PP, "%p", P)
#define pp_prefixing_rule (   PP)    (PP)->wrapping.rule

Prefixing rule used in formatting a diagnostic message.

Referenced by pp_emit_prefix(), and pp_set_line_maximum_length().

#define pp_question (   PP)    pp_character (PP, '?')
#define pp_quote (   PP)    pp_character (PP, '\'')
#define pp_right_brace (   PP)    pp_character (PP, '}')
#define pp_right_bracket (   PP)    pp_character (PP, ']')

Referenced by print_value().

#define pp_right_paren (   PP)    pp_character (PP, ')')
#define pp_scalar (   PP,
  FORMAT,
  SCALAR 
)
Value:
do \
{ \
sprintf (pp_buffer (PP)->digit_buffer, FORMAT, SCALAR); \
pp_string (PP, pp_buffer (PP)->digit_buffer); \
} \
while (0)

Referenced by dump_gimple_fmt(), and print_value().

#define pp_semicolon (   PP)    pp_character (PP, ';')
#define pp_set_verbatim_wrapping (   PP)    pp_set_verbatim_wrapping_ (PP)
#define pp_show_color (   PP)    (PP)->show_color

True if colors should be shown.

Referenced by diagnostic_build_prefix().

#define pp_slash (   PP)    pp_character (PP, '/')
#define pp_star (   PP)    pp_character (PP, '*')
#define pp_translate_identifiers (   PP)    (PP)->translate_identifiers

True if identifiers are translated to the locale character set on output.

#define pp_underscore (   PP)    pp_character (PP, '_')
#define pp_unsigned_wide_integer (   PP,
  I 
)    pp_scalar (PP, HOST_WIDE_INT_PRINT_UNSIGNED, (unsigned HOST_WIDE_INT) I)
#define pp_wide_integer (   PP,
  I 
)    pp_scalar (PP, HOST_WIDE_INT_PRINT_DEC, (HOST_WIDE_INT) I)

Referenced by asan_clear_shadow().

#define pp_widest_integer (   PP,
  I 
)    pp_scalar (PP, HOST_WIDEST_INT_PRINT_DEC, (HOST_WIDEST_INT) I)
#define pp_wrapping_mode (   PP)    (PP)->wrapping

Get or set the wrapping mode as a single entity.


Typedef Documentation

typedef unsigned int pp_flags

The type of pretty-printer flags passed to clients.

typedef bool(* printer_fn)(pretty_printer *, text_info *, const char *, int, bool, bool, bool)

The type of a hook that formats client-specific data onto a pretty_pinter. A client-supplied formatter returns true if everything goes well, otherwise it returns false.


Enumeration Type Documentation

How often diagnostics are prefixed by their locations: o DIAGNOSTICS_SHOW_PREFIX_NEVER: never - not yet supported; o DIAGNOSTICS_SHOW_PREFIX_ONCE: emit only once; o DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE: emit each time a physical line is started.

Enumerator:
DIAGNOSTICS_SHOW_PREFIX_ONCE 
DIAGNOSTICS_SHOW_PREFIX_NEVER 
DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE 
enum pp_padding
Enumerator:
pp_none 
pp_before 
pp_after 

Function Documentation

const char* identifier_to_locale ( const char *  )
void pp_append_text ( pretty_printer ,
const char *  ,
const char *   
)
void pp_character ( pretty_printer ,
int   
)
void pp_clear_output_area ( pretty_printer )
void pp_destroy_prefix ( pretty_printer )
void pp_emit_prefix ( pretty_printer )
void void void pp_flush ( pretty_printer )
void pp_format ( pretty_printer ,
text_info  
)
void pp_format_verbatim ( pretty_printer ,
text_info  
)
const char* pp_formatted_text ( pretty_printer )
static const char* pp_get_prefix ( const pretty_printer pp)
inlinestatic

Referenced by trim_filename().

void pp_indent ( pretty_printer )
const char* pp_last_position_in_text ( const pretty_printer )
void pp_maybe_space ( pretty_printer )
void pp_newline ( pretty_printer )
void pp_newline_and_flush ( pretty_printer )
void pp_newline_and_indent ( pretty_printer ,
int   
)
void pp_output_formatted_text ( pretty_printer )
void pp_printf ( pretty_printer ,
const char *  ,
  ... 
)
int pp_remaining_character_count_for_line ( pretty_printer )
void pp_separate_with ( pretty_printer ,
char   
)
void pp_set_line_maximum_length ( pretty_printer ,
int   
)
void pp_set_prefix ( pretty_printer ,
const char *   
)
static pp_wrapping_mode_t pp_set_verbatim_wrapping_ ( )
inlinestatic

Switch into verbatim mode and return the old mode.

void pp_string ( pretty_printer ,
const char *   
)
void void pp_verbatim ( pretty_printer ,
const char *  ,
  ... 
)
void pp_write_text_as_dot_label_to_stream ( pretty_printer ,
bool   
)
void pp_write_text_to_stream ( pretty_printer )

Variable Documentation

void*(* identifier_to_locale_alloc)(size_t)

Allocator for identifier_to_locale and corresponding function to free memory.

Referenced by decode_utf8_char().

void(* identifier_to_locale_free)(void *)