83 if(has_this && it==arguments.begin())
106 unsigned &precedence)
110 if(full_type.
id()!=ID_struct)
115 std::string dest=
"{ ";
121 components.size() == src.
operands().size(),
122 "inconsistent number of components");
124 exprt::operandst::const_iterator o_it=src.
operands().begin();
129 for(
const auto &c : components)
132 c.type().id() != ID_code,
"struct member must not be of code type");
134 std::string tmp =
convert(*o_it);
141 if(last_size + 40 < dest.size())
144 last_size = dest.size();
152 irep_idt field_name = c.get_pretty_name();
153 if(field_name.
empty())
154 field_name = c.get_name();
169 unsigned &precedence)
171 if(src.
type().
id()==ID_c_bool)
185 else if(src.
type().
id()==ID_pointer)
196 const char16_t int_value = numeric_cast_v<char16_t>(src);
206 const mp_integer int_value = numeric_cast_v<mp_integer>(src);
207 std::string dest=
"(byte)";
214 const mp_integer int_value = numeric_cast_v<mp_integer>(src);
215 std::string dest=
"(short)";
222 const mp_integer int_value = numeric_cast_v<mp_integer>(src);
244 const std::string &declarator)
246 std::unique_ptr<qualifierst> clone = qualifiers.
clone();
248 new_qualifiers.
read(src);
250 const std::string d = declarator.empty() ? declarator : (
" " + declarator);
270 return q+
"boolean"+d;
273 else if(src.
id()==ID_code)
286 for(java_method_typet::parameterst::const_iterator it = parameters.begin();
287 it != parameters.end();
290 if(it!=parameters.begin())
298 if(!parameters.empty())
306 dest+=
" -> "+
convert(return_type);
323 return convert(instanceof_expr.tested_expr()) +
" instanceof " +
324 convert(instanceof_expr.target_type());
336 if(src.
get(ID_statement)==ID_java_new_array ||
337 src.
get(ID_statement)==ID_java_new_array_data)
341 std::string tmp_size=
360 std::string dest=
indent_str(indent)+
"delete ";
377 unsigned &precedence)
379 if(src.
id()==
"java-this")
384 if(src.
id()==ID_java_instanceof)
389 else if(src.
id()==ID_side_effect &&
390 (src.
get(ID_statement)==ID_java_new ||
391 src.
get(ID_statement)==ID_java_new_array ||
392 src.
get(ID_statement)==ID_java_new_array_data))
397 else if(src.
id()==ID_side_effect &&
398 src.
get(ID_statement)==ID_throw)
403 else if(src.
id()==ID_code &&
404 to_code(src).get_statement()==ID_exception_landingpad)
406 const exprt &catch_expr=
408 return "catch_landingpad("+
414 else if(src.
id()==ID_unassigned)
416 else if(src.
id()==
"pod_constructor")
417 return "pod_constructor";
418 else if(src.
id()==ID_virtual_function)
426 const auto &literal = expr_try_dynamic_cast<java_string_literal_exprt>(src))
442 if(statement==ID_java_new ||
443 statement==ID_java_new_array)
446 if(statement==ID_function_call)
std::string MetaString(const std::string &in)
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.
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_rec(const typet &src, const qualifierst &qualifiers, const std::string &declarator)
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)
virtual std::string convert_rec(const typet &src, const qualifierst &qualifiers, const std::string &declarator) override
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)
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 typet & follow(const typet &) const
Resolve type symbol to the type it points to.
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.
virtual std::unique_ptr< qualifierst > clone() const =0
virtual std::string as_string() const =0
virtual void read(const typet &src)=0
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.
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...