30 if(type.
id() == ID_unsignedbv)
32 result.
name =
"integer";
35 else if(type.
id() == ID_signedbv)
37 result.
name =
"integer";
40 else if(type.
id() == ID_floatbv)
42 result.
name =
"float";
45 else if(type.
id() == ID_bv)
47 result.
name =
"integer";
50 else if(type.
id() == ID_c_bit_field)
52 result.
name =
"integer";
55 else if(type.
id() == ID_c_enum_tag)
60 else if(type.
id() == ID_fixedbv)
62 result.
name =
"fixed";
65 else if(type.
id() == ID_pointer)
67 result.
name =
"pointer";
71 else if(type.
id() == ID_bool)
73 result.
name =
"boolean";
75 else if(type.
id() == ID_array)
77 result.
name =
"array";
83 else if(type.
id() == ID_vector)
85 result.
name =
"vector";
91 else if(type.
id() == ID_struct)
93 result.
name =
"struct";
103 else if(type.
id() == ID_struct_tag)
107 else if(type.
id() == ID_union)
109 result.
name =
"union";
119 else if(type.
id() == ID_union_tag)
124 result.
name =
"unknown";
136 const auto &value = constant_expr.get_value();
141 type.
id() == ID_unsignedbv || type.
id() == ID_signedbv ||
142 type.
id() == ID_c_bit_field || type.
id() == ID_c_bool)
144 mp_integer i = numeric_cast_v<mp_integer>(constant_expr);
147 result.
name =
"integer";
151 const typet &underlying_type =
152 type.
id() == ID_c_bit_field
156 bool is_signed = underlying_type.
id() == ID_signedbv;
158 std::string sig =
is_signed ?
"" :
"unsigned ";
160 if(type.
id() == ID_c_bool)
175 else if(type.
id() == ID_c_enum)
180 const auto integer_value =
bvrep2integer(value, width,
false);
181 result.
name =
"integer";
188 else if(type.
id() == ID_c_enum_tag)
194 else if(type.
id() == ID_bv)
196 result.
name =
"bitvector";
197 result.
set_attribute(
"binary", constant_expr.get_string(ID_value));
199 else if(type.
id() == ID_fixedbv)
202 result.
name =
"fixed";
208 else if(type.
id() == ID_floatbv)
211 result.
name =
"float";
217 else if(type.
id() == ID_pointer)
220 result.
name =
"pointer";
223 if(constant_expr.is_null_pointer())
224 result.
data =
"NULL";
226 else if(type.
id() == ID_bool)
228 result.
name =
"boolean";
229 result.
set_attribute(
"binary", constant_expr.is_true() ?
"1" :
"0");
230 result.
data = constant_expr.is_true() ?
"TRUE" :
"FALSE";
234 result.
name =
"unknown";
237 else if(expr.
id() == ID_array)
239 result.
name =
"array";
243 for(
const auto &op : expr.
operands())
251 else if(expr.
id() == ID_struct)
253 result.
name =
"struct";
256 expr.
type().
id() == ID_struct_tag
262 for(
unsigned m = 0; m < expr.
operands().size(); m++)
269 else if(expr.
id() == ID_union)
272 result.
name =
"union";
279 result.
name =
"unknown";
const floatbv_typet & to_floatbv_type(const typet &type)
Cast a typet to a floatbv_typet.
const signedbv_typet & to_signedbv_type(const typet &type)
Cast a typet to a signedbv_typet.
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.
const unsignedbv_typet & to_unsignedbv_type(const typet &type)
Cast a typet to an unsignedbv_typet.
const bv_typet & to_bv_type(const typet &type)
Cast a typet to a bv_typet.
const c_enum_typet & to_c_enum_type(const typet &type)
Cast a typet to a c_enum_typet.
const union_tag_typet & to_union_tag_type(const typet &type)
Cast a typet to a union_tag_typet.
const c_bit_field_typet & to_c_bit_field_type(const typet &type)
Cast a typet to a c_bit_field_typet.
const union_typet & to_union_type(const typet &type)
Cast a typet to a union_typet.
const c_enum_tag_typet & to_c_enum_tag_type(const typet &type)
Cast a typet to a c_enum_tag_typet.
std::size_t get_width() const
const typet & underlying_type() const
struct configt::ansi_ct ansi_c
A constant literal expression.
Base class for all expressions.
typet & type()
Return the type of the expression.
bool is_constant() const
Return whether the expression is a constant.
std::string to_ansi_c_string() const
std::string to_ansi_c_string() const
const irep_idt & id() const
const union_typet & follow_tag(const union_tag_typet &) const
Follow type tag of union type.
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Structure type, corresponds to C style structs.
const componentst & components() const
std::vector< componentt > componentst
The type of an expression, extends irept.
Union constructor from single element.
irep_idt get_component_name() const
void set_attribute(const std::string &attribute, unsigned value)
xmlt & new_element(const std::string &key)
const std::string & id2string(const irep_idt &d)
const std::string integer2string(const mp_integer &n, unsigned base)
const std::string integer2binary(const mp_integer &n, std::size_t width)
API to expression classes for Pointers.
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
#define PRECONDITION(CONDITION)
auto component(T &struct_expr, const irep_idt &name, const namespacet &ns) -> decltype(struct_expr.op0())
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.
const union_exprt & to_union_expr(const exprt &expr)
Cast an exprt to a union_exprt.
const vector_typet & to_vector_type(const typet &type)
Cast a typet to a vector_typet.
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
const array_typet & to_array_type(const typet &type)
Cast a typet to an array_typet.
const struct_tag_typet & to_struct_tag_type(const typet &type)
Cast a typet to a struct_tag_typet.
std::size_t long_long_int_width
std::size_t long_int_width
std::size_t short_int_width
bool is_signed(const typet &t)
Convenience function – is the type signed?
xmlt xml(const typet &type, const namespacet &ns)