27 std::pair<cachet::iterator, bool> cache_result=
28 cache.insert(std::pair<typet, entryt>(type,
entryt()));
30 entryt &entry=cache_result.first->second;
32 if(!cache_result.second)
39 if(type_id==ID_struct)
45 entry.
members.resize(components.size());
47 for(std::size_t i=0; i<entry.
members.size(); i++)
49 std::size_t sub_width=
operator()(components[i].type());
51 entry.
members[i].width=sub_width;
57 else if(type_id==ID_union)
62 entry.
members.resize(components.size());
64 std::size_t max_width=0;
66 for(std::size_t i=0; i<entry.
members.size(); i++)
68 std::size_t sub_width=
operator()(components[i].type());
69 entry.
members[i].width=sub_width;
70 max_width=std::max(max_width, sub_width);
75 else if(type_id==ID_bool)
77 else if(type_id==ID_c_bool)
81 else if(type_id==ID_signedbv)
85 else if(type_id==ID_unsignedbv)
89 else if(type_id==ID_floatbv)
93 else if(type_id==ID_fixedbv)
97 else if(type_id==ID_bv)
101 else if(type_id==ID_verilog_signedbv ||
102 type_id==ID_verilog_unsignedbv)
107 size > 0,
"verilog bitvector width shall be greater than zero");
110 else if(type_id==ID_range)
123 else if(type_id==ID_array)
128 const auto array_size = numeric_cast<mp_integer>(array_type.
size());
130 if(!array_size.has_value())
143 entry.
total_width = numeric_cast_v<std::size_t>(total);
146 else if(type_id==ID_vector)
151 const auto vector_size = numeric_cast_v<mp_integer>(vector_type.
size());
154 if(total > (1 << 30))
159 entry.
total_width = numeric_cast_v<std::size_t>(vector_size * sub_width);
161 else if(type_id==ID_complex)
164 entry.
total_width = numeric_cast_v<std::size_t>(2 * sub_width);
166 else if(type_id==ID_code)
169 else if(type_id==ID_enumeration)
176 else if(type_id==ID_c_enum)
183 else if(type_id==ID_pointer)
184 entry.
total_width = type_checked_cast<pointer_typet>(type).get_width();
185 else if(type_id==ID_struct_tag)
187 else if(type_id==ID_union_tag)
189 else if(type_id==ID_c_enum_tag)
191 else if(type_id==ID_c_bit_field)
195 else if(type_id==ID_string)
197 else if(type_id != ID_empty)
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.
const c_bool_typet & to_c_bool_type(const typet &type)
Cast a typet to a c_bool_typet.
Thrown when an unexpected error occurs during the analysis (e.g., when the SAT solver returns an erro...
const typet & element_type() const
The type of the elements of the array.
const exprt & size() const
std::size_t get_width() const
boolbv_widtht(const namespacet &_ns)
const entryt & get_entry(const typet &type) const
virtual std::size_t operator()(const typet &type) const
const membert & get_member(const struct_typet &type, const irep_idt &member) const
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
const irept::subt & elements() const
const irep_idt & id() const
const std::string & get_string(const irep_idt &name) 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::size_t component_number(const irep_idt &component_name) const
Return the sequence number of the component with given name.
std::vector< componentt > componentst
The type of an expression, extends irept.
const constant_exprt & size() const
const typet & element_type() const
The type of the elements of the vector.
const mp_integer string2integer(const std::string &n, unsigned base)
#define CHECK_RETURN(CONDITION)
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
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 complex_typet & to_complex_type(const typet &type)
Cast a typet to a complex_typet.
const struct_tag_typet & to_struct_tag_type(const typet &type)
Cast a typet to a struct_tag_typet.
const enumeration_typet & to_enumeration_type(const typet &type)
Cast a typet to a enumeration_typet.
std::vector< membert > members