| 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 |
SARIF support |
| 21 |
============= |
| 22 |
|
| 23 |
`SARIF <https://www.sarif.info/>`_ is a machine-readable format, originally |
| 24 |
designed for the output of static analysis tools, but which can be used |
| 25 |
for diagnostics in general. |
| 26 |
|
| 27 |
.. function:: void diagnostic_manager_add_sarif_sink (diagnostic_manager *diag_mgr, \ |
| 28 |
FILE *dst_stream, \ |
| 29 |
const diagnostic_file *main_input_file, \ |
| 30 |
enum diagnostic_sarif_version version) |
| 31 |
|
| 32 |
Add a new output sink to ``diag_mgr``, which writes SARIF of the given |
| 33 |
version to ``dst_stream``. |
| 34 |
|
| 35 |
The output is not written until ``diag_mgr`` is released. |
| 36 |
|
| 37 |
``dst_stream`` is borrowed, and must outlive ``diag_mgr``. |
| 38 |
|
| 39 |
For the result to be a valid SARIF file according to the schema, |
| 40 |
``diag_mgr`` must have had :func:`diagnostic_manager_set_tool_name` |
| 41 |
called on it. |
| 42 |
|
| 43 |
``diag_mgr``, ``dst_stream``, and ``main_input_file`` must all be non-NULL. |
| 44 |
|
| 45 |
.. enum:: diagnostic_sarif_version |
| 46 |
|
| 47 |
An enum for choosing the SARIF version for a SARIF output sink. |
| 48 |
|
| 49 |
.. macro:: DIAGNOSTIC_SARIF_VERSION_2_1_0 |
| 50 |
|
| 51 |
.. macro:: DIAGNOSTIC_SARIF_VERSION_2_2_PRERELEASE |