GCC Middle and Back End API Reference
pp_token Struct Reference

#include <pretty-print-format-impl.h>

Inheritance diagram for pp_token:
Collaboration diagram for pp_token:

Public Types

enum class  kind {
  text , begin_color , end_color , begin_quote ,
  end_quote , begin_url , end_url , event_id ,
  custom_data , NUM_KINDS
}
 

Public Member Functions

 pp_token (enum kind k)
 
 pp_token (const pp_token &)=delete
 
 pp_token (pp_token &&)=delete
 
virtual ~pp_token ()=default
 
pp_tokenoperator= (const pp_token &)=delete
 
pp_tokenoperator= (pp_token &&)=delete
 
void dump (FILE *out) const
 
void DEBUG_FUNCTION dump () const
 

Static Public Member Functions

static void * operator new (size_t sz, obstack &s)
 
static void operator delete (void *)
 

Data Fields

enum kind m_kind
 
pp_tokenm_prev
 
pp_tokenm_next
 

Detailed Description

Implementation detail of pp_format.
   Copyright (C) 2002-2024 Free Software Foundation, Inc.
   Contributed by Gabriel Dos Reis <gdr@integrable-solutions.net>

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/>.   
A struct representing a pending item to be printed within
pp_format.

These can represent:
- a run of text within one of the output_buffers's obstacks
- begin/end named color
- open/close quote
- begin/end URL
- event IDs
- custom data (for the formatter, for the pretty_printer,
  or the output format)

These are built into pp_token_list instances.

Doing so allows for interaction between:

- pretty_printer formatting codes (such as C++'s %H and %I,
which can't be printed until we've seen both)

- output formats, such as text vs SARIF (so each can handle URLs
and event IDs it its own way)

- optimization records, where we want to stash data into the
formatted messages

- urlifiers: these can be run in phase 3 of formatting

without needing lots of fragile logic on char pointers.

To avoid needing lots of heap allocation/deallocation, pp_token
instances are allocated in the pretty_printer's chunk_obstack:
they must not outlive phase 3 of formatting of the given
pp_formatted_chunks level.   

Member Enumeration Documentation

◆ kind

enum class pp_token::kind
strong
Enumerator
text 
begin_color 
end_color 
begin_quote 
end_quote 
begin_url 
end_url 
event_id 
custom_data 
NUM_KINDS 

Constructor & Destructor Documentation

◆ pp_token() [1/3]

pp_token::pp_token ( enum kind k)
struct pp_token.   

◆ pp_token() [2/3]

pp_token::pp_token ( const pp_token & )
delete

◆ pp_token() [3/3]

pp_token::pp_token ( pp_token && )
delete

◆ ~pp_token()

virtual pp_token::~pp_token ( )
virtualdefault

Member Function Documentation

◆ dump() [1/2]

void DEBUG_FUNCTION pp_token::dump ( ) const
inline

References dump().

Referenced by dump().

◆ dump() [2/2]

void pp_token::dump ( FILE * out) const

◆ operator delete()

void pp_token::operator delete ( void * )
static

◆ operator new()

void * pp_token::operator new ( size_t sz,
obstack & s )
static
Make room for a pp_token instance within obstack S.   

References allocate_object().

◆ operator=() [1/2]

pp_token & pp_token::operator= ( const pp_token & )
delete

◆ operator=() [2/2]

pp_token & pp_token::operator= ( pp_token && )
delete

Field Documentation

◆ m_kind

◆ m_next

◆ m_prev


The documentation for this struct was generated from the following files: