Debian Codegraph @

gcc/doc/libgdiagnostics/topics/diagnostic-manager.rst

raw
1 .. Copyright (C) 2024-2025 Free Software Foundation, Inc.
2 Originally contributed by David Malcolm <[email protected]>
3
4 This is free software: you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful, but
10 WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see
16 <https://www.gnu.org/licenses/>.
17
18 .. default-domain:: c
19
20 Diagnostic Managers
21 ===================
22
23 .. type:: diagnostic_manager;
24
25 A :type:`diagnostic_manager` is an opaque bundle of state for a client of
26 libgdiagnostics.
27
28 It has zero of more "output sinks" to which diagnostics are emitted.
29
30 Responsibilities include:
31
32 * location-management
33
34 * caching of source file content
35
36 * patch generation
37
38 .. function:: diagnostic_manager *diagnostic_manager_new (void)
39
40 Create a new diagnostic_manager.
41 The caller will need to call :func:`diagnostic_release_manager`
42 on it at some point.
43
44 .. note:: No output sinks are created by default; so you will want
45 to create one with something like:
46
47 .. code-block::
48
49 diagnostic_manager_add_text_sink (diag_mgr, stderr,
50 DIAGNOSTIC_COLORIZE_IF_TTY);
51
52 .. function:: void diagnostic_manager_release (diagnostic_manager *diag_mgr)
53
54 Release a diagnostic_manager.
55
56 This will flush output to all of the output sinks, and clean up.
57
58 The parameter must be non-NULL.