31 const exprt &src,
unsigned &precedence)
override;
45 const std::string &declarator)
override;
47 typedef std::unordered_set<std::string, string_hash>
id_sett;
56 if(full_type.
id()!=ID_struct)
61 std::string dest=
"{ ";
66 assert(components.size()==src.
operands().size());
68 exprt::operandst::const_iterator o_it=src.
operands().begin();
73 for(struct_typet::componentst::const_iterator
74 c_it=components.begin();
75 c_it!=components.end();
78 if(c_it->type().id()==ID_code)
90 if(last_size+40<dest.size())
93 last_size=dest.size();
101 dest+=c_it->get_string(ID_pretty_name);
116 unsigned &precedence)
118 if(src.
type().
id()==ID_bool)
133 const std::string &declarator)
136 new_qualifiers.
read(src);
139 declarator==
""?declarator:(
" "+declarator);
152 else if(!src.
get(ID_C_c_type).
empty())
156 if(c_type==ID_signed_char)
157 return q+
"signed char"+d;
158 else if(c_type==ID_unsigned_char)
159 return q+
"unsigned char"+d;
160 else if(c_type==ID_char)
162 else if(c_type==ID_signed_short_int)
164 else if(c_type==ID_unsigned_short_int)
165 return q+
"unsigned short"+d;
166 else if(c_type==ID_signed_int)
168 else if(c_type==ID_unsigned_int)
169 return q+
"unsigned"+d;
170 else if(c_type==ID_signed_long_int)
172 else if(c_type==ID_unsigned_long_int)
173 return q+
"unsigned long"+d;
174 else if(c_type==ID_signed_long_long_int)
175 return q+
"long long"+d;
176 else if(c_type==ID_unsigned_long_long_int)
177 return q+
"unsigned long long"+d;
178 else if(c_type==ID_wchar_t)
179 return q+
"wchar_t"+d;
180 else if(c_type==ID_float)
182 else if(c_type==ID_double)
184 else if(c_type==ID_long_double)
185 return q+
"long double"+d;
186 else if(c_type==ID_bool)
191 else if(src.
id()==ID_symbol)
198 if(symbol.
type.
id()==ID_struct ||
199 symbol.
type.
id()==ID_incomplete_struct)
217 else if(symbol.
type.
id()==ID_c_enum)
233 else if(src.
id()==ID_struct ||
234 src.
id()==ID_incomplete_struct)
240 else if(src.
get_bool(ID_C_interface))
249 else if(src.
id()==ID_constructor)
251 return "constructor ";
253 else if(src.
id()==ID_destructor)
255 return "destructor ";
257 else if(src.
id()==
"cpp-template-type")
261 else if(src.
id()==ID_template)
263 std::string dest=
"template<";
269 if(it!=arguments.begin())
274 if(argument.
id()==ID_symbol)
279 else if(argument.
id()==ID_type)
292 else if(src.
id()==ID_pointer && src.
subtype().
id()==ID_nullptr)
294 return "std::nullptr_t";
296 else if(src.
id()==ID_pointer &&
301 member.
swap(tmp.
add(
"to-member"));
314 for(code_typet::parameterst::const_iterator it=args.begin();
331 else if(src.
id()==ID_verilog_signedbv ||
332 src.
id()==ID_verilog_unsignedbv)
334 else if(src.
id()==ID_unassigned)
336 else if(src.
id()==ID_code)
343 std::string dest=
"auto";
354 for(code_typet::parameterst::const_iterator
355 it=parameters.begin();
356 it!=parameters.end();
359 if(it!=parameters.begin())
367 if(!parameters.empty())
375 dest+=
" -> "+
convert(return_type);
379 else if(src.
id()==ID_initializer_list)
401 if(src.
get(ID_statement)==ID_cpp_new_array)
405 std::string tmp_size=
406 convert(static_cast<const exprt &>(src.
find(ID_size)));
424 std::string dest=
indent_str(indent)+
"delete ";
441 unsigned &precedence)
443 if(src.
id()==
"cpp-this")
445 if(src.
id()==ID_extractbit)
447 else if(src.
id()==ID_extractbits)
449 else if(src.
id()==ID_side_effect &&
450 (src.
get(ID_statement)==ID_cpp_new ||
451 src.
get(ID_statement)==ID_cpp_new_array))
453 else if(src.
id()==ID_side_effect &&
454 src.
get(ID_statement)==ID_throw)
462 else if(src.
id()==ID_unassigned)
464 else if(src.
id()==
"pod_constructor")
465 return "pod_constructor";
476 if(statement==ID_cpp_delete ||
477 statement==ID_cpp_delete_array)
480 if(statement==ID_cpp_new ||
481 statement==ID_cpp_new_array)
The type of an expression.
std::string convert_struct(const exprt &src, unsigned &precedence) override
const typet & follow(const typet &src) const
virtual bool lookup(const irep_idt &name, const symbolt *&symbol) const
const std::string & id2string(const irep_idt &d)
std::string convert_function(const exprt &src, const std::string &symbol, unsigned precedence)
std::string convert_extractbit(const exprt &src, unsigned precedence)
std::vector< irept > subt
std::string expr2string() const
bool has_ellipsis() const
std::vector< componentt > componentst
const irep_idt & get_value() const
std::vector< parametert > parameterst
std::string convert_rec(const typet &src, const c_qualifierst &qualifiers, const std::string &declarator) override
const componentst & components() const
std::string convert_code(const codet &src)
irep_idt pretty_name
Language-specific display name.
Symbol table entry.This is a symbol in the symbol table, stored in an object of type symbol_tablet...
A constant literal expression.
bool get_bool(const irep_namet &name) const
virtual std::string convert(const typet &src)
std::string convert_cpp_new(const exprt &src, unsigned precedence)
std::string convert_code(const codet &src, unsigned indent) override
std::string convert_extractbits(const exprt &src, unsigned precedence)
virtual std::string convert_constant(const constant_exprt &src, unsigned &precedence)
void read(const typet &src)
const irep_idt & id() const
std::string convert_code_cpp_delete(const exprt &src, unsigned precedence)
const symbol_typet & to_symbol_type(const typet &type)
Cast a generic typet to a symbol_typet.
std::string expr2cpp(const exprt &expr, const namespacet &ns)
std::string convert_cpp_this(const exprt &src, unsigned precedence)
API to expression classes.
bool is_reference(const typet &type)
TO_BE_DOCUMENTED.
const irep_idt & get(const irep_namet &name) const
std::unordered_set< std::string, string_hash > id_sett
void irep2lisp(const irept &src, lispexprt &dest)
expr2cppt(const namespacet &_ns)
std::string convert_with_precedence(const exprt &src, unsigned &precedence) override
const struct_typet & to_struct_type(const typet &type)
Cast a generic typet to a struct_typet.
virtual std::string convert_rec(const typet &src, const c_qualifierst &qualifiers, const std::string &declarator)
std::string convert_norep(const exprt &src, unsigned &precedence)
std::string as_string() const
typet type
Type of symbol.
std::string convert_constant(const constant_exprt &src, unsigned &precedence) override
std::string type2cpp(const typet &type, const namespacet &ns)
Base class for all expressions.
bool is_rvalue_reference(const typet &type)
TO_BE_DOCUMENTED.
const parameterst & parameters() const
virtual std::string convert_with_precedence(const exprt &src, unsigned &precedence)
irept & add(const irep_namet &name)
const code_typet & to_code_type(const typet &type)
Cast a generic typet to a code_typet.
std::string MetaString(const std::string &in)
A statement in a programming language.
const constant_exprt & to_constant_expr(const exprt &expr)
Cast a generic exprt to a constant_exprt.
const typet & subtype() const
const irept & find(const irep_namet &name) const
const typet & return_type() const
const irep_idt & get_identifier() const
static std::string indent_str(unsigned indent)
#define forall_irep(it, irep)