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.