| 1 |
/* A pure C API for replaying SARIF as diagnostics. |
| 2 |
Copyright (C) 2023-2025 Free Software Foundation, Inc. |
| 3 |
|
| 4 |
This file is part of GCC. |
| 5 |
|
| 6 |
GCC is free software; you can redistribute it and/or modify it |
| 7 |
under the terms of the GNU General Public License as published by |
| 8 |
the Free Software Foundation; either version 3, or (at your option) |
| 9 |
any later version. |
| 10 |
|
| 11 |
GCC is distributed in the hope that it will be useful, but |
| 12 |
WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 |
General Public License for more details. |
| 15 |
|
| 16 |
You should have received a copy of the GNU General Public License |
| 17 |
along with GCC; see the file COPYING3. If not see |
| 18 |
<http://www.gnu.org/licenses/>. */ |
| 19 |
|
| 20 |
#ifndef LIBSARIFREPLAY_H |
| 21 |
#define LIBSARIFREPLAY_H |
| 22 |
|
| 23 |
#include "libgdiagnostics.h" |
| 24 |
|
| 25 |
#ifdef __cplusplus |
| 26 |
extern "C" { |
| 27 |
#endif /* __cplusplus */ |
| 28 |
|
| 29 |
struct replay_options |
| 30 |
{ |
| 31 |
bool m_echo_file; |
| 32 |
bool m_json_comments; |
| 33 |
bool m_verbose; |
| 34 |
enum diagnostic_colorize m_diagnostics_colorize; |
| 35 |
}; |
| 36 |
|
| 37 |
/* Attempt to load a .sarif file from SARIF_FILE, and |
| 38 |
replay the diagnostics to OUTPUT_MANAGER. |
| 39 |
Report any problems to CONTROL_MANAGER (such as |
| 40 |
file-not-found, malformed .sarif, etc). |
| 41 |
If ALLOW_JSON_COMMENTS is true, then allow C/C++ style comments |
| 42 |
in the file. |
| 43 |
If ECHO_FILE, then dump the filename and contents to stderr. */ |
| 44 |
|
| 45 |
extern int |
| 46 |
sarif_replay_path (const char *sarif_file, |
| 47 |
diagnostic_manager *output_manager, |
| 48 |
diagnostic_manager *control_manager, |
| 49 |
const replay_options *options) |
| 50 |
LIBGDIAGNOSTICS_PARAM_MUST_BE_NON_NULL (1) |
| 51 |
LIBGDIAGNOSTICS_PARAM_MUST_BE_NON_NULL (2) |
| 52 |
LIBGDIAGNOSTICS_PARAM_MUST_BE_NON_NULL (3) |
| 53 |
LIBGDIAGNOSTICS_PARAM_MUST_BE_NON_NULL (4); |
| 54 |
|
| 55 |
#ifdef __cplusplus |
| 56 |
} |
| 57 |
#endif /* __cplusplus */ |
| 58 |
|
| 59 |
#endif /* LIBSARIFREPLAY_H */ |