ESBMC
Efficient SMT-based Context-Bounded Model Checker
Loading...
Searching...
No Matches
symbol_generator Class Reference

#include <symbol_generator.h>

Public Member Functions

 symbol_generator (std::string prefix, unsigned counter=0)
 Construct a new symbol generator where the id of every symbol obtained has the given prefix.
symbolt & new_symbol (contextt &context, const typet &type, const std::string &name_prefix="")
 Creates a new symbol with name, id derived from the name and this->prefix, lvalue=true and the given type being set.
symbolt & new_symbol (contextt &context, const type2tc &type, const std::string &name_prefix="")

Public Attributes

std::string prefix
unsigned counter

Constructor & Destructor Documentation

◆ symbol_generator()

symbol_generator::symbol_generator ( std::string prefix,
unsigned counter = 0 )
inline

Construct a new symbol generator where the id of every symbol obtained has the given prefix.

Parameters
prefixThe id's prefix to give every generated symbol; note: it is not part of the symbol's name.
counterOptional value to initialize the counter with; note: the minimal value appended to a symbol's name and id is counter+1.

Member Function Documentation

◆ new_symbol() [1/2]

symbolt & symbol_generator::new_symbol ( contextt & context,
const type2tc & type,
const std::string & name_prefix = "" )

◆ new_symbol() [2/2]

symbolt & symbol_generator::new_symbol ( contextt & context,
const typet & type,
const std::string & name_prefix = "" )

Creates a new symbol with name, id derived from the name and this->prefix, lvalue=true and the given type being set.

The name of the new symbol is derived from the given name_prefix and this->counter in such a way that the obtained id is unique within the given context. This method cannot fail, but it can run into trouble a) under out-of-memory conditions or b) when all possible symbol ids obtainable through the above pattern are already in use (counter is a 'unsigned int').

Parameters
contextThe context to register this symbol with.
typeThe new symbol's type.
name_prefixOptional parameter defaulting to the empty string; it is not analyzed in any way and used just before appending the decimal value of the counter.
Returns
A reference to the new symbol.

Member Data Documentation

◆ counter

unsigned symbol_generator::counter

◆ prefix

std::string symbol_generator::prefix

The documentation for this class was generated from the following files: