GCC Middle and Back End API Reference
option-id.h
Go to the documentation of this file.
1/* Declaration of struct diagnostics::option_id.
2 Copyright (C) 2024-2025 Free Software Foundation, Inc.
3 Contributed by David Malcolm <dmalcolm@redhat.com>.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 3, or (at your option) any later
10version.
11
12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
20
21#ifndef GCC_DIAGNOSTICS_OPTION_ID_H
22#define GCC_DIAGNOSTICS_OPTION_ID_H
23
24namespace diagnostics {
25
26/* A class to use for the ID of an option that controls
27 a particular diagnostic.
28 This is just a wrapper around "int", but better documents
29 the intent of the code. */
30
32{
33 option_id () : m_idx (0) {}
34
35 option_id (int idx) : m_idx (idx) {}
36 /* Ideally we'd take an enum opt_code here, but we don't
37 want to depend on its decl. */
38
39 bool operator== (option_id other) const
40 {
41 return m_idx == other.m_idx;
42 }
43
44 int m_idx;
45};
46
47} // namespace diagnostics
48
49#endif /* ! GCC_DIAGNOSTICS_OPTION_ID_H */
Definition coretypes.h:167
int m_idx
Definition option-id.h:44
option_id()
Definition option-id.h:33
option_id(int idx)
Definition option-id.h:35
bool operator==(option_id other) const
Definition option-id.h:39