CBMC
|
The symbol table. More...
#include <symbol_table.h>
Public Member Functions | |
symbol_tablet () | |
symbol_tablet (const symbol_tablet &other) | |
Copy constructor. More... | |
symbol_tablet & | operator= (const symbol_tablet &other) |
Copy assignment operator. More... | |
symbol_tablet (symbol_tablet &&other) | |
Move constructor. More... | |
symbol_tablet & | operator= (symbol_tablet &&other) |
Move assignment operator. More... | |
void | swap (symbol_tablet &other) |
Swap symbol maps between two symbol tables. More... | |
virtual const symbol_tablet & | get_symbol_table () const override |
virtual symbolt * | get_writeable (const irep_idt &name) override |
Find a symbol in the symbol table for read-write access. More... | |
virtual std::pair< symbolt &, bool > | insert (symbolt symbol) override |
Author: Diffblue Ltd. More... | |
virtual bool | move (symbolt &symbol, symbolt *&new_symbol) override |
Move a symbol into the symbol table. More... | |
virtual void | erase (const symbolst::const_iterator &entry) override |
Remove a symbol from the symbol table. More... | |
virtual void | clear () override |
Wipe internal state of the symbol table. More... | |
virtual iteratort | begin () override |
virtual iteratort | end () override |
void | validate (const validation_modet vm=validation_modet::INVARIANT) const override |
Check that the symbol table is well-formed. More... | |
bool | operator== (const symbol_tablet &other) const |
virtual iteratort | begin ()=0 |
virtual const_iteratort | begin () const |
virtual iteratort | end ()=0 |
virtual const_iteratort | end () const |
Public Member Functions inherited from symbol_table_baset | |
symbol_table_baset (const symbolst &symbols, const symbol_base_mapt &symbol_base_map, const symbol_module_mapt &symbol_module_map) | |
symbol_table_baset (const symbol_table_baset &other)=delete | |
symbol_table_baset & | operator= (const symbol_table_baset &other)=delete |
virtual | ~symbol_table_baset () |
Author: Diffblue Ltd. More... | |
std::size_t | next_unused_suffix (const std::string &prefix, std::size_t start_number) const |
Find smallest unused integer i so that prefix + std::to_string(i) does not exist in the list symbols . More... | |
virtual std::size_t | next_unused_suffix (const std::string &prefix) const |
operator const symbol_tablet & () const | |
Permits implicit cast to const symbol_tablet &. More... | |
bool | has_symbol (const irep_idt &name) const |
Check whether a symbol exists in the symbol table. More... | |
const symbolt * | lookup (const irep_idt &name) const |
Find a symbol in the symbol table for read-only access. More... | |
const symbolt & | lookup_ref (const irep_idt &name) const |
Find a symbol in the symbol table for read-only access. More... | |
std::list< symbolst::const_iterator > | match_name_or_base_name (const irep_idt &id) const |
Collect all symbols the name of which matches id or the base name of which matches id . More... | |
symbolt & | get_writeable_ref (const irep_idt &name) |
Find a symbol in the symbol table for read-write access. More... | |
bool | add (const symbolt &symbol) |
Add a new symbol to the symbol table. More... | |
bool | remove (const irep_idt &name) |
Remove a symbol from the symbol table. More... | |
void | show (std::ostream &out) const |
Print the contents of the symbol table. More... | |
std::vector< irep_idt > | sorted_symbol_names () const |
Build and return a lexicographically sorted vector of symbol names from all symbols stored in this symbol table. More... | |
virtual const_iteratort | begin () const |
virtual const_iteratort | end () const |
Private Attributes | |
symbolst | internal_symbols |
Value referenced by symbol_table_baset::symbols. More... | |
symbol_base_mapt | internal_symbol_base_map |
Value referenced by symbol_table_baset::symbol_base_map. More... | |
symbol_module_mapt | internal_symbol_module_map |
Value referenced by symbol_table_baset::symbol_module_map. More... | |
Additional Inherited Members | |
Public Types inherited from symbol_table_baset | |
typedef std::unordered_map< irep_idt, symbolt > | symbolst |
using | const_iteratort = symbolst::const_iterator |
Public Attributes inherited from symbol_table_baset | |
const symbolst & | symbols |
Read-only field, used to look up symbols given their names. More... | |
const symbol_base_mapt & | symbol_base_map |
Read-only field, used to look up symbol names given their base names. More... | |
const symbol_module_mapt & | symbol_module_map |
Read-only field, used to look up symbol names given their modules. More... | |
The symbol table.
Definition at line 13 of file symbol_table.h.
|
inline |
Definition at line 24 of file symbol_table.h.
|
inline |
Copy constructor.
Definition at line 33 of file symbol_table.h.
|
inline |
Move constructor.
Definition at line 52 of file symbol_table.h.
|
virtual |
Implements symbol_table_baset.
Definition at line 273 of file symbol_table_base.cpp.
|
inlineoverridevirtual |
Implements symbol_table_baset.
Definition at line 108 of file symbol_table.h.
|
virtual |
Implements symbol_table_baset.
|
inlineoverridevirtual |
Wipe internal state of the symbol table.
Implements symbol_table_baset.
Definition at line 101 of file symbol_table.h.
|
virtual |
Implements symbol_table_baset.
Definition at line 274 of file symbol_table_base.cpp.
|
inlineoverridevirtual |
Implements symbol_table_baset.
Definition at line 112 of file symbol_table.h.
|
virtual |
Implements symbol_table_baset.
|
overridevirtual |
Remove a symbol from the symbol table.
entry | an iterator pointing at the symbol to remove |
Implements symbol_table_baset.
Definition at line 90 of file symbol_table.cpp.
|
inlineoverridevirtual |
Implements symbol_table_baset.
Definition at line 82 of file symbol_table.h.
Find a symbol in the symbol table for read-write access.
name | The name of the symbol to look for |
Implements symbol_table_baset.
Definition at line 90 of file symbol_table.h.
Author: Diffblue Ltd.
Move or copy a new symbol to the symbol table.
symbol | The symbol to be added to the symbol table - can be moved or copied in. |
Implements symbol_table_baset.
Definition at line 17 of file symbol_table.cpp.
Move a symbol into the symbol table.
If there is already a symbol with the same name then symbol is unchanged, new_symbol points to the symbol with the same name and true is returned. Otherwise, the symbol is moved into the symbol table, symbol is destroyed, new_symbol points to its new location in the symbol table and false is returned
symbol | The symbol to be added to the symbol table |
new_symbol | Pointer which the function will set to either point to the symbol in the symbol table with the same name or to the symbol that has been successfully moved into the symbol table |
Implements symbol_table_baset.
Definition at line 67 of file symbol_table.cpp.
|
inline |
Copy assignment operator.
Definition at line 45 of file symbol_table.h.
|
inline |
Move assignment operator.
Definition at line 64 of file symbol_table.h.
bool symbol_tablet::operator== | ( | const symbol_tablet & | other | ) | const |
Definition at line 230 of file symbol_table.cpp.
|
inline |
Swap symbol maps between two symbol tables.
other | The second symbol table to swap values with. |
Definition at line 74 of file symbol_table.h.
|
overridevirtual |
Check that the symbol table is well-formed.
Check whether the symbol table is in a valid state.
vm | Determine whether to throw exceptions or trigger INVARIANT when validation fails. |
Implements symbol_table_baset.
Definition at line 130 of file symbol_table.cpp.
|
private |
Value referenced by symbol_table_baset::symbol_base_map.
Definition at line 19 of file symbol_table.h.
|
private |
Value referenced by symbol_table_baset::symbol_module_map.
Definition at line 21 of file symbol_table.h.
|
private |
Value referenced by symbol_table_baset::symbols.
Definition at line 17 of file symbol_table.h.