#include <pretty-print-format-impl.h>
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_token & | operator= (const pp_token &)=delete |
pp_token & | operator= (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_token * | m_prev |
pp_token * | m_next |
Implementation detail of pp_format. Copyright (C) 2002-2025 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.
|
strong |
pp_token::pp_token | ( | enum kind | k | ) |
struct pp_token.
References m_kind, m_next, and m_prev.
Referenced by operator=(), operator=(), pp_token(), pp_token(), pp_token_begin_color::pp_token_begin_color(), pp_token_begin_quote::pp_token_begin_quote(), pp_token_begin_url::pp_token_begin_url(), pp_token_custom_data::pp_token_custom_data(), pp_token_end_color::pp_token_end_color(), pp_token_end_quote::pp_token_end_quote(), pp_token_end_url::pp_token_end_url(), pp_token_event_id::pp_token_event_id(), and pp_token_text::pp_token_text().
|
delete |
References pp_token().
|
delete |
References pp_token().
|
virtualdefault |
|
inline |
References DEBUG_FUNCTION, and dump().
Referenced by dump().
void pp_token::dump | ( | FILE * | out | ) | const |
References as_a(), begin_color, begin_quote, begin_url, custom_data, end_color, end_quote, end_url, event_id, gcc_assert, gcc_unreachable, m_kind, and text.
|
static |
|
static |
Make room for a pp_token instance within obstack S.
References allocate_object(), and obstack.
References pp_token().
References pp_token().
enum kind pp_token::m_kind |
pp_token* pp_token::m_next |
Referenced by pp_token_list::apply_urlifier(), default_token_printer(), pp_token_list::insert_after(), pp_token_list::merge_consecutive_text_tokens(), pp_token_list::pop_front(), pp_token(), dump_pretty_printer::custom_token_printer::print_tokens(), sarif_builder::sarif_token_printer::print_tokens(), pp_token_list::remove_token(), pp_token_list::replace_custom_tokens(), and pp_token_list::~pp_token_list().
pp_token* pp_token::m_prev |
Referenced by pp_token_list::insert_after(), pp_token_list::pop_front(), pp_token(), and pp_token_list::remove_token().