83 if(has_this && it==arguments.begin())
106 unsigned &precedence)
108 const typet &full_type = src.
type().
id() == ID_struct_tag
112 if(full_type.
id()!=ID_struct)
117 std::string dest=
"{ ";
123 components.size() == src.
operands().size(),
124 "inconsistent number of components");
126 exprt::operandst::const_iterator o_it=src.
operands().begin();
131 for(
const auto &c : components)
134 c.type().id() != ID_code,
"struct member must not be of code type");
136 std::string tmp =
convert(*o_it);
143 if(last_size + 40 < dest.size())
146 last_size = dest.size();
154 irep_idt field_name = c.get_pretty_name();
155 if(field_name.
empty())
156 field_name = c.get_name();
171 unsigned &precedence)
173 if(src.
type().
id()==ID_c_bool)
187 else if(src.
type().
id()==ID_pointer)
198 const char16_t int_value = numeric_cast_v<char16_t>(src);
208 const mp_integer int_value = numeric_cast_v<mp_integer>(src);
209 std::string dest=
"(byte)";
216 const mp_integer int_value = numeric_cast_v<mp_integer>(src);
217 std::string dest=
"(short)";
224 const mp_integer int_value = numeric_cast_v<mp_integer>(src);
246 const std::string &declarator)
248 std::unique_ptr<c_qualifierst> clone = qualifiers.
clone();
250 new_qualifiers.
read(src);
252 const std::string d = declarator.empty() ? declarator : (
" " + declarator);
272 return q+
"boolean"+d;
275 else if(src.
id()==ID_code)
288 for(java_method_typet::parameterst::const_iterator it = parameters.begin();
289 it != parameters.end();
292 if(it!=parameters.begin())
300 if(!parameters.empty())
308 dest+=
" -> "+
convert(return_type);
325 return convert(instanceof_expr.tested_expr()) +
" instanceof " +
326 convert(instanceof_expr.target_type());
338 if(src.
get(ID_statement)==ID_java_new_array ||
339 src.
get(ID_statement)==ID_java_new_array_data)
343 std::string tmp_size=
362 std::string dest=
indent_str(indent)+
"delete ";
379 unsigned &precedence)
381 if(src.
id()==
"java-this")
386 if(src.
id()==ID_java_instanceof)
391 else if(src.
id()==ID_side_effect &&
392 (src.
get(ID_statement)==ID_java_new ||
393 src.
get(ID_statement)==ID_java_new_array ||
394 src.
get(ID_statement)==ID_java_new_array_data))
399 else if(src.
id()==ID_side_effect &&
400 src.
get(ID_statement)==ID_throw)
405 else if(src.
id()==ID_code &&
406 to_code(src).get_statement()==ID_exception_landingpad)
408 const exprt &catch_expr=
410 return "catch_landingpad("+
416 else if(src.
id()==ID_unassigned)
418 else if(src.
id()==
"pod_constructor")
419 return "pod_constructor";
420 else if(src.
id()==ID_virtual_function)
428 const auto &literal = expr_try_dynamic_cast<java_string_literal_exprt>(src))
444 if(statement==ID_java_new ||
445 statement==ID_java_new_array)
448 if(statement==ID_function_call)
std::string MetaString(const std::string &in)
virtual void read(const typet &src)
virtual std::unique_ptr< c_qualifierst > clone() const
virtual std::string as_string() const
An expression describing a method on a class.
const irep_idt & class_id() const
Unique identifier in the symbol table, of the compile time type of the class which this expression is...
const irep_idt & mangled_method_name() const
The method name after mangling it by combining it with the descriptor.
goto_instruction_codet representation of a function call statement.
const exprt & catch_expr() const
const typet & return_type() const
bool has_ellipsis() const
const parameterst & parameters() const
Data structure for representing an arbitrary statement in a program.
A constant literal expression.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
std::optional< std::string > convert_function(const exprt &src)
Returns a string if src is a function with a known conversion, else returns nullopt.
virtual std::string convert_rec(const typet &src, const c_qualifierst &qualifiers, const std::string &declarator)
static std::string indent_str(unsigned indent)
std::string convert_code(const codet &src)
std::string convert_norep(const exprt &src, unsigned &precedence)
virtual std::string convert_constant(const constant_exprt &src, unsigned &precedence)
virtual std::string convert_with_precedence(const exprt &src, unsigned &precedence)
virtual std::string convert(const typet &src)
std::string convert_code_java_new(const exprt &src, unsigned precedence)
std::string convert_java_new(const exprt &src)
virtual std::string convert_struct(const exprt &src, unsigned &precedence) override
virtual std::string convert_with_precedence(const exprt &src, unsigned &precedence) override
std::string convert_code_java_delete(const exprt &src, unsigned precedence)
virtual std::string convert_rec(const typet &src, const c_qualifierst &qualifiers, const std::string &declarator) override
std::string convert_code_function_call(const code_function_callt &src, unsigned indent)
const std::size_t char_representation_length
virtual std::string convert_code(const codet &src, unsigned indent) override
std::string convert_java_instanceof(const exprt &src)
virtual std::string convert(const typet &src) override
std::string convert_java_this()
virtual std::string convert_constant(const constant_exprt &src, unsigned &precedence) override
Base class for all expressions.
std::vector< exprt > operandst
bool is_true() const
Return whether the expression is a constant representing true.
bool is_boolean() const
Return whether the expression represents a Boolean.
bool is_false() const
Return whether the expression is a constant representing false.
bool is_zero() const
Return whether the expression is a constant representing 0.
typet & type()
Return the type of the expression.
bool is_constant() const
Return whether the expression is a constant.
float to_float() const
Note that calling from_float -> to_float can return different bit patterns for NaN.
double to_double() const
Note that calling from_double -> to_double can return different bit patterns for NaN.
const irept & find(const irep_idt &name) const
const irep_idt & get(const irep_idt &name) const
const irep_idt & id() const
std::vector< parametert > parameterst
const union_typet & follow_tag(const union_tag_typet &) const
Follow type tag of union type.
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
const typet & base_type() const
The type of the data what we point to.
Structure type, corresponds to C style structs.
const componentst & components() const
std::vector< componentt > componentst
The type of an expression, extends irept.
std::string type2java(const typet &type, const namespacet &ns)
std::string expr2java(const exprt &expr, const namespacet &ns)
std::string floating_point_to_java_string(float_type value)
Convert floating point number to a string without printing unnecessary zeros.
#define forall_expr(it, expr)
const code_function_callt & to_code_function_call(const goto_instruction_codet &code)
const std::string & id2string(const irep_idt &d)
Java-specific exprt subclasses.
const java_instanceof_exprt & to_java_instanceof_expr(const exprt &expr)
Cast an exprt to a java_instanceof_exprt.
Java-specific type qualifiers.
Representation of a constant Java string.
signedbv_typet java_int_type()
signedbv_typet java_byte_type()
signedbv_typet java_short_type()
floatbv_typet java_double_type()
floatbv_typet java_float_type()
c_bool_typet java_boolean_type()
unsignedbv_typet java_char_type()
signedbv_typet java_long_type()
const java_method_typet & to_java_method_type(const typet &type)
const std::string integer2string(const mp_integer &n, unsigned base)
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
static code_landingpadt & to_code_landingpad(codet &code)
const codet & to_code(const exprt &expr)
API to expression classes.
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.
const unary_exprt & to_unary_expr(const exprt &expr)
Cast an exprt to a unary_exprt.
const class_method_descriptor_exprt & to_class_method_descriptor_expr(const exprt &expr)
Cast an exprt to a class_method_descriptor_exprt.
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
const struct_tag_typet & to_struct_tag_type(const typet &type)
Cast a typet to a struct_tag_typet.
static void utf16_native_endian_to_java(const wchar_t ch, std::ostringstream &result, const std::locale &loc)
Escapes non-printable characters, whitespace except for spaces, double- and single-quotes and backsla...