cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
symbol_table.h
Go to the documentation of this file.
1
2
5
6
#ifndef CPROVER_UTIL_SYMBOL_TABLE_H
7
#define CPROVER_UTIL_SYMBOL_TABLE_H
8
9
#include "
symbol_table_base.h
"
10
13
class
symbol_tablet
:
public
symbol_table_baset
14
{
15
private
:
17
symbolst
internal_symbols
;
19
symbol_base_mapt
internal_symbol_base_map
;
21
symbol_module_mapt
internal_symbol_module_map
;
22
23
public
:
24
symbol_tablet
()
25
:
symbol_table_baset
(
26
internal_symbols
,
27
internal_symbol_base_map
,
28
internal_symbol_module_map
)
29
{
30
}
31
33
symbol_tablet
(
const
symbol_tablet
&other)
34
:
symbol_table_baset
(
35
internal_symbols
,
36
internal_symbol_base_map
,
37
internal_symbol_module_map
),
38
internal_symbols
(other.
internal_symbols
),
39
internal_symbol_base_map
(other.
internal_symbol_base_map
),
40
internal_symbol_module_map
(other.
internal_symbol_module_map
)
41
{
42
}
43
45
symbol_tablet
&
operator=
(
const
symbol_tablet
&other)
46
{
47
// Copy to temp and then call move assignment
48
return
*
this
=
symbol_tablet
(other);
49
}
50
52
symbol_tablet
(
symbol_tablet
&&other)
53
:
symbol_table_baset
(
54
internal_symbols
,
55
internal_symbol_base_map
,
56
internal_symbol_module_map
),
57
internal_symbols
(
std
::
move
(other.
internal_symbols
)),
58
internal_symbol_base_map
(
std
::
move
(other.
internal_symbol_base_map
)),
59
internal_symbol_module_map
(
std
::
move
(other.
internal_symbol_module_map
))
60
{
61
}
62
64
symbol_tablet
&
operator=
(
symbol_tablet
&&other)
65
{
66
internal_symbols
= std::move(other.internal_symbols);
67
internal_symbol_base_map
= std::move(other.internal_symbol_base_map);
68
internal_symbol_module_map
= std::move(other.internal_symbol_module_map);
69
return
*
this
;
70
}
71
74
void
swap
(
symbol_tablet
&other)
75
{
76
internal_symbols
.swap(other.
internal_symbols
);
77
internal_symbol_base_map
.swap(other.
internal_symbol_base_map
);
78
internal_symbol_module_map
.swap(other.
internal_symbol_module_map
);
79
}
80
81
public
:
82
virtual
const
symbol_tablet
&
get_symbol_table
()
const override
83
{
84
return
*
this
;
85
}
86
90
virtual
symbolt
*
get_writeable
(
const
irep_idt
&name)
override
91
{
92
symbolst::iterator it =
internal_symbols
.find(name);
93
return
it !=
internal_symbols
.end() ? &it->second :
nullptr
;
94
}
95
96
virtual
std::pair<symbolt &, bool>
insert
(
symbolt
symbol)
override
;
97
virtual
bool
move
(
symbolt
&symbol,
symbolt
*&new_symbol)
override
;
98
99
virtual
void
erase
(
const
symbolst::const_iterator &entry)
override
;
101
virtual
void
clear
()
override
102
{
103
internal_symbols
.clear();
104
internal_symbol_base_map
.clear();
105
internal_symbol_module_map
.clear();
106
}
107
108
virtual
iteratort
begin
()
override
109
{
110
return
iteratort
(
internal_symbols
.begin());
111
}
112
virtual
iteratort
end
()
override
113
{
114
return
iteratort
(
internal_symbols
.end());
115
}
116
117
using
symbol_table_baset::begin
;
118
using
symbol_table_baset::end
;
119
121
void
validate
(
122
const
validation_modet
vm =
validation_modet::INVARIANT
)
const override
;
123
124
bool
operator==
(
const
symbol_tablet
&other)
const
;
125
};
126
127
#endif
// CPROVER_UTIL_SYMBOL_TABLE_H
symbol_table_baset::iteratort
Definition
symbol_table_base.h:183
symbol_table_baset::symbol_table_baset
symbol_table_baset(const symbolst &symbols, const symbol_base_mapt &symbol_base_map, const symbol_module_mapt &symbol_module_map)
Definition
symbol_table_base.h:42
symbol_table_baset::begin
virtual iteratort begin()=0
symbol_table_baset::symbolst
std::unordered_map< irep_idt, symbolt > symbolst
Definition
symbol_table_base.h:25
symbol_table_baset::end
virtual iteratort end()=0
symbol_tablet
The symbol table.
Definition
symbol_table.h:14
symbol_tablet::operator==
bool operator==(const symbol_tablet &other) const
Definition
symbol_table.cpp:230
symbol_tablet::operator=
symbol_tablet & operator=(const symbol_tablet &other)
Copy assignment operator.
Definition
symbol_table.h:45
symbol_tablet::internal_symbols
symbolst internal_symbols
Value referenced by symbol_table_baset::symbols.
Definition
symbol_table.h:17
symbol_tablet::get_writeable
virtual symbolt * get_writeable(const irep_idt &name) override
Find a symbol in the symbol table for read-write access.
Definition
symbol_table.h:90
symbol_tablet::symbol_tablet
symbol_tablet()
Definition
symbol_table.h:24
symbol_tablet::erase
virtual void erase(const symbolst::const_iterator &entry) override
Remove a symbol from the symbol table.
Definition
symbol_table.cpp:90
symbol_tablet::begin
virtual iteratort begin() override
Definition
symbol_table.h:108
symbol_tablet::symbol_tablet
symbol_tablet(symbol_tablet &&other)
Move constructor.
Definition
symbol_table.h:52
symbol_tablet::symbol_tablet
symbol_tablet(const symbol_tablet &other)
Copy constructor.
Definition
symbol_table.h:33
symbol_tablet::clear
virtual void clear() override
Wipe internal state of the symbol table.
Definition
symbol_table.h:101
symbol_tablet::operator=
symbol_tablet & operator=(symbol_tablet &&other)
Move assignment operator.
Definition
symbol_table.h:64
symbol_tablet::swap
void swap(symbol_tablet &other)
Swap symbol maps between two symbol tables.
Definition
symbol_table.h:74
symbol_tablet::get_symbol_table
virtual const symbol_tablet & get_symbol_table() const override
Definition
symbol_table.h:82
symbol_tablet::internal_symbol_module_map
symbol_module_mapt internal_symbol_module_map
Value referenced by symbol_table_baset::symbol_module_map.
Definition
symbol_table.h:21
symbol_tablet::move
virtual bool move(symbolt &symbol, symbolt *&new_symbol) override
Move a symbol into the symbol table.
Definition
symbol_table.cpp:67
symbol_tablet::internal_symbol_base_map
symbol_base_mapt internal_symbol_base_map
Value referenced by symbol_table_baset::symbol_base_map.
Definition
symbol_table.h:19
symbol_tablet::end
virtual iteratort end() override
Definition
symbol_table.h:112
symbol_tablet::insert
virtual std::pair< symbolt &, bool > insert(symbolt symbol) override
Author: Diffblue Ltd.
Definition
symbol_table.cpp:17
symbol_tablet::validate
void validate(const validation_modet vm=validation_modet::INVARIANT) const override
Check that the symbol table is well-formed.
Definition
symbol_table.cpp:130
symbolt
Symbol table entry.
Definition
symbol.h:28
std
STL namespace.
symbol_table_base.h
Author: Diffblue Ltd.
symbol_base_mapt
std::multimap< irep_idt, irep_idt > symbol_base_mapt
Definition
symbol_table_base.h:15
symbol_module_mapt
std::multimap< irep_idt, irep_idt > symbol_module_mapt
Definition
symbol_table_base.h:16
validation_modet
validation_modet
Definition
validation_mode.h:13
validation_modet::INVARIANT
@ INVARIANT
Definition
validation_mode.h:14
irep_idt
dstringt irep_idt
Definition
verification_result.h:16
util
symbol_table.h
Generated by
1.17.0