libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / tree-pretty-print-markup.h
blob05400d980b66149494aa5be38533bf964020403d
1 /* Copyright (C) 2024 Free Software Foundation, Inc.
2 Contributed by David Malcolm <dmalcolm@redhat.com>
4 This file is part of GCC.
6 GCC is free software; you can redistribute it and/or modify it under
7 the terms of the GNU General Public License as published by the Free
8 Software Foundation; either version 3, or (at your option) any later
9 version.
11 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 for more details.
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
20 #ifndef GCC_TREE_PRETTY_PRINT_MARKUP_H
21 #define GCC_TREE_PRETTY_PRINT_MARKUP_H
23 #include "pretty-print-markup.h"
24 #include "diagnostic-highlight-colors.h"
26 namespace pp_markup {
28 /* Concrete subclass of pp_markup::element.
29 Print a type in quotes with the given highlighting color. */
31 class element_quoted_type : public element
33 public:
34 element_quoted_type (tree type, const char *highlight_color)
35 : m_type (type),
36 m_highlight_color (highlight_color)
40 void add_to_phase_2 (context &ctxt) override
42 ctxt.begin_quote ();
43 ctxt.begin_highlight_color (m_highlight_color);
45 print_type (ctxt);
47 ctxt.end_highlight_color ();
48 ctxt.end_quote ();
51 void print_type (context &ctxt);
53 private:
54 tree m_type;
55 const char *m_highlight_color;
58 /* Concrete subclass of pp_markup::element.
59 Print a type in quotes highlighted as the "expected" type. */
61 class element_expected_type : public element_quoted_type
63 public:
64 element_expected_type (tree type)
65 : element_quoted_type (type, highlight_colors::expected)
70 /* Concrete subclass of pp_markup::element.
71 Print a type in quotes highlighted as the "actual" type. */
73 class element_actual_type : public element_quoted_type
75 public:
76 element_actual_type (tree type)
77 : element_quoted_type (type, highlight_colors::actual)
82 } // namespace pp_markup
84 #endif /* GCC_TREE_PRETTY_PRINT_MARKUP_H */