GCC Middle and Back End API Reference
opts-diagnostic.h
Go to the documentation of this file.
1/* Command line option handling. Interactions with diagnostics code.
2 Copyright (C) 2010-2026 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_OPTS_DIAGNOSTIC_H
21#define GCC_OPTS_DIAGNOSTIC_H
22
23#include "diagnostics/sink.h"
24
25/* Abstract subclass of diagnostics::option_id_manager for gcc options. */
26
28{
29public:
30 char *make_option_url (diagnostics::option_id option_id) const final override;
31
32protected:
34 : m_lang_mask (lang_mask)
35 {}
36
37 unsigned m_lang_mask;
38};
39
40/* Concrete implementation of diagnostics::option_id_manager for compiler. */
41
44{
45public:
47 unsigned lang_mask,
48 void *opts)
50 m_context (context),
51 m_opts (opts)
52 {
53 }
54
55 int option_enabled_p (diagnostics::option_id option_id) const final override;
56 char *
58 enum diagnostics::kind orig_diag_kind,
59 enum diagnostics::kind diag_kind) const final override;
60
61private:
63 void *m_opts;
64};
65
67{
68public:
70
71 virtual std::unique_ptr<diagnostics::sink::extension>
73
75};
76
77
78extern void
79handle_OPT_fdiagnostics_add_output_ (const gcc_options &opts,
81 const char *arg,
82 location_t loc);
83
84extern void
85handle_OPT_fdiagnostics_set_output_ (const gcc_options &opts,
87 const char *arg,
88 location_t loc);
89#endif
void * m_opts
Definition opts-diagnostic.h:63
compiler_diagnostic_option_id_manager(const diagnostics::context &context, unsigned lang_mask, void *opts)
Definition opts-diagnostic.h:46
int option_enabled_p(diagnostics::option_id option_id) const final override
Definition opts-common.cc:1882
const diagnostics::context & m_context
Definition opts-diagnostic.h:62
char * make_option_name(diagnostics::option_id option_id, enum diagnostics::kind orig_diag_kind, enum diagnostics::kind diag_kind) const final override
Definition opts.cc:3802
Definition diagnostics/context.h:254
Definition option-id-manager.h:29
Definition sink.h:36
gcc_diagnostic_option_id_manager(unsigned lang_mask)
Definition opts-diagnostic.h:33
char * make_option_url(diagnostics::option_id option_id) const final override
Definition opts.cc:3881
unsigned m_lang_mask
Definition opts-diagnostic.h:37
Definition opts-diagnostic.h:67
static const gcc_extension_factory * singleton
Definition opts-diagnostic.h:74
virtual std::unique_ptr< diagnostics::sink::extension > make_cfg_extension(diagnostics::sink &sink) const =0
virtual ~gcc_extension_factory()
Definition opts-diagnostic.h:69
Definition libgdiagnostics.cc:221
kind
Definition kinds.h:27
void handle_OPT_fdiagnostics_set_output_(const gcc_options &opts, diagnostics::context &dc, const char *arg, location_t loc)
Definition opts-diagnostic.cc:160
void handle_OPT_fdiagnostics_add_output_(const gcc_options &opts, diagnostics::context &dc, const char *arg, location_t loc)
Definition opts-diagnostic.cc:145
Definition option-id.h:32