Branch data Line data Source code
1 : : /* Classes for adding special effects when quoting source code.
2 : : Copyright (C) 2024 Free Software Foundation, Inc.
3 : : Contributed by David Malcolm <dmalcolm@redhat.com>.
4 : :
5 : : This file is part of GCC.
6 : :
7 : : GCC is free software; you can redistribute it and/or modify it
8 : : under the terms of the GNU General Public License as published by
9 : : the Free Software Foundation; either version 3, or (at your option)
10 : : any later version.
11 : :
12 : : GCC is distributed in the hope that it will be useful, but
13 : : WITHOUT ANY WARRANTY; without even the implied warranty of
14 : : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 : : General Public License for more details.
16 : :
17 : : You should have received a copy of the GNU General Public License
18 : : along with GCC; see the file COPYING3. If not see
19 : : <http://www.gnu.org/licenses/>. */
20 : :
21 : : #ifndef GCC_DIAGNOSTIC_LABEL_EFFECTS_H
22 : : #define GCC_DIAGNOSTIC_LABEL_EFFECTS_H
23 : :
24 : : /* Abstract base class for describing special effects when printing
25 : : a label when quoting source code. */
26 : :
27 : 2577 : class label_effects
28 : : {
29 : : public:
30 : 2577 : virtual ~label_effects () {}
31 : :
32 : : /* Adding links between labels, e.g. for visualizing control flow
33 : : in execution paths. */
34 : : virtual bool has_in_edge (unsigned range_idx) const = 0;
35 : : virtual bool has_out_edge (unsigned range_idx) const = 0;
36 : : };
37 : :
38 : : /* A class to hold state when quoting a run of lines of source code. */
39 : :
40 : : class diagnostic_source_effect_info
41 : : {
42 : : public:
43 : 2577 : diagnostic_source_effect_info ()
44 : 2577 : : m_leading_in_edge_column (-1),
45 : 2577 : m_trailing_out_edge_column (-1)
46 : : {
47 : : }
48 : :
49 : : /* The column for an incoming link to the first label,
50 : : or -1 if no such link. */
51 : : int m_leading_in_edge_column;
52 : :
53 : : /* The column for an outgoing link from the final label,
54 : : or -1 if no such link. */
55 : : int m_trailing_out_edge_column;
56 : : };
57 : :
58 : : #endif /* GCC_DIAGNOSTIC_LABEL_EFFECTS_H */
|