CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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
14{
15private:
22
23public:
31
43
46 {
47 // Copy to temp and then call move assignment
48 return *this=symbol_tablet(other);
49 }
50
62
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
80
81public:
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 {
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
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
virtual void clear()
Reset the abstract state.
Definition ai.h:265
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition dstring.h:38
The symbol table base class interface.
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