aboutsummaryrefslogtreecommitdiff
path: root/gcc/diagnostic-label-effects.h
blob: e640f3d1a1fe0eb5ccf02d734f220ab2986665c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* Classes for adding special effects when quoting source code.
   Copyright (C) 2024 Free Software Foundation, Inc.
   Contributed by David Malcolm <dmalcolm@redhat.com>.

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/>.  */

#ifndef GCC_DIAGNOSTIC_LABEL_EFFECTS_H
#define GCC_DIAGNOSTIC_LABEL_EFFECTS_H

/* Abstract base class for describing special effects when printing
   a label when quoting source code.  */

class label_effects
{
public:
  virtual ~label_effects () {}

  /* Adding links between labels, e.g. for visualizing control flow
     in execution paths.  */
  virtual bool has_in_edge (unsigned range_idx) const = 0;
  virtual bool has_out_edge (unsigned range_idx) const = 0;
};

/* A class to hold state when quoting a run of lines of source code.  */

class diagnostic_source_effect_info
{
public:
  diagnostic_source_effect_info ()
  : m_leading_in_edge_column (-1),
    m_trailing_out_edge_column (-1)
  {
  }

  /* The column for an incoming link to the first label,
     or -1 if no such link.  */
  int m_leading_in_edge_column;

  /* The column for an outgoing link from the final label,
     or -1 if no such link.  */
  int m_trailing_out_edge_column;
};

#endif /* GCC_DIAGNOSTIC_LABEL_EFFECTS_H */