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(t.
size().
id()==ID_symbol)
190 else if(type.
id()==ID_symbol ||
191 type.
id()==ID_c_enum_tag ||
192 type.
id()==ID_struct_tag ||
193 type.
id()==ID_union_tag)
198 else if(type.
id()==ID_struct ||
203 if(type.
id()==ID_struct)
205 if(type.
id()==ID_union)
210 for(struct_union_typet::componentst::const_iterator
211 it=components.begin();
212 it!=components.end();
215 if(it!=components.begin())
218 irep_idt component_name = it->get_name();
224 else if(type.
id()==ID_incomplete_struct)
226 else if(type.
id()==ID_incomplete_union)
228 else if(type.
id()==ID_c_enum)
234 for(c_enum_typet::memberst::const_iterator
239 if(it!=members.begin())
245 else if(type.
id()==ID_incomplete_c_enum)
247 else if(type.
id()==ID_c_bit_field)
249 else if(type.
id()==ID_vector)
252 throw "unknown type '"+type.
id_string()+
"' encountered";
279 return type2name(type, ns, symbol_number);
static std::string type2name(const typet &type, const namespacet &ns, symbol_numbert &symbol_number)
The type of an expression.
#define forall_subtypes(it, type)
bool has_subtypes() const
const std::string & id2string(const irep_idt &d)
const std::string integer2string(const mp_integer &n, unsigned base)
bool has_ellipsis() const
const code_typet & to_code_type(const typet &type)
Cast a generic typet to a code_typet.
const irep_idt & get_function() const
std::vector< componentt > componentst
std::vector< parametert > parameterst
const componentst & components() const
const memberst & members() const
mp_integer pointer_offset_bits(const typet &type, const namespacet &ns)
Symbol table entry.This is a symbol in the symbol table, stored in an object of type symbol_tablet...
#define CHECK_RETURN(CONDITION)
bool get_bool(const irep_namet &name) const
const irep_idt & id() const
API to expression classes.
const irep_idt & get(const irep_namet &name) const
static bool parent_is_sym_check
const exprt & size() const
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast a generic exprt to a symbol_exprt.
std::unordered_map< irep_idt, std::pair< size_t, bool > > symbol_numbert
static std::string pointer_offset_bits_as_string(const typet &type, const namespacet &ns)
const source_locationt & source_location() const
static std::string type2name_symbol(const typet &type, const namespacet &ns, symbol_numbert &symbol_number)
typet type
Type of symbol.
Base type of C structs and unions, and C++ classes.
mstreamt & result() const
const array_typet & to_array_type(const typet &type)
Cast a generic typet to an array_typet.
const parameterst & parameters() const
const struct_union_typet & to_struct_union_type(const typet &type)
Cast a generic typet to a struct_union_typet.
std::string to_string(const string_constraintt &expr)
Used for debug printing.
const std::string & get_string(const irep_namet &name) const
const std::string & id_string() const
const c_enum_typet & to_c_enum_type(const typet &type)
Cast a generic typet to a c_enum_typet.
const typet & subtype() const
std::vector< c_enum_membert > memberst
const typet & return_type() const
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See namespace_baset::lookup().