Go to the documentation of this file.
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_float80)
101 else if(type.
id()==ID_gcc_float128)
103 else if(type.
id()==ID_gcc_int128)
105 else if(type.
id()==ID_complex)
107 else if(type.
id() == ID_c_bool)
109 else if(type.
id()==ID_proper_bool)
111 else if(type.
id()==ID_wchar_t)
113 else if(type.
id()==ID_char16_t)
115 else if(type.
id()==ID_char32_t)
117 else if(type.
id()==ID_int8)
119 else if(type.
id()==ID_int16)
121 else if(type.
id()==ID_int32)
123 else if(type.
id()==ID_int64)
125 else if(type.
id()==ID_ptr32)
127 else if(type.
id()==ID_ptr64)
129 else if(type.
id()==ID_const)
131 else if(type.
id()==ID_restrict)
133 else if(type.
id()==ID_constexpr)
135 else if(type.
id()==ID_extern)
137 else if(type.
id()==ID_noreturn)
141 else if(type.
id()==ID_function_type)
145 else if(type.
id()==ID_identifier)
149 else if(type.
id()==ID_cpp_name)
152 other.push_back(type);
154 else if(type.
id()==ID_array)
156 other.push_back(type);
159 else if(type.
id()==ID_template)
163 else if(type.
id()==ID_void)
168 other.push_back(tmp);
170 else if(type.
id()==ID_frontend_pointer)
176 tmp.
set(ID_C_reference,
true);
177 if(type.
get_bool(ID_C_rvalue_reference))
178 tmp.
set(ID_C_rvalue_reference,
true);
179 other.push_back(tmp);
181 else if(type.
id()==ID_pointer)
184 other.push_back(type);
188 other.push_back(type);
194 other.push_back(type);
199 irept &arguments=t.
add(ID_arguments);
206 bool is_type=decl.
get_bool(ID_is_type);
222 other.push_back(type);
223 other.back().id(ID_code);
240 if(!parameters.empty() && parameters.back().id() == ID_ellipsis)
243 parameters.pop_back();
246 for(
auto ¶meter_expr : parameters)
248 if(parameter_expr.id()==ID_cpp_declaration)
265 parameter_expr.add_source_location()=type_location;
273 if(final_type.
id()==ID_array)
288 assert(!base_name.
empty());
295 throw "expected simple name as parameter";
301 parameter_expr.swap(new_parameter);
304 else if(parameter_expr.id()==ID_ellipsis)
306 throw "ellipsis only allowed as last parameter";
313 if(parameters.size() == 1 && parameters.front().type().id() == ID_empty)
331 throw "type modifier not applicable";
334 throw "illegal combination of types";
348 throw "illegal type modifier for double";
364 throw "illegal type modifier for float";
367 throw "float can't be long";
380 throw "illegal type modifier for __float80";
383 throw "__float80 can't be long";
396 throw "illegal type modifier for __float128";
399 throw "__float128 can't be long";
411 throw "illegal type modifier for C++ bool";
432 throw "illegal type modifier for char";
451 throw "illegal type modifier for wchar_t";
463 throw "illegal type modifier for char16_t";
474 throw "illegal type modifier for char32_t";
483 throw "integer cannot be both signed and unsigned";
488 throw "cannot combine short and long";
498 throw "illegal type modifier for __int8";
511 throw "illegal type modifier for __int16";
522 throw "illegal type modifier for __int32";
533 throw "illegal type modifier for __int64";
544 throw "illegal type modifier for __int128";
573 throw "illegal combination of type modifiers";
578 type.
set(ID_C_constant,
true);
582 type.
set(ID_C_volatile,
true);
588 type.
id() == ID_cpp_name || type.
id() == ID_struct ||
589 type.
id() == ID_union || type.
id() == ID_array || type.
id() == ID_code ||
590 type.
id() == ID_unsignedbv || type.
id() == ID_signedbv ||
591 type.
id() == ID_bool || type.
id() == ID_floatbv || type.
id() == ID_empty ||
592 type.
id() == ID_symbol_type || type.
id() == ID_constructor ||
593 type.
id() == ID_destructor)
596 else if(type.
id()==ID_c_enum)
602 else if(type.
id() == ID_c_bool)
609 cpp_convert_type.
write(type);
622 for(
auto &t : cpp_convert_type.
other)
623 if(t.id() == ID_auto)
626 cpp_convert_type.
write(dest);
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
const typet & subtype() const
floatbv_typet gcc_float64x_type()
signedbv_typet signed_long_long_int_type()
signedbv_typet signed_char_type()
void cpp_convert_auto(typet &dest, const typet &src)
The type of an expression, extends irept.
std::vector< parametert > parameterst
unsignedbv_typet char32_t_type()
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
cpp_declarationt & to_cpp_declaration(irept &irep)
floatbv_typet long_double_type()
void set_identifier(const irep_idt &identifier)
irept & add(const irep_namet &name)
void read_rec(const typet &type)
Base class for all expressions.
unsignedbv_typet unsigned_char_type()
struct configt::ansi_ct ansi_c
unsignedbv_typet char16_t_type()
void read_function_type(const typet &type)
#define Forall_irep(it, irep)
floatbv_typet gcc_float128_type()
#define UNREACHABLE
This should be used to mark dead code.
unsignedbv_typet unsigned_short_int_type()
const declaratorst & declarators() const
unsignedbv_typet unsigned_long_long_int_type()
unsignedbv_typet unsigned_long_int_type()
typet & type()
Return the type of the expression.
bool get_bool(const irep_namet &name) const
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
signedbv_typet signed_int_type()
signedbv_typet gcc_signed_int128_type()
const exprt & default_value() const
const source_locationt & source_location() const
void read(const typet &type)
bool is_simple_name() const
bitvector_typet wchar_t_type()
signedbv_typet signed_short_int_type()
floatbv_typet float_type()
pointer_typet pointer_type(const typet &subtype)
unsignedbv_typet unsigned_int_type()
const irep_idt & id() const
const parameterst & parameters() const
source_locationt & add_source_location()
#define forall_subtypes(it, type)
void set_base_name(const irep_idt &name)
floatbv_typet double_type()
bitvector_typet char_type()
cpp_convert_typet(const typet &type)
const source_locationt & source_location() const
void cpp_convert_plain_type(typet &type)
void set(const irep_namet &name, const irep_idt &value)
unsignedbv_typet gcc_unsigned_int128_type()
signedbv_typet signed_long_int_type()
const typet & return_type() const
Base class for tree-like data structures with sharing.
std::size_t pointer_width
source_locationt & add_source_location()
The pointer type These are both 'bitvector_typet' (they have a width) and 'type_with_subtypet' (they ...
irep_idt get_base_name() const
void read_template(const typet &type)
typet merge_type(const typet &declaration_type) const