CBMC
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{
14private:
21
22public:
30
42
45 {
46 // Copy to temp and then call move assignment
47 return *this=symbol_tablet(other);
48 }
49
61
64 {
65 internal_symbols = std::move(other.internal_symbols);
66 internal_symbol_base_map = std::move(other.internal_symbol_base_map);
67 internal_symbol_module_map = std::move(other.internal_symbol_module_map);
68 return *this;
69 }
70
79
80public:
81 virtual const symbol_tablet &get_symbol_table() const override
82 {
83 return *this;
84 }
85
89 virtual symbolt *get_writeable(const irep_idt &name) override
90 {
91 symbolst::iterator it = internal_symbols.find(name);
92 return it != internal_symbols.end() ? &it->second : nullptr;
93 }
94
95 virtual std::pair<symbolt &, bool> insert(symbolt symbol) override;
96 virtual bool move(symbolt &symbol, symbolt *&new_symbol) override;
97
98 virtual void erase(const symbolst::const_iterator &entry) override;
100 virtual void clear() override
101 {
102 internal_symbols.clear();
105 }
106
107 virtual iteratort begin() override
108 {
109 return iteratort(internal_symbols.begin());
110 }
111 virtual iteratort end() override
112 {
113 return iteratort(internal_symbols.end());
114 }
115
118
120 void validate(
121 const validation_modet vm = validation_modet::INVARIANT) const override;
122
123 bool operator==(const symbol_tablet &other) const;
124};
125
126#endif // CPROVER_UTIL_SYMBOL_TABLE_H
symbol_table_baset(const symbolst &symbols, const symbol_base_mapt &symbol_base_map, const symbol_module_mapt &symbol_module_map)
virtual iteratort begin()=0
std::unordered_map< irep_idt, symbolt > symbolst
virtual iteratort end()=0
The symbol table.
bool operator==(const symbol_tablet &other) const
symbol_tablet & operator=(const symbol_tablet &other)
Copy assignment operator.
symbolst internal_symbols
Value referenced by symbol_table_baset::symbols.
virtual symbolt * get_writeable(const irep_idt &name) override
Find a symbol in the symbol table for read-write access.
virtual void erase(const symbolst::const_iterator &entry) override
Remove a symbol from the symbol table.
virtual iteratort begin() override
symbol_tablet(symbol_tablet &&other)
Move constructor.
symbol_tablet(const symbol_tablet &other)
Copy constructor.
virtual void clear() override
Wipe internal state of the symbol table.
symbol_tablet & operator=(symbol_tablet &&other)
Move assignment operator.
void swap(symbol_tablet &other)
Swap symbol maps between two symbol tables.
virtual const symbol_tablet & get_symbol_table() const override
symbol_module_mapt internal_symbol_module_map
Value referenced by symbol_table_baset::symbol_module_map.
virtual bool move(symbolt &symbol, symbolt *&new_symbol) override
Move a symbol into the symbol table.
symbol_base_mapt internal_symbol_base_map
Value referenced by symbol_table_baset::symbol_base_map.
virtual iteratort end() override
virtual std::pair< symbolt &, bool > insert(symbolt symbol) override
Author: Diffblue Ltd.
void validate(const validation_modet vm=validation_modet::INVARIANT) const override
Check that the symbol table is well-formed.
Symbol table entry.
Definition symbol.h:28
STL namespace.
Author: Diffblue Ltd.
std::multimap< irep_idt, irep_idt > symbol_base_mapt
std::multimap< irep_idt, irep_idt > symbol_module_mapt
validation_modet
dstringt irep_idt