GCC Middle and Back End API Reference
counters.h
Go to the documentation of this file.
1/* Counts of per-kind diagnostics.
2 Copyright (C) 2000-2025 Free Software Foundation, Inc.
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_DIAGNOSTICS_COUNTERS_H
21#define GCC_DIAGNOSTICS_COUNTERS_H
22
23#include "diagnostics/kinds.h"
24
25namespace diagnostics {
26
27/* A collection of counters of diagnostics, per-kind
28 (e.g. "3 errors and 1 warning"), for use by both diagnostics::context
29 and by diagnostics::buffer. */
30
32{
33 counters ();
34
35 void dump (FILE *out, int indent) const;
36 void DEBUG_FUNCTION dump () const { dump (stderr, 0); }
37
38 int get_count (enum kind kind) const
39 {
40 return m_count_for_kind[static_cast<size_t> (kind)];
41 }
42
43 void move_to (counters &dest);
44 void clear ();
45
46 int m_count_for_kind[static_cast<size_t> (kind::last_diagnostic_kind)];
47};
48
49} // namespace diagnostics
50
51#endif /* ! GCC_DIAGNOSTICS_COUNTERS_H */
Definition coretypes.h:167
kind
Definition kinds.h:27
@ last_diagnostic_kind
Definition kinds.h:31
Definition counters.h:32
void DEBUG_FUNCTION dump() const
Definition counters.h:36
void move_to(counters &dest)
Definition diagnostics/context.cc:1948
int get_count(enum kind kind) const
Definition counters.h:38
counters()
Definition diagnostics/context.cc:1924
int m_count_for_kind[static_cast< size_t >(kind::last_diagnostic_kind)]
Definition counters.h:46
void clear()
Definition diagnostics/context.cc:1956
#define DEBUG_FUNCTION
Definition system.h:1236