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 label_text
31 get_option_url (diagnostics::option_id option_id) const final override;
32
33protected:
35 : m_lang_mask (lang_mask)
36 {}
37
38 unsigned m_lang_mask;
39};
40
41/* Concrete implementation of diagnostics::option_id_manager for compiler. */
42
45{
46public:
48 unsigned lang_mask,
49 void *opts)
51 m_context (context),
52 m_opts (opts)
53 {
54 }
55
56 int option_enabled_p (diagnostics::option_id option_id) const final override;
57
58 label_text
60 enum diagnostics::kind orig_diag_kind,
61 enum diagnostics::kind diag_kind) const final override;
62
63private:
65 void *m_opts;
66};
67
69{
70public:
72
73 virtual std::unique_ptr<diagnostics::sink::extension>
75
77};
78
79
80extern void
81handle_OPT_fdiagnostics_add_output_ (const gcc_options &opts,
83 const char *arg,
84 location_t loc);
85
86extern void
87handle_OPT_fdiagnostics_set_output_ (const gcc_options &opts,
89 const char *arg,
90 location_t loc);
91
92extern const char *
93get_diagnostic_file_output_basename (const gcc_options &opts);
94
95#endif
void * m_opts
Definition opts-diagnostic.h:65
compiler_diagnostic_option_id_manager(const diagnostics::context &context, unsigned lang_mask, void *opts)
Definition opts-diagnostic.h:47
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:64
label_text get_option_name(diagnostics::option_id option_id, enum diagnostics::kind orig_diag_kind, enum diagnostics::kind diag_kind) const final override
Definition opts.cc:3821
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:34
label_text get_option_url(diagnostics::option_id option_id) const final override
Definition opts.cc:3902
unsigned m_lang_mask
Definition opts-diagnostic.h:38
Definition opts-diagnostic.h:69
static const gcc_extension_factory * singleton
Definition opts-diagnostic.h:76
virtual std::unique_ptr< diagnostics::sink::extension > make_cfg_extension(diagnostics::sink &sink) const =0
virtual ~gcc_extension_factory()
Definition opts-diagnostic.h:71
Definition libgdiagnostics.cc:222
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:158
void handle_OPT_fdiagnostics_add_output_(const gcc_options &opts, diagnostics::context &dc, const char *arg, location_t loc)
Definition opts-diagnostic.cc:143
const char * get_diagnostic_file_output_basename(const gcc_options &opts)
Definition opts-diagnostic.cc:176
Definition option-id.h:32