63 std::cout <<
"cpp_convert_typet::read: " << type.
pretty() <<
'\n';
72 std::cout <<
"cpp_convert_typet::read_rec: " 76 if(type.
id()==ID_merged_type)
81 else if(type.
id()==ID_signed)
83 else if(type.
id()==ID_unsigned)
85 else if(type.
id()==ID_volatile)
87 else if(type.
id()==ID_char)
89 else if(type.
id()==ID_int)
91 else if(type.
id()==ID_short)
93 else if(type.
id()==ID_long)
95 else if(type.
id()==ID_double)
97 else if(type.
id()==ID_float)
99 else if(type.
id()==ID_gcc_float128)
101 else if(type.
id()==ID_gcc_int128)
103 else if(type.
id()==ID_complex)
105 else if(type.
id()==ID_bool)
107 else if(type.
id()==ID_proper_bool)
109 else if(type.
id()==ID_wchar_t)
111 else if(type.
id()==ID_char16_t)
113 else if(type.
id()==ID_char32_t)
115 else if(type.
id()==ID_int8)
117 else if(type.
id()==ID_int16)
119 else if(type.
id()==ID_int32)
121 else if(type.
id()==ID_int64)
123 else if(type.
id()==ID_ptr32)
125 else if(type.
id()==ID_ptr64)
127 else if(type.
id()==ID_const)
129 else if(type.
id()==ID_restrict)
131 else if(type.
id()==ID_constexpr)
133 else if(type.
id()==ID_extern)
135 else if(type.
id()==ID_noreturn)
139 else if(type.
id()==ID_function_type)
143 else if(type.
id()==ID_identifier)
147 else if(type.
id()==ID_cpp_name)
150 other.push_back(type);
152 else if(type.
id()==ID_array)
154 other.push_back(type);
157 else if(type.
id()==ID_template)
161 else if(type.
id()==ID_void)
166 other.push_back(tmp);
168 else if(type.
id()==ID_frontend_pointer)
174 tmp.
set(ID_C_reference,
true);
175 if(type.
get_bool(ID_C_rvalue_reference))
176 tmp.set(ID_C_rvalue_reference,
true);
177 other.push_back(tmp);
179 else if(type.
id()==ID_pointer)
182 other.push_back(type);
186 other.push_back(type);
192 other.push_back(type);
197 irept &arguments=t.
add(ID_arguments);
204 bool is_type=decl.
get_bool(ID_is_type);
220 other.push_back(type);
226 static_cast<typet &
>(t.
add(ID_return_type));
235 irept ¶meters=t.
add(ID_parameters);
238 if(!parameters.
get_sub().empty() &&
239 parameters.
get_sub().back().id()==ID_ellipsis)
241 parameters.
set(ID_ellipsis,
true);
247 exprt ¶meter_expr=
static_cast<exprt &
>(*it);
249 if(parameter_expr.
id()==ID_cpp_declaration)
263 if(declarator.is_nil())
265 parameter_expr=
exprt(ID_parameter, declaration.
type());
270 const cpp_namet &cpp_name=declarator.name();
271 typet final_type=declarator.merge_type(declaration.
type());
274 if(final_type.
id()==ID_array)
289 assert(!base_name.
empty());
296 throw "expected simple name as parameter";
299 if(declarator.value().is_not_nil())
302 parameter_expr.
swap(new_parameter);
305 else if(parameter_expr.
id()==ID_ellipsis)
307 throw "ellipsis only allowed as last parameter";
314 if(parameters.
get_sub().size()==1 &&
315 parameters.
get_sub().front().find(ID_type).id()==ID_empty)
333 throw "type modifier not applicable";
336 throw "illegal combination of types";
350 throw "illegal type modifier for double";
365 throw "illegal type modifier for float";
368 throw "float can't be long";
380 throw "illegal type modifier for __float128";
383 throw "__float128 can't be long";
395 throw "illegal type modifier for C++ bool";
406 throw "illegal type modifier for __CPROVER_bool";
416 throw "illegal type modifier for char";
435 throw "illegal type modifier for wchar_t";
447 throw "illegal type modifier for char16_t";
458 throw "illegal type modifier for char32_t";
467 throw "integer cannot be both signed and unsigned";
472 throw "cannot combine short and long";
482 throw "illegal type modifier for __int8";
495 throw "illegal type modifier for __int16";
506 throw "illegal type modifier for __int32";
517 throw "illegal type modifier for __int64";
528 throw "illegal type modifier for __int128";
557 throw "illegal combination of type modifiers";
562 type.
set(ID_C_constant,
true);
566 type.
set(ID_C_volatile,
true);
571 if(type.
id()==ID_cpp_name ||
572 type.
id()==ID_struct ||
573 type.
id()==ID_union ||
574 type.
id()==ID_array ||
575 type.
id()==ID_code ||
576 type.
id()==ID_unsignedbv ||
577 type.
id()==ID_signedbv ||
578 type.
id()==ID_bool ||
579 type.
id()==ID_floatbv ||
580 type.
id()==ID_empty ||
581 type.
id()==ID_symbol ||
582 type.
id()==ID_constructor ||
583 type.
id()==ID_destructor)
586 else if(type.
id()==ID_c_enum)
595 cpp_convert_type.
write(type);
608 for(
auto &t : cpp_convert_type.
other)
609 if(t.id() == ID_auto)
612 cpp_convert_type.
write(dest);
bitvector_typet gcc_float128_type()
The type of an expression.
signedbv_typet gcc_signed_int128_type()
#define forall_subtypes(it, type)
struct configt::ansi_ct ansi_c
pointer_typet pointer_type(const typet &subtype)
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
unsignedbv_typet unsigned_int_type()
unsignedbv_typet char32_t_type()
bitvector_typet double_type()
bool is_simple_name() const
unsignedbv_typet gcc_unsigned_int128_type()
bool get_bool(const irep_namet &name) const
cpp_convert_typet(const typet &type)
void set_base_name(const irep_idt &name)
const irep_idt & id() const
const source_locationt & source_location() const
const declaratorst & declarators() const
bitvector_typet float_type()
void cpp_convert_auto(typet &dest, const typet &src)
signedbv_typet signed_long_int_type()
void read(const typet &type)
Base class for tree-like data structures with sharing.
#define Forall_irep(it, irep)
std::size_t pointer_width
unsignedbv_typet char16_t_type()
bitvector_typet long_double_type()
const source_locationt & source_location() const
irep_idt get_base_name() const
void read_function_type(const typet &type)
signedbv_typet signed_short_int_type()
C++ Language Type Checking.
void read_template(const typet &type)
bitvector_typet wchar_t_type()
cpp_declarationt & to_cpp_declaration(irept &irep)
void set_identifier(const irep_idt &identifier)
unsignedbv_typet unsigned_short_int_type()
Base class for all expressions.
source_locationt & add_source_location()
irept & add(const irep_namet &name)
void cpp_convert_plain_type(typet &type)
source_locationt & add_source_location()
unsignedbv_typet unsigned_long_long_int_type()
void read_rec(const typet &type)
signedbv_typet signed_int_type()
unsignedbv_typet unsigned_char_type()
const typet & subtype() const
unsignedbv_typet unsigned_long_int_type()
signedbv_typet signed_long_long_int_type()
signedbv_typet signed_char_type()
bitvector_typet char_type()
const exprt & default_value() const
void set(const irep_namet &name, const irep_idt &value)