21 return val.find_first_not_of(
'0')==std::string::npos;
27 vm, !expr.
has_operands(),
"constant expression must not have operands");
33 "bitvector constant must have a non-empty value");
40 .find_first_not_of(
"0123456789ABCDEF") == std::string::npos,
41 "negative bitvector constant must use two's complement");
48 "bitvector constant must not have leading zeros");
78 -> decltype(struct_expr.op0())
81 std::is_base_of<struct_exprt, T>::value,
"T must be a struct_exprt.");
85 index < struct_expr.operands().size(),
86 "component matching index should exist");
87 return struct_expr.operands()[index];
119 const typet &compound_type = ns.
follow(member_expr.compound().type());
120 const auto *struct_union_type =
121 type_try_dynamic_cast<struct_union_typet>(compound_type);
124 struct_union_type !=
nullptr,
125 "member must address a struct, union or compatible type");
128 struct_union_type->get_component(member_expr.get_component_name());
133 "member component '" +
id2string(member_expr.get_component_name()) +
134 "' must exist on addressed type");
139 "member expression's type must match the addressed struct or union "
151 let_expr.values().size() == let_expr.variables().size(),
152 "number of variables must match number of values");
155 make_range(let_expr.variables()).zip(let_expr.values()))
160 "let binding symbols must be symbols");
165 "let bindings must be type consistent");
175 std::map<symbol_exprt, exprt> value_map;
177 for(std::size_t i = 0; i <
variables.size(); i++)
185 std::map<irep_idt, exprt> substitutions;
187 for(std::size_t i = 0; i <
variables.size(); i++)
188 substitutions[
variables[i].get_identifier()] = values[i];
193 if(substitute_result.has_value())
194 return substitute_result.value();
201 std::vector<exprt> values;
202 values.reserve(new_variables.size());
203 for(
const auto &new_variable : new_variables)
204 values.push_back(new_variable);
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
exprt instantiate(const exprt::operandst &) const
substitute free occurrences of the variables in where() by the given values
std::vector< symbol_exprt > variablest
const irep_idt & get_value() const
bool value_is_zero_string() const
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
std::vector< exprt > operandst
bool has_operands() const
Return true if there is at least one operand.
typet & type()
Return the type of the expression.
The Boolean constant false.
const irep_idt & id() const
static void validate(const exprt &, validation_modet)
binding_exprt & binding()
static void validate(const exprt &expr, const namespacet &ns, const validation_modet vm=validation_modet::INVARIANT)
Check that the member expression has the right number of operands, refers to a component that exists ...
static void check(const exprt &expr, const validation_modet vm=validation_modet::INVARIANT)
const typet & follow(const typet &) const
Resolve type symbol to the type it points to.
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
exprt & component(const irep_idt &name, const namespacet &ns)
std::size_t component_number(const irep_idt &component_name) const
Return the sequence number of the component with given name.
The Boolean constant true.
The type of an expression, extends irept.
const std::string & id2string(const irep_idt &d)
API to expression classes for Pointers.
bool can_cast_type< pointer_typet >(const typet &type)
Check whether a reference to a typet is a pointer_typet.
Ranges: pair of begin and end iterators, which can be initialized from containers,...
ranget< iteratort > make_range(iteratort begin, iteratort end)
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
#define PRECONDITION(CONDITION)
exprt conjunction(const exprt::operandst &op)
1) generates a conjunction for two or more operands 2) for one operand, returns the operand 3) return...
exprt disjunction(const exprt::operandst &op)
1) generates a disjunction for two or more operands 2) for one operand, returns the operand 3) return...
auto component(T &struct_expr, const irep_idt &name, const namespacet &ns) -> decltype(struct_expr.op0())
API to expression classes.
const let_exprt & to_let_expr(const exprt &expr)
Cast an exprt to a let_exprt.
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.
const member_exprt & to_member_expr(const exprt &expr)
Cast an exprt to a member_exprt.
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
bool can_cast_type< bitvector_typet >(const typet &type)
Check whether a reference to a typet is a bitvector_typet.
optionalt< exprt > substitute_symbols(const std::map< irep_idt, exprt > &substitutions, exprt src)
Substitute free occurrences of the variables given by their identifiers in the keys of the map in the...
#define DATA_CHECK(vm, condition, message)
This macro takes a condition which denotes a well-formedness criterion on goto programs,...