CBMC
|
Basic interface for a namespace. More...
#include <namespace.h>
Public Member Functions | |
const symbolt & | lookup (const irep_idt &name) const |
Lookup a symbol in the namespace. | |
const symbolt & | lookup (const symbol_exprt &) const |
Generic lookup function for a symbol expression in a symbol table. | |
const symbolt & | lookup (const tag_typet &) const |
Generic lookup function for a tag type in a symbol table. | |
virtual | ~namespace_baset () |
void | follow_macros (exprt &) const |
Follow macros to their values in a given expression. | |
const union_typet & | follow_tag (const union_tag_typet &) const |
Follow type tag of union type. | |
const struct_typet & | follow_tag (const struct_tag_typet &) const |
Follow type tag of struct type. | |
const c_enum_typet & | follow_tag (const c_enum_tag_typet &) const |
Follow type tag of enum type. | |
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. | |
virtual std::size_t | smallest_unused_suffix (const std::string &prefix) const =0 |
Returns the minimal integer n such that there is no symbol (in any of the symbol tables) whose name is of the form "An" where A is prefix . | |
virtual bool | lookup (const irep_idt &name, const symbolt *&symbol) const =0 |
Searches for a symbol named name . | |
Basic interface for a namespace.
This is not used in practice, as the one being used is namespacet which uses two symbol tables, and multi_namespacet which can combine more than two.
Definition at line 35 of file namespace.h.
|
virtual |
Definition at line 20 of file namespace.cpp.
Follow macros to their values in a given expression.
expr | The expression to follow macros in. |
Definition at line 93 of file namespace.cpp.
const c_enum_typet & namespace_baset::follow_tag | ( | const c_enum_tag_typet & | src | ) | const |
Follow type tag of enum type.
src | The enum tag type to dispatch on. |
Definition at line 73 of file namespace.cpp.
const struct_union_typet & namespace_baset::follow_tag | ( | const struct_or_union_tag_typet & | src | ) | const |
Resolve a struct_tag_typet
or union_tag_typet
to the complete version.
Definition at line 83 of file namespace.cpp.
const struct_typet & namespace_baset::follow_tag | ( | const struct_tag_typet & | src | ) | const |
Follow type tag of struct type.
src | The struct tag type to dispatch on. |
Definition at line 61 of file namespace.cpp.
const union_typet & namespace_baset::follow_tag | ( | const union_tag_typet & | src | ) | const |
Follow type tag of union type.
src | The union tag type to dispatch on. |
Definition at line 49 of file namespace.cpp.
Lookup a symbol in the namespace.
name | The name of the symbol to lookup. |
Definition at line 45 of file namespace.h.
|
pure virtual |
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.
Implemented in namespacet, multi_namespacet, namespacet, and multi_namespacet.
const symbolt & namespace_baset::lookup | ( | const symbol_exprt & | expr | ) | const |
Generic lookup function for a symbol expression in a symbol table.
expr | The symbol expression to lookup. |
Definition at line 30 of file namespace.cpp.
Generic lookup function for a tag type in a symbol table.
type | The tag type to lookup. |
Definition at line 41 of file namespace.cpp.
|
pure virtual |
Returns the minimal integer n such that there is no symbol (in any of the symbol tables) whose name is of the form "An" where A is prefix
.
The intended use case is finding the next available symbol name for a sequence of auto-generated symbols.
Implemented in namespacet, and multi_namespacet.