CBMC
|
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in them. More...
#include <namespace.h>
Public Member Functions | |
namespacet (const symbol_table_baset &_symbol_table) | |
namespacet (const symbol_table_baset &_symbol_table1, const symbol_table_baset &_symbol_table2) | |
namespacet (const symbol_table_baset *_symbol_table1, const symbol_table_baset *_symbol_table2) | |
bool | lookup (const irep_idt &name, const symbolt *&symbol) const override |
See documentation for namespace_baset::lookup(). More... | |
std::size_t | smallest_unused_suffix (const std::string &prefix) const override |
See documentation for namespace_baset::smallest_unused_suffix(). More... | |
const symbol_table_baset & | get_symbol_table () const |
Return first symbol table registered with the namespace. More... | |
const symbolt & | lookup (const irep_idt &name) const |
Lookup a symbol in the namespace. More... | |
const symbolt & | lookup (const symbol_exprt &) const |
Generic lookup function for a symbol expression in a symbol table. More... | |
const symbolt & | lookup (const tag_typet &) const |
Generic lookup function for a tag type in a symbol table. More... | |
virtual bool | lookup (const irep_idt &name, const symbolt *&symbol) const=0 |
Searches for a symbol named name . More... | |
Public Member Functions inherited from namespace_baset | |
const symbolt & | lookup (const irep_idt &name) const |
Lookup a symbol in the namespace. More... | |
const symbolt & | lookup (const symbol_exprt &) const |
Generic lookup function for a symbol expression in a symbol table. More... | |
const symbolt & | lookup (const tag_typet &) const |
Generic lookup function for a tag type in a symbol table. More... | |
virtual | ~namespace_baset () |
void | follow_macros (exprt &) const |
Follow macros to their values in a given expression. More... | |
const typet & | follow (const typet &) const |
Resolve type symbol to the type it points to. More... | |
const union_typet & | follow_tag (const union_tag_typet &) const |
Follow type tag of union type. More... | |
const struct_typet & | follow_tag (const struct_tag_typet &) const |
Follow type tag of struct type. More... | |
const c_enum_typet & | follow_tag (const c_enum_tag_typet &) const |
Follow type tag of enum type. More... | |
const struct_union_typet & | follow_tag (const struct_or_union_tag_typet &) const |
Resolve a struct_tag_typet or union_tag_typet to the complete version. More... | |
Protected Attributes | |
const symbol_table_baset * | symbol_table1 |
const symbol_table_baset * | symbol_table2 |
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in them.
The basic idea is that you might want to combine a value table and a type table, so that for a variable you can lookup both of these essential properties, in one structure.
Definition at line 93 of file namespace.h.
|
inlineexplicit |
Definition at line 97 of file namespace.h.
|
inline |
Definition at line 100 of file namespace.h.
|
inline |
Definition at line 108 of file namespace.h.
|
inline |
Return first symbol table registered with the namespace.
Definition at line 126 of file namespace.h.
|
inline |
Lookup a symbol in the namespace.
name | The name of the symbol to lookup. |
Definition at line 46 of file namespace.h.
See documentation for namespace_baset::lookup().
Search for a given symbol by name, in the two symbol tables, if present.
Note that namespacet has two symbol tables.
name | The name of the symbol to be looked up. |
symbol | The const pointer to the reference of the symbol if it's found during lookup. |
Implements namespace_baset.
Reimplemented in multi_namespacet.
Definition at line 148 of file namespace.cpp.
virtual bool namespace_baset::lookup |
Searches for a symbol named name
.
Iff found, set symbol
to point to the symbol and return false; else symbol
is unmodified and true
is returned. With multiple symbol tables, symbol_table1
is searched first and then symbol_table2.
const symbolt & namespace_baset::lookup |
Generic lookup function for a symbol expression in a symbol table.
expr | The symbol expression to lookup. |
Definition at line 58 of file namespace.cpp.
const symbolt & namespace_baset::lookup |
Generic lookup function for a tag type in a symbol table.
type | The tag type to lookup. |
Definition at line 59 of file namespace.cpp.
|
overridevirtual |
See documentation for namespace_baset::smallest_unused_suffix().
Find smallest unused suffix in the two symbol tables, assuming they are present.
prefix | The prefix to find smallest unused suffix of. |
Implements namespace_baset.
Reimplemented in multi_namespacet.
Definition at line 130 of file namespace.cpp.
|
protected |
Definition at line 132 of file namespace.h.
|
protected |
Definition at line 132 of file namespace.h.