Go to the documentation of this file.
10 #ifndef CPROVER_UTIL_IREP_H
11 #define CPROVER_UTIL_IREP_H
62 #define forall_irep(it, irep) \
63 for(irept::subt::const_iterator it=(irep).begin(); \
64 it!=(irep).end(); ++it)
66 #define Forall_irep(it, irep) \
67 for(irept::subt::iterator it=(irep).begin(); \
68 it!=(irep).end(); ++it)
70 #define forall_named_irep(it, irep) \
71 for(irept::named_subt::const_iterator it=(irep).begin(); \
72 it!=(irep).end(); ++it)
74 #define Forall_named_irep(it, irep) \
75 for(irept::named_subt::iterator it=(irep).begin(); \
76 it!=(irep).end(); ++it)
160 typedef std::vector<irept>
subt;
167 typedef std::list<std::pair<irep_namet, irept> >
named_subt;
198 std::cout <<
"COPY " <<
data <<
" " <<
data->ref_count <<
'\n';
210 std::cout <<
"COPY MOVE\n";
219 std::cout <<
"ASSIGN\n";
240 std::cout <<
"ASSIGN MOVE\n";
243 std::swap(
data, irep.data);
287 {
add(name).
id(value); }
300 return !(*
this==other);
324 std::size_t
hash()
const;
329 std::string
pretty(
unsigned indent=0,
unsigned max_indent=0)
const;
333 {
return !name.
empty() && name[0]==
'#'; }
354 mutable std::size_t hash_code;
375 std::swap(d.hash_code, hash_code);
424 const dt &
read()
const
481 #endif // CPROVER_UTIL_IREP_H
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
static bool is_comment(const irep_namet &name)
#define PRECONDITION(CONDITION)
signed int get_int(const irep_namet &name) const
void move_to_sub(irept &irep)
bool operator()(const irept &i1, const irept &i2) const
bool full_eq(const irept &other) const
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
std::map< irep_namet, irept > named_subt
irept & add(const irep_namet &name)
const irept & find(const irep_namet &name) const
static void nonrecursive_destructor(dt *old_data)
Does the same as remove_ref, but using an explicit stack instead of recursion.
long long get_long_long(const irep_namet &name) const
static std::string diagnostics_as_string(const irep_pretty_diagnosticst &irep)
void set(const irep_namet &name, const irept &irep)
irept & operator=(const irept &irep)
bool get_bool(const irep_namet &name) const
void move_to_named_sub(const irep_namet &name, irept &irep)
static void remove_ref(dt *old_data)
irept & operator=(irept &&irep)
std::size_t operator()(const irept &irep) const
const std::string & id2string(const irep_idt &d)
named_subt & get_named_sub()
std::size_t operator()(const irept &irep) const
irep_idt data
This irep_idt is the only place to store data in an irep, other than the mere nesting structure.
void id(const irep_idt &_data)
const named_subt & get_comments() const
bool operator!=(const irept &other) const
const std::string & id_string() const
const irept & get_nil_irep()
const irep_idt & id() const
const named_subt & get_named_sub() const
void remove(const irep_namet &name)
Helper to give us some diagnostic in a usable form on assertion failure.
dstring_hash irep_id_hash
bool operator==(const irept &other) const
irept(const irep_idt &_id)
std::string as_string(const class namespacet &ns, const goto_programt::instructiont &i)
const std::string & get_string(const irep_namet &name) const
bool ordering(const irept &other) const
defines ordering on the internal representation
unsigned int get_unsigned_int(const irep_namet &name) const
std::size_t get_size_t(const irep_namet &name) const
const irep_idt & get(const irep_namet &name) const
void set(const irep_namet &name, const irep_idt &value)
const subt & get_sub() const
const std::string & name2string(const irep_namet &n)
int compare(const irept &i) const
defines ordering on the internal representation
named_subt & get_comments()
Base class for tree-like data structures with sharing.
irep_pretty_diagnosticst(const irept &irep)
bool operator<(const irept &other) const
defines ordering on the internal representation
std::vector< irept > subt
std::size_t full_hash() const