CBMC
|
The symbol table base class interface. More...
#include <symbol_table_base.h>
Classes | |
class | iteratort |
Public Types | |
typedef std::unordered_map< irep_idt, symbolt > | symbolst |
using | const_iteratort = symbolst::const_iterator |
Public Member Functions | |
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... | |
virtual const symbol_tablet & | get_symbol_table () const =0 |
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... | |
virtual symbolt * | get_writeable (const irep_idt &name)=0 |
Find a symbol in the symbol table for read-write access. 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... | |
virtual std::pair< symbolt &, bool > | insert (symbolt symbol)=0 |
Move or copy a new symbol to the symbol table. More... | |
virtual bool | move (symbolt &symbol, symbolt *&new_symbol)=0 |
bool | remove (const irep_idt &name) |
Remove a symbol from the symbol table. More... | |
virtual void | erase (const symbolst::const_iterator &entry)=0 |
Remove a symbol from the symbol table. More... | |
virtual void | clear ()=0 |
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 iteratort | begin ()=0 |
virtual iteratort | end ()=0 |
virtual const_iteratort | begin () const |
virtual const_iteratort | end () const |
virtual void | validate (const validation_modet vm=validation_modet::INVARIANT) const =0 |
Public Attributes | |
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 base class interface.
Definition at line 22 of file symbol_table_base.h.
using symbol_table_baset::const_iteratort = symbolst::const_iterator |
Definition at line 271 of file symbol_table_base.h.
typedef std::unordered_map<irep_idt, symbolt> symbol_table_baset::symbolst |
Definition at line 25 of file symbol_table_base.h.
|
inline |
Definition at line 42 of file symbol_table_base.h.
|
delete |
|
virtual |
bool symbol_table_baset::add | ( | const symbolt & | symbol | ) |
Add a new symbol to the symbol table.
symbol | The symbol to be added to the symbol table |
Definition at line 18 of file symbol_table_base.cpp.
|
virtual |
Definition at line 68 of file symbol_table_base.cpp.
|
pure virtual |
|
pure virtual |
Implemented in symbol_table_buildert, symbol_tablet, and journalling_symbol_tablet.
|
virtual |
Definition at line 63 of file symbol_table_base.cpp.
|
pure virtual |
|
pure virtual |
Remove a symbol from the symbol table.
entry | an iterator pointing at the symbol to remove |
Implemented in symbol_table_buildert, symbol_tablet, and journalling_symbol_tablet.
|
pure virtual |
Implemented in symbol_table_buildert, symbol_tablet, and journalling_symbol_tablet.
Find a symbol in the symbol table for read-write access.
name | The name of the symbol to look for |
Implemented in symbol_tablet, symbol_table_buildert, and journalling_symbol_tablet.
Find a symbol in the symbol table for read-write access.
name | The name of the symbol to look for. |
<tt>std::out_of_range</tt> | if no such symbol exists |
Definition at line 149 of file symbol_table_base.h.
|
inline |
Check whether a symbol exists in the symbol table.
name | The name of the symbol to look for |
Definition at line 88 of file symbol_table_base.h.
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. |
Implemented in symbol_table_buildert, symbol_tablet, and journalling_symbol_tablet.
Find a symbol in the symbol table for read-only access.
name | The name of the symbol to look for |
Definition at line 96 of file symbol_table_base.h.
Find a symbol in the symbol table for read-only access.
name | The name of the symbol to look for |
Definition at line 105 of file symbol_table_base.h.
|
inline |
Collect all symbols the name of which matches id
or the base name of which matches id
.
Definition at line 116 of file symbol_table_base.h.
Implemented in symbol_table_buildert, symbol_tablet, and journalling_symbol_tablet.
|
inlinevirtual |
Reimplemented in symbol_table_buildert, and journalling_symbol_tablet.
Definition at line 73 of file symbol_table_base.h.
|
inline |
Find smallest unused integer i so that prefix + std::to_string(i) does not exist in the list symbols
.
prefix | A string denoting the prefix we want to find the smallest suffix of. |
start_number | The starting suffix number to search from. |
Definition at line 64 of file symbol_table_base.h.
|
inline |
Permits implicit cast to const symbol_tablet &.
Definition at line 79 of file symbol_table_base.h.
|
delete |
bool symbol_table_baset::remove | ( | const irep_idt & | name | ) |
Remove a symbol from the symbol table.
name | The name of the symbol to remove |
Definition at line 27 of file symbol_table_base.cpp.
void symbol_table_baset::show | ( | std::ostream & | out | ) | const |
Print the contents of the symbol table.
out | The ostream to direct output to. |
Definition at line 54 of file symbol_table_base.cpp.
std::vector< irep_idt > symbol_table_baset::sorted_symbol_names | ( | ) | const |
Build and return a lexicographically sorted vector of symbol names from all symbols stored in this symbol table.
Definition at line 36 of file symbol_table_base.cpp.
|
pure virtual |
Implemented in symbol_table_buildert, symbol_tablet, and journalling_symbol_tablet.
const symbol_base_mapt& symbol_table_baset::symbol_base_map |
Read-only field, used to look up symbol names given their base names.
See symbols.
Definition at line 34 of file symbol_table_base.h.
const symbol_module_mapt& symbol_table_baset::symbol_module_map |
Read-only field, used to look up symbol names given their modules.
See symbols. Note that symbols whose module is empty are not recorded in this map. Currently only used in EBMC.
Definition at line 39 of file symbol_table_base.h.
const symbolst& symbol_table_baset::symbols |
Read-only field, used to look up symbols given their names.
Typically a subclass will have its own corresponding writeable field, and the read-only fields declared here function as "getters" for them.
Definition at line 31 of file symbol_table_base.h.