26 for(
const auto &symbol_pair : symbol_table.
symbols)
28 if(symbol_pair.second.is_type && symbol_pair.second.type.id() == ID_struct)
33 bool first_time_seen_in_struct =
true;
35 for(struct_typet::componentst::const_iterator it_mem = components.begin();
36 it_mem != components.end();
40 bool first_time_seen_from =
true;
45 if(it_mem->get_is_padding())
49 for(struct_typet::componentst::const_iterator it_next = it_mem;
50 it_next != components.end();
53 const typet &it_type = it_next->type();
58 throw "type of unknown size:\n" + it_type.
pretty();
60 cumulated_length += *size;
66 if(!first_time_seen_from)
71 if(it_mem != it_next && !it_next->get_is_padding())
73 if(first_time_seen_in_struct)
75 first_time_seen_in_struct =
false;
76 first_time_seen_from =
false;
79 <<
"declaration of structure "
81 << symbol_pair.second.location <<
'\n';
84 out <<
"members " << it_mem->get_name() <<
" and "
85 << it_next->get_name() <<
" might interfere\n";
90 else if(symbol_pair.second.type.id() == ID_array)
100 throw "type of unknown size:\n"+it_type.pretty();
105 <<
"declaration of an array at "
106 << symbol_pair.second.location <<
107 <<
"\nmight be concurrently accessed\n";
void print_struct_alignment_problems(const symbol_table_baset &symbol_table, std::ostream &out)
const typet & subtype() const
struct configt::ansi_ct ansi_c
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
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 symbol table base class interface.
const symbolst & symbols
Read-only field, used to look up symbols given their names.
The type of an expression, extends irept.
const typet & find_type(const irep_idt &name) const
std::optional< mp_integer > pointer_offset_size(const typet &type, const namespacet &ns)
Compute the size of a type in bytes, rounding up to full bytes.
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.
std::size_t memory_operand_size