Debian Codegraph @

kiwi/symbol.h

raw
1 /*-----------------------------------------------------------------------------
2 | Copyright (c) 2013-2026, Nucleic Development Team.
3 |
4 | Distributed under the terms of the Modified BSD License.
5 |
6 | The full license is in the file LICENSE, distributed with this software.
7 |----------------------------------------------------------------------------*/
8 #pragma once
9
10
11 namespace kiwi
12 {
13
14 namespace impl
15 {
16
17 class Symbol
18 {
19
20 public:
21
22 using Id = unsigned long long;
23
24 enum Type
25 {
26 Invalid,
27 External,
28 Slack,
29 Error,
30 Dummy
31 };
32
33 Symbol() : m_id( 0 ), m_type( Invalid ) {}
34
35 Symbol( Type type, Id id ) : m_id( id ), m_type( type ) {}
36
37 ~Symbol() = default;
38
39 Id id() const
40 {
41 return m_id;
42 }
43
44 Type type() const
45 {
46 return m_type;
47 }
48
49 private:
50
51 Id m_id;
52 Type m_type;
53
54 friend bool operator<( const Symbol& lhs, const Symbol& rhs )
55 {
56 return lhs.m_id < rhs.m_id;
57 }
58
59 friend bool operator==( const Symbol& lhs, const Symbol& rhs )
60 {
61 return lhs.m_id == rhs.m_id;
62 }
63
64 };
65
66 } // namespace impl
67
68 } // namespace kiwi