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)
48 std::pair<symbol_numbert::iterator, bool> entry=
49 symbol_number.insert(std::make_pair(
51 std::make_pair(symbol_number.size(),
true)));
53 std::string
result =
"SYM" +
64 entry.first->second.second=
false;
96 if(type.
get_bool(ID_C_transparent_union))
108 throw "empty type encountered";
109 else if(type.
id()==ID_empty)
111 else if(type.
id()==ID_signedbv)
113 else if(type.
id()==ID_unsignedbv)
115 else if(type.
id()==ID_bool ||
116 type.
id()==ID_c_bool)
118 else if(type.
id()==ID_integer)
120 else if(type.
id()==ID_real)
122 else if(type.
id()==ID_complex)
124 else if(type.
id()==ID_floatbv)
126 else if(type.
id()==ID_fixedbv)
128 else if(type.
id()==ID_natural)
130 else if(type.
id()==ID_pointer)
137 else if(type.
id()==ID_code)
143 for(code_typet::parameterst::const_iterator
144 it=parameters.begin();
145 it!=parameters.end();
148 if(it!=parameters.begin())
155 if(!parameters.empty())
163 else if(type.
id()==ID_array)
167 if(size.
id() == ID_symbol)
171 const auto size_int = numeric_cast<mp_integer>(size);
173 if(!size_int.has_value())
180 type.
id() == ID_c_enum_tag || type.
id() == ID_struct_tag ||
181 type.
id() == ID_union_tag)
185 else if(type.
id()==ID_struct ||
190 if(struct_union_type.is_incomplete())
192 if(type.
id() == ID_struct)
194 else if(type.
id() == ID_union)
199 if(type.
id() == ID_struct)
201 if(type.
id() == ID_union)
205 for(
const auto &c : struct_union_type.components())
213 const irep_idt &component_name = c.get_name();
220 else if(type.
id()==ID_c_enum)
231 for(c_enum_typet::memberst::const_iterator it = members.begin();
235 if(it != members.begin())
242 else if(type.
id()==ID_c_bit_field)
244 else if(type.
id()==ID_vector)
247 throw "unknown type '"+type.
id_string()+
"' encountered";
273 return type2name(type, ns, symbol_number);
const irep_idt & get_identifier() const
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
bool is_incomplete() const
enum types may be incomplete
const struct_union_typet & to_struct_union_type(const typet &type)
Cast a typet to a struct_union_typet.
#define CHECK_RETURN(CONDITION)
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 tag_typet & to_tag_type(const typet &type)
Cast a typet to a tag_typet.
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)
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
A tag-based type, i.e., typet with an identifier.
const parameterst & parameters() const
static std::string type2name_tag(const tag_typet &type, const namespacet &ns, symbol_numbert &symbol_number)
#define forall_subtypes(it, type)
const std::string & get_string(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
const memberst & members() const
const std::string integer2string(const mp_integer &n, unsigned base)