Go to the documentation of this file.
22 typedef std::unordered_map<irep_idt, std::pair<size_t, bool>>
symbol_numbert;
38 if(ns.
lookup(identifier, symbol))
41 assert(symbol && symbol->
is_type);
43 if(symbol->
type.
id()!=ID_struct &&
44 symbol->
type.
id()!=ID_union)
50 std::pair<symbol_numbert::iterator, bool> entry=
51 symbol_number.insert(std::make_pair(
53 std::make_pair(symbol_number.size(),
true)));
63 entry.first->second.second=
false;
67 else if(entry.first->second.second)
72 entry.first->second.second=
true;
74 entry.first->second.second=
false;
112 if(type.
get_bool(ID_C_transparent_union))
124 throw "empty type encountered";
125 else if(type.
id()==ID_empty)
127 else if(type.
id()==ID_signedbv)
129 else if(type.
id()==ID_unsignedbv)
131 else if(type.
id()==ID_bool ||
132 type.
id()==ID_c_bool)
134 else if(type.
id()==ID_integer)
136 else if(type.
id()==ID_real)
138 else if(type.
id()==ID_complex)
140 else if(type.
id()==ID_floatbv)
142 else if(type.
id()==ID_fixedbv)
144 else if(type.
id()==ID_natural)
146 else if(type.
id()==ID_pointer)
153 else if(type.
id()==ID_code)
159 for(code_typet::parameterst::const_iterator
160 it=parameters.begin();
161 it!=parameters.end();
164 if(it!=parameters.begin())
171 if(!parameters.empty())
179 else if(type.
id()==ID_array)
183 if(size.
id() == ID_symbol)
187 const auto size_int = numeric_cast<mp_integer>(size);
189 if(!size_int.has_value())
196 type.
id() == ID_symbol_type || type.
id() == ID_c_enum_tag ||
197 type.
id() == ID_struct_tag || type.
id() == ID_union_tag)
202 else if(type.
id()==ID_struct ||
207 if(type.
id()==ID_struct)
209 if(type.
id()==ID_union)
221 const irep_idt &component_name = c.get_name();
227 else if(type.
id()==ID_incomplete_struct)
229 else if(type.
id()==ID_incomplete_union)
231 else if(type.
id()==ID_c_enum)
237 for(c_enum_typet::memberst::const_iterator
242 if(it!=members.begin())
248 else if(type.
id()==ID_incomplete_c_enum)
250 else if(type.
id()==ID_c_bit_field)
252 else if(type.
id()==ID_vector)
255 throw "unknown type '"+type.
id_string()+
"' encountered";
282 return type2name(type, ns, symbol_number);
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
const irep_idt & get_function() const
bool has_ellipsis() const
std::unordered_map< irep_idt, std::pair< size_t, bool > > symbol_numbert
const typet & subtype() const
const struct_union_typet & to_struct_union_type(const typet &type)
Cast a typet to a struct_union_typet.
const c_enum_typet & to_c_enum_type(const typet &type)
Cast a typet to a c_enum_typet.
The type of an expression, extends irept.
std::vector< parametert > parameterst
typet type
Type of symbol.
std::vector< c_enum_membert > memberst
bool has_subtypes() const
Base class for all expressions.
std::string to_string(const string_not_contains_constraintt &expr)
Used for debug printing.
static std::string pointer_offset_bits_as_string(const typet &type, const namespacet &ns)
const exprt & size() const
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
bool get_bool(const irep_namet &name) const
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
mstreamt & result() const
const std::string & id2string(const irep_idt &d)
static std::string type2name(const typet &type, const namespacet &ns, symbol_numbert &symbol_number)
const source_locationt & source_location() const
optionalt< mp_integer > pointer_offset_bits(const typet &type, const namespacet &ns)
static bool parent_is_sym_check
const std::string & id_string() const
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
const irep_idt & id() const
const parameterst & parameters() const
#define forall_subtypes(it, type)
const std::string & get_string(const irep_namet &name) const
const irep_idt & get(const irep_namet &name) const
const array_typet & to_array_type(const typet &type)
Cast a typet to an array_typet.
const typet & return_type() const
static std::string type2name_symbol(const typet &type, const namespacet &ns, symbol_numbert &symbol_number)
const memberst & members() const
const std::string integer2string(const mp_integer &n, unsigned base)
#define CHECK_RETURN(CONDITION)