aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc/libgdiagnostics/topics/diagnostic-manager.rst
blob: d594b260709a1395e6e5f5102abb5fce2191fc8e (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
.. Copyright (C) 2024-2025 Free Software Foundation, Inc.
   Originally contributed by David Malcolm <dmalcolm@redhat.com>

   This 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 of the License, or
   (at your option) any later version.

   This program 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 this program.  If not, see
   <https://www.gnu.org/licenses/>.

.. default-domain:: c

Diagnostic Managers
===================

.. type:: diagnostic_manager;

A :type:`diagnostic_manager` is an opaque bundle of state for a client of
libgdiagnostics.

It has zero of more "output sinks" to which diagnostics are emitted.

Responsibilities include:

* location-management

* caching of source file content

* patch generation

.. function:: diagnostic_manager *diagnostic_manager_new (void)

   Create a new diagnostic_manager.
   The caller will need to call :func:`diagnostic_release_manager`
   on it at some point.

   .. note:: No output sinks are created by default; so you will want
      to create one with something like:

      .. code-block::

	diagnostic_manager_add_text_sink (diag_mgr, stderr,
                                          DIAGNOSTIC_COLORIZE_IF_TTY);

.. function::  void diagnostic_manager_release (diagnostic_manager *diag_mgr)

   Release a diagnostic_manager.

   This will flush output to all of the output sinks, and clean up.

   The parameter must be non-NULL.