61 std::cout <<
"cpp_convert_typet::read: " << type.
pretty() <<
'\n';
70 std::cout <<
"cpp_convert_typet::read_rec: " 74 if(type.
id()==ID_merged_type)
79 else if(type.
id()==ID_signed)
81 else if(type.
id()==ID_unsigned)
83 else if(type.
id()==ID_volatile)
85 else if(type.
id()==ID_char)
87 else if(type.
id()==ID_int)
89 else if(type.
id()==ID_short)
91 else if(type.
id()==ID_long)
93 else if(type.
id()==ID_double)
95 else if(type.
id()==ID_float)
97 else if(type.
id()==ID_gcc_float128)
99 else if(type.
id()==ID_gcc_int128)
101 else if(type.
id()==ID_complex)
103 else if(type.
id()==ID_bool)
105 else if(type.
id()==ID_proper_bool)
107 else if(type.
id()==ID_wchar_t)
109 else if(type.
id()==ID_char16_t)
111 else if(type.
id()==ID_char32_t)
113 else if(type.
id()==ID_int8)
115 else if(type.
id()==ID_int16)
117 else if(type.
id()==ID_int32)
119 else if(type.
id()==ID_int64)
121 else if(type.
id()==ID_ptr32)
123 else if(type.
id()==ID_ptr64)
125 else if(type.
id()==ID_const)
127 else if(type.
id()==ID_restrict)
129 else if(type.
id()==ID_constexpr)
131 else if(type.
id()==ID_extern)
133 else if(type.
id()==ID_function_type)
137 else if(type.
id()==ID_identifier)
141 else if(type.
id()==ID_cpp_name)
144 other.push_back(type);
146 else if(type.
id()==ID_array)
148 other.push_back(type);
151 else if(type.
id()==ID_template)
155 else if(type.
id()==ID_void)
160 other.push_back(tmp);
164 other.push_back(type);
170 other.push_back(type);
175 irept &arguments=t.
add(ID_arguments);
182 bool is_type=decl.
get_bool(ID_is_type);
198 other.push_back(type);
204 static_cast<typet &
>(t.
add(ID_return_type));
213 irept ¶meters=t.
add(ID_parameters);
216 if(!parameters.
get_sub().empty() &&
217 parameters.
get_sub().back().id()==ID_ellipsis)
219 parameters.
set(ID_ellipsis,
true);
225 exprt ¶meter_expr=
static_cast<exprt &
>(*it);
227 if(parameter_expr.
id()==ID_cpp_declaration)
241 if(declarator.is_nil())
243 parameter_expr=
exprt(ID_parameter, declaration.
type());
248 const cpp_namet &cpp_name=declarator.name();
249 typet final_type=declarator.merge_type(declaration.
type());
252 if(final_type.
id()==ID_array)
262 new_parameter.add_source_location()=type_location;
267 assert(!base_name.
empty());
268 new_parameter.set_identifier(base_name);
269 new_parameter.set_base_name(base_name);
274 throw "expected simple name as parameter";
277 if(declarator.value().is_not_nil())
278 new_parameter.default_value().
swap(declarator.value());
280 parameter_expr.
swap(new_parameter);
283 else if(parameter_expr.
id()==ID_ellipsis)
285 throw "ellipsis only allowed as last parameter";
292 if(parameters.
get_sub().size()==1 &&
293 parameters.
get_sub().front().find(ID_type).id()==ID_empty)
311 throw "type modifier not applicable";
314 throw "illegal combination of types";
328 throw "illegal type modifier for double";
343 throw "illegal type modifier for float";
346 throw "float can't be long";
358 throw "illegal type modifier for __float128";
361 throw "__float128 can't be long";
373 throw "illegal type modifier for C++ bool";
384 throw "illegal type modifier for __CPROVER_bool";
394 throw "illegal type modifier for char";
413 throw "illegal type modifier for wchar_t";
425 throw "illegal type modifier for char16_t";
436 throw "illegal type modifier for char32_t";
445 throw "integer cannot be both signed and unsigned";
450 throw "cannot combine short and long";
460 throw "illegal type modifier for __int8";
473 throw "illegal type modifier for __int16";
484 throw "illegal type modifier for __int32";
495 throw "illegal type modifier for __int64";
506 throw "illegal type modifier for __int128";
535 throw "illegal combination of type modifiers";
540 type.
set(ID_C_constant,
true);
544 type.
set(ID_C_volatile,
true);
549 if(type.
id()==ID_cpp_name ||
550 type.
id()==ID_struct ||
551 type.
id()==ID_union ||
552 type.
id()==ID_pointer ||
553 type.
id()==ID_array ||
554 type.
id()==ID_code ||
555 type.
id()==ID_unsignedbv ||
556 type.
id()==ID_signedbv ||
557 type.
id()==ID_bool ||
558 type.
id()==ID_floatbv ||
559 type.
id()==ID_empty ||
560 type.
id()==ID_symbol ||
561 type.
id()==ID_constructor ||
562 type.
id()==ID_destructor)
565 else if(type.
id()==ID_c_enum)
574 cpp_convert_type.
write(type);
The type of an expression.
#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
bool get_bool(const irep_namet &name) const
cpp_convert_typet(const typet &type)
const irep_idt & id() const
const source_locationt & source_location() const
const declaratorst & declarators() const
bitvector_typet float_type()
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)
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)
unsignedbv_typet gcc_unsigned_int128_type()
bitvector_typet gcc_float128_type()
unsignedbv_typet unsigned_short_int_type()
Base class for all expressions.
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 gcc_signed_int128_type()
signedbv_typet signed_long_long_int_type()
signedbv_typet signed_char_type()
bitvector_typet char_type()
void set(const irep_namet &name, const irep_idt &value)