GCC Middle and Back End API Reference
tree-pretty-print-markup.h
Go to the documentation of this file.
1/* Copyright (C) 2024 Free Software Foundation, Inc.
2 Contributed by David Malcolm <dmalcolm@redhat.com>
3
4This file is part of GCC.
5
6GCC is free software; you can redistribute it and/or modify it under
7the terms of the GNU General Public License as published by the Free
8Software Foundation; either version 3, or (at your option) any later
9version.
10
11GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12WARRANTY; without even the implied warranty of MERCHANTABILITY or
13FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14for more details.
15
16You should have received a copy of the GNU General Public License
17along with GCC; see the file COPYING3. If not see
18<http://www.gnu.org/licenses/>. */
19
20#ifndef GCC_TREE_PRETTY_PRINT_MARKUP_H
21#define GCC_TREE_PRETTY_PRINT_MARKUP_H
22
23#include "pretty-print-markup.h"
25
26namespace pp_markup {
27
28/* Concrete subclass of pp_markup::element.
29 Print a type in quotes with the given highlighting color. */
30
32{
33public:
34 element_quoted_type (tree type, const char *highlight_color)
35 : m_type (type),
36 m_highlight_color (highlight_color)
37 {
38 }
39
40 void add_to_phase_2 (context &ctxt) override
41 {
42 ctxt.begin_quote ();
44
45 print_type (ctxt);
46
47 ctxt.end_highlight_color ();
48 ctxt.end_quote ();
49 }
50
51 void print_type (context &ctxt);
52
53private:
55 const char *m_highlight_color;
56};
57
58/* Concrete subclass of pp_markup::element.
59 Print a type in quotes highlighted as the "expected" type. */
60
69
70/* Concrete subclass of pp_markup::element.
71 Print a type in quotes highlighted as the "actual" type. */
72
81
82} // namespace pp_markup
83
84#endif /* GCC_TREE_PRETTY_PRINT_MARKUP_H */
Definition pretty-print-markup.h:30
void end_highlight_color()
Definition pretty-print.cc:3080
void begin_highlight_color(const char *color_name)
Definition pretty-print.cc:3069
void end_quote()
Definition pretty-print.cc:3056
void begin_quote()
Definition pretty-print.cc:3046
Definition tree-pretty-print-markup.h:74
element_actual_type(tree type)
Definition tree-pretty-print-markup.h:76
Definition tree-pretty-print-markup.h:62
element_expected_type(tree type)
Definition tree-pretty-print-markup.h:64
Definition tree-pretty-print-markup.h:32
const char * m_highlight_color
Definition tree-pretty-print-markup.h:55
void add_to_phase_2(context &ctxt) override
Definition tree-pretty-print-markup.h:40
tree m_type
Definition tree-pretty-print-markup.h:54
void print_type(context &ctxt)
element_quoted_type(tree type, const char *highlight_color)
Definition tree-pretty-print-markup.h:34
Definition pretty-print-markup.h:61
union tree_node * tree
Definition coretypes.h:97
Definition diagnostic-highlight-colors.h:44
Definition coretypes.h:172
Definition gengtype.h:252