Go to the documentation of this file.
31 if(type.
id() == ID_unsignedbv)
33 result.
name =
"integer";
36 else if(type.
id() == ID_signedbv)
38 result.
name =
"integer";
41 else if(type.
id() == ID_floatbv)
43 result.
name =
"float";
46 else if(type.
id() == ID_bv)
48 result.
name =
"integer";
51 else if(type.
id() == ID_c_bit_field)
53 result.
name =
"integer";
56 else if(type.
id() == ID_c_enum_tag)
61 else if(type.
id() == ID_fixedbv)
63 result.
name =
"fixed";
66 else if(type.
id() == ID_pointer)
68 result.
name =
"pointer";
72 else if(type.
id() == ID_bool)
74 result.
name =
"boolean";
76 else if(type.
id() == ID_array)
78 result.
name =
"array";
84 else if(type.
id() == ID_vector)
86 result.
name =
"vector";
92 else if(type.
id() == ID_struct)
94 result.
name =
"struct";
104 else if(type.
id() == ID_struct_tag)
108 else if(type.
id() == ID_union)
110 result.
name =
"union";
120 else if(type.
id() == ID_union_tag)
125 result.
name =
"unknown";
134 if(expr.
id() == ID_constant)
137 const auto &value = constant_expr.get_value();
142 type.
id() == ID_unsignedbv || type.
id() == ID_signedbv ||
143 type.
id() == ID_c_bit_field || type.
id() == ID_c_bool)
145 mp_integer i = numeric_cast_v<mp_integer>(constant_expr);
148 result.
name =
"integer";
152 const typet &underlying_type =
153 type.
id() == ID_c_bit_field
157 bool is_signed = underlying_type.
id() == ID_signedbv;
159 std::string sig =
is_signed ?
"" :
"unsigned ";
161 if(type.
id() == ID_c_bool)
176 else if(type.
id() == ID_c_enum)
181 const auto integer_value =
bvrep2integer(value, width,
false);
182 result.
name =
"integer";
189 else if(type.
id() == ID_c_enum_tag)
195 else if(type.
id() == ID_bv)
197 result.
name =
"bitvector";
198 result.
set_attribute(
"binary", constant_expr.get_string(ID_value));
200 else if(type.
id() == ID_fixedbv)
203 result.
name =
"fixed";
209 else if(type.
id() == ID_floatbv)
212 result.
name =
"float";
218 else if(type.
id() == ID_pointer)
221 result.
name =
"pointer";
225 result.
data =
"NULL";
227 else if(type.
id() == ID_bool)
229 result.
name =
"boolean";
230 result.
set_attribute(
"binary", constant_expr.is_true() ?
"1" :
"0");
231 result.
data = constant_expr.is_true() ?
"TRUE" :
"FALSE";
235 result.
name =
"unknown";
238 else if(expr.
id() == ID_array)
240 result.
name =
"array";
252 else if(expr.
id() == ID_struct)
254 result.
name =
"struct";
259 if(type.
id() == ID_struct)
265 for(
unsigned m = 0; m < expr.
operands().size(); m++)
273 else if(expr.
id() == ID_union)
276 result.
name =
"union";
283 result.
name =
"unknown";
const union_tag_typet & to_union_tag_type(const typet &type)
Cast a typet to a union_tag_typet.
const componentst & components() const
const union_typet & to_union_type(const typet &type)
Cast a typet to a union_typet.
const unsignedbv_typet & to_unsignedbv_type(const typet &type)
Cast a typet to an unsignedbv_typet.
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
The type of an expression, extends irept.
const floatbv_typet & to_floatbv_type(const typet &type)
Cast a typet to a floatbv_typet.
std::string to_ansi_c_string() const
bool is_signed(const typet &t)
Convenience function – is the type signed?
const c_enum_typet & to_c_enum_type(const typet &type)
Cast a typet to a c_enum_typet.
Union constructor from single element.
Base class for all expressions.
std::vector< componentt > componentst
const bv_typet & to_bv_type(const typet &type)
Cast a typet to a bv_typet.
const union_exprt & to_union_expr(const exprt &expr)
Cast an exprt to a union_exprt.
const union_typet & follow_tag(const union_tag_typet &) const
Follow type tag of union type.
auto component(T &struct_expr, const irep_idt &name, const namespacet &ns) -> decltype(struct_expr.op0())
struct configt::ansi_ct ansi_c
const bitvector_typet & to_bitvector_type(const typet &type)
Cast a typet to a bitvector_typet.
const fixedbv_typet & to_fixedbv_type(const typet &type)
Cast a typet to a fixedbv_typet.
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
typet & type()
Return the type of the expression.
const std::string & id2string(const irep_idt &d)
std::string to_ansi_c_string() const
const c_enum_tag_typet & to_c_enum_tag_type(const typet &type)
Cast a typet to a c_enum_tag_typet.
#define forall_operands(it, expr)
#define PRECONDITION(CONDITION)
std::size_t long_long_int_width
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
const irep_idt & id() const
const struct_tag_typet & to_struct_tag_type(const typet &type)
Cast a typet to a struct_tag_typet.
xmlt xml(const typet &type, const namespacet &ns)
const typet & underlying_type() const
const signedbv_typet & to_signedbv_type(const typet &type)
Cast a typet to a signedbv_typet.
std::size_t get_width() const
irep_idt get_component_name() const
const c_bit_field_typet & to_c_bit_field_type(const typet &type)
Cast a typet to a c_bit_field_typet.
Deprecated expression utility functions.
Structure type, corresponds to C style structs.
const typet & follow(const typet &) const
Resolve type symbol to the type it points to.
void set_attribute(const std::string &attribute, unsigned value)
const array_typet & to_array_type(const typet &type)
Cast a typet to an array_typet.
std::size_t short_int_width
const vector_typet & to_vector_type(const typet &type)
Cast a typet to a vector_typet.
bool is_null_pointer(const constant_exprt &expr)
Returns true if expr has a pointer type and a value NULL; it also returns true when expr has value ze...
const std::string integer2binary(const mp_integer &n, std::size_t width)
A constant literal expression.
std::size_t long_int_width
xmlt & new_element(const std::string &key)
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.
const std::string integer2string(const mp_integer &n, unsigned base)