26 const exprt &new_expr)
30 "types to be replaced should match. old type:\n" +
50 s.
type() == it->second.type(),
51 "types to be replaced should match. s.type:\n" + s.
type().
pretty() +
52 "\nit->second.type:\n" + it->second.type().pretty());
54 static_cast<exprt &
>(s) = it->second;
69 const exprt &const_dest(dest);
79 if(dest.
id()==ID_member)
86 else if(dest.
id()==ID_index)
96 else if(dest.
id()==ID_address_of)
103 else if(dest.
id()==ID_symbol)
108 else if(dest.
id() == ID_let)
113 for(
auto &op : let_expr.values())
119 for(
auto &variable : let_expr.variables())
120 bindings.insert(variable.identifier());
129 dest.
id() == ID_array_comprehension || dest.
id() == ID_exists ||
130 dest.
id() == ID_forall || dest.
id() == ID_lambda)
135 for(
auto &binding : binding_expr.variables())
136 bindings.insert(binding.identifier());
138 if(!
replace(binding_expr.where()))
150 const typet &c_sizeof_type =
151 static_cast<const typet&
>(dest.
find(ID_C_c_sizeof_type));
155 const typet &va_arg_type =
156 static_cast<const typet&
>(dest.
find(ID_C_va_arg_type));
175 if(dest.
id()==ID_symbol)
184 for(
const auto &op : dest.
operands())
190 const irept &c_sizeof_type=dest.
find(ID_C_c_sizeof_type);
196 const irept &va_arg_type=dest.
find(ID_C_va_arg_type);
222 if(dest.
id()==ID_struct ||
231 else if(dest.
id()==ID_code)
241 const exprt &spec_assigns =
242 static_cast<const exprt &
>(dest.
find(ID_C_spec_assigns));
246 const exprt &spec_frees =
247 static_cast<const exprt &
>(dest.
find(ID_C_spec_frees));
251 const exprt &spec_ensures =
252 static_cast<const exprt &
>(dest.
find(ID_C_spec_ensures));
256 const exprt &spec_requires =
257 static_cast<const exprt &
>(dest.
find(ID_C_spec_requires));
261 else if(dest.
id()==ID_array)
286 if(dest.
id()==ID_struct ||
292 for(
const auto &c : struct_union_type.
components())
296 else if(dest.
id()==ID_code)
306 const exprt &spec_assigns =
307 static_cast<const exprt &
>(dest.
find(ID_C_spec_assigns));
311 const exprt &spec_ensures =
312 static_cast<const exprt &
>(dest.
find(ID_C_spec_ensures));
316 const exprt &spec_requires =
317 static_cast<const exprt &
>(dest.
find(ID_C_spec_requires));
321 else if(dest.
id()==ID_array)
329 const exprt &new_expr)
342 static_cast<exprt &
>(s) = it->second;
353 const exprt &const_dest(dest);
372 if(dest.
id() == ID_index)
384 else if(dest.
id() == ID_address_of)
400 const typet &c_sizeof_type =
401 static_cast<const typet &
>(dest.
find(ID_C_c_sizeof_type));
404 static_cast<typet &
>(dest.
add(ID_C_c_sizeof_type)));
406 const typet &va_arg_type =
407 static_cast<const typet &
>(dest.
find(ID_C_va_arg_type));
410 static_cast<typet &
>(dest.
add(ID_C_va_arg_type)));
bool replace_symbol_expr(symbol_exprt &dest) const override
bool replace(exprt &dest) const override
Operator to return the address of an object.
const exprt & size() const
const parameterst & parameters() const
const typet & return_type() const
Base class for all expressions.
typet & type()
Return the type of the expression.
const source_locationt & source_location() const
source_locationt & add_source_location()
There are a large number of kinds of tree structured or tree-like data in CPROVER.
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
const irept & find(const irep_idt &name) const
const irep_idt & id() const
irept & add(const irep_idt &name)
Extract member of struct or union.
const exprt & struct_op() const
virtual bool replace(exprt &dest) const
bool have_to_replace(const exprt &dest) const
void set(const class symbol_exprt &old_expr, const exprt &new_expr)
Sets old_expr to be replaced by new_expr.
std::set< irep_idt > bindings
virtual ~replace_symbolt()
virtual bool replace_symbol_expr(symbol_exprt &dest) const
void insert(const class symbol_exprt &old_expr, const exprt &new_expr)
Sets old_expr to be replaced by new_expr if we don't already have a replacement; otherwise does nothi...
bool replaces_symbol(const irep_idt &id) const
Base type for structs and unions.
const componentst & components() const
Expression to hold a symbol (variable).
void identifier(const irep_idt &identifier)
The type of an expression, extends irept.
bool replace_symbol_expr(symbol_exprt &dest) const override
void insert(const symbol_exprt &old_expr, const exprt &new_expr)
#define Forall_operands(it, expr)
bool is_assignable(const exprt &expr)
Returns true iff the argument is one of the following:
Deprecated expression utility functions.
API to expression classes for Pointers.
const address_of_exprt & to_address_of_expr(const exprt &expr)
Cast an exprt to an address_of_exprt.
#define PRECONDITION_WITH_DIAGNOSTICS(CONDITION,...)
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
#define PRECONDITION(CONDITION)
API to expression classes.
const index_exprt & to_index_expr(const exprt &expr)
Cast an exprt to an index_exprt.
const let_exprt & to_let_expr(const exprt &expr)
Cast an exprt to a let_exprt.
const member_exprt & to_member_expr(const exprt &expr)
Cast an exprt to a member_exprt.
const binding_exprt & to_binding_expr(const exprt &expr)
Cast an exprt to a binding_exprt.
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
const array_typet & to_array_type(const typet &type)
Cast a typet to an array_typet.
const struct_union_typet & to_struct_union_type(const typet &type)
Cast a typet to a struct_union_typet.
const type_with_subtypest & to_type_with_subtypes(const typet &type)
const type_with_subtypet & to_type_with_subtype(const typet &type)