Go to the documentation of this file.
30 std::pair<cachet::iterator, bool> cache_result=
31 cache.insert(std::pair<typet, entryt>(type,
entryt()));
33 entryt &entry=cache_result.first->second;
35 if(!cache_result.second)
42 if(type_id==ID_struct)
48 entry.
members.resize(components.size());
50 for(std::size_t i=0; i<entry.
members.size(); i++)
52 std::size_t sub_width=
operator()(components[i].type());
54 entry.
members[i].width=sub_width;
60 else if(type_id==ID_union)
65 entry.
members.resize(components.size());
67 std::size_t max_width=0;
69 for(std::size_t i=0; i<entry.
members.size(); i++)
71 std::size_t sub_width=
operator()(components[i].type());
72 entry.
members[i].width=sub_width;
73 max_width=std::max(max_width, sub_width);
78 else if(type_id==ID_bool)
80 else if(type_id==ID_c_bool)
84 else if(type_id==ID_signedbv)
88 else if(type_id==ID_unsignedbv)
92 else if(type_id==ID_floatbv)
96 else if(type_id==ID_fixedbv)
100 else if(type_id==ID_bv)
104 else if(type_id==ID_verilog_signedbv ||
105 type_id==ID_verilog_unsignedbv)
110 size > 0,
"verilog bitvector width shall be greater than zero");
113 else if(type_id==ID_range)
126 else if(type_id==ID_array)
131 const auto array_size = numeric_cast<mp_integer>(array_type.
size());
133 if(!array_size.has_value())
147 entry.
total_width = numeric_cast_v<std::size_t>(total);
150 else if(type_id==ID_vector)
155 const auto vector_size = numeric_cast_v<mp_integer>(vector_type.
size());
158 if(total > (1 << 30))
161 entry.
total_width = numeric_cast_v<std::size_t>(vector_size * sub_width);
163 else if(type_id==ID_complex)
166 entry.
total_width = numeric_cast_v<std::size_t>(2 * sub_width);
168 else if(type_id==ID_code)
171 else if(type_id==ID_enumeration)
178 else if(type_id==ID_c_enum)
184 else if(type_id==ID_pointer)
185 entry.
total_width = type_checked_cast<pointer_typet>(type).get_width();
186 else if(type_id==ID_struct_tag)
188 else if(type_id==ID_union_tag)
190 else if(type_id==ID_c_enum_tag)
192 else if(type_id==ID_c_bit_field)
196 else if(type_id==ID_string)
198 else if(type_id != ID_empty)
const c_bool_typet & to_c_bool_type(const typet &type)
Cast a typet to a c_bool_typet.
const componentst & components() const
const union_tag_typet & to_union_tag_type(const typet &type)
Cast a typet to a union_tag_typet.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
const c_enum_tag_typet & to_c_enum_tag_type(const typet &type)
Cast a typet to a c_enum_tag_typet.
const enumeration_typet & to_enumeration_type(const typet &type)
Cast a typet to a enumeration_typet.
const typet & subtype() const
std::size_t operator()(const typet &type) const
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
#define CHECK_RETURN(CONDITION)
The type of an expression, extends irept.
const entryt & get_entry(const typet &type) const
const mp_integer string2integer(const std::string &n, unsigned base)
std::vector< componentt > componentst
const union_typet & follow_tag(const union_tag_typet &) const
Follow type tag of union type.
std::size_t component_number(const irep_idt &component_name) const
Return the sequence number of the component with given name.
const bv_typet & to_bv_type(const typet &type)
Cast a typet to a bv_typet.
const exprt & size() const
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
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.
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
const c_bit_field_typet & to_c_bit_field_type(const typet &type)
Cast a typet to a c_bit_field_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.
const constant_exprt & size() const
boolbv_widtht(const namespacet &_ns)
std::size_t get_width() const
const std::string & get_string(const irep_namet &name) const
const irept::subt & elements() const
Structure type, corresponds to C style structs.
std::vector< membert > members
const signedbv_typet & to_signedbv_type(const typet &type)
Cast a typet to a signedbv_typet.
const array_typet & to_array_type(const typet &type)
Cast a typet to an array_typet.
const floatbv_typet & to_floatbv_type(const typet &type)
Cast a typet to a floatbv_typet.
const vector_typet & to_vector_type(const typet &type)
Cast a typet to a vector_typet.
const union_typet & to_union_type(const typet &type)
Cast a typet to a union_typet.
const membert & get_member(const struct_typet &type, const irep_idt &member) const
const bitvector_typet & to_bitvector_type(const typet &type)
Cast a typet to a bitvector_typet.
Thrown when an unexpected error occurs during the analysis (e.g., when the SAT solver returns an erro...