30 bool _assume_non_null,
41 const typet &expected_type,
46 unsigned insert_before_index,
48 bool update_in_place);
82 const typet &expected_type,
87 const unsigned insert_before_index,
89 const bool update_in_place)
96 expected_type.
id() == ID_pointer,
97 "Nondet initializer result type: expected a pointer",
104 const exprt cast_ptr =
107 exprt to_init = cast_ptr;
135 auto insert_position = parent_block.
statements().begin();
136 std::advance(insert_position, insert_before_index);
158 for(
auto ¶meter : required_type.
parameters())
160 if(parameter.get_identifier().empty())
165 synthesized_source_location,
169 parameter.set_base_name(parameter_symbol.
base_name);
170 parameter.set_identifier(parameter_symbol.
name);
180 const auto &this_argument = required_type.
parameters()[0];
181 const typet &this_type = this_argument.type();
185 synthesized_source_location,
190 init_symbol_expression,
191 symbol_exprt(this_argument.get_identifier(), this_type));
193 new_instructions.
add(get_argument);
196 init_symbol_expression,
197 synthesized_source_location,
210 required_return_type,
212 synthesized_source_location,
216 if(to_return_symbol.
type.
id() != ID_pointer)
235 required_return_type,
237 synthesized_source_location,
247 symbol.
value = new_instructions;
257 sym.
type.
id() == ID_code &&
264 "java::java.lang.Object.monitorenter:(Ljava/lang/Object;)V" &&
266 "java::java.lang.Object.monitorexit:(Ljava/lang/Object;)V")
275 bool assume_non_null,
280 symbol_table, assume_non_null, object_factory_parameters, message_handler);
296 bool assume_non_null,
306 std::vector<irep_idt> identifiers;
307 identifiers.reserve(symbol_table.
symbols.size());
308 for(
const auto &symbol : symbol_table)
309 identifiers.push_back(symbol.first);
312 symbol_table, assume_non_null, object_factory_parameters, message_handler);
314 for(
const auto &identifier : identifiers)
@ DYNAMIC
Allocate dynamic objects (using ALLOCATE)
@ AUTOMATIC_LOCAL
Allocate local objects with automatic lifetime.
A codet representing sequential composition of program statements.
void add(const codet &code)
code_operandst & statements()
A codet representing an assignment in the program.
codet representation of a "return from a function" statement.
const typet & return_type() const
bool get_is_constructor() const
const parameterst & parameters() const
Operator to dereference a pointer.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
source_locationt & add_source_location()
const irep_idt & id() const
void check_method_stub(const irep_idt &)
Replaces sym with a function stub per the function above if it is of suitable type.
message_handlert & message_handler
const java_object_factory_parameterst & object_factory_parameters
symbol_table_baset & symbol_table
java_simple_method_stubst(symbol_table_baset &_symbol_table, bool _assume_non_null, const java_object_factory_parameterst &_object_factory_parameters, message_handlert &_message_handler)
void create_method_stub_at(const typet &expected_type, const exprt &ptr, const source_locationt &loc, const irep_idt &function_id, code_blockt &parent_block, unsigned insert_before_index, bool is_constructor, bool update_in_place)
Nondet-initialize an object, including allocating referees for reference fields and nondet-initialisi...
void create_method_stub(symbolt &symbol)
Replaces sym's value with an opaque method stub.
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
void set_function(const irep_idt &function)
Expression to hold a symbol (variable)
The symbol table base class interface.
symbolt & get_writeable_ref(const irep_idt &name)
Find a symbol in the symbol table for read-write access.
const symbolst & symbols
Read-only field, used to look up symbols given their names.
const symbolt & lookup_ref(const irep_idt &name) const
Find a symbol in the symbol table for read-only access.
irep_idt base_name
Base (non-scoped) name.
class symbol_exprt symbol_expr() const
Produces a symbol_exprt for a symbol.
typet type
Type of symbol.
irep_idt name
The unique identifier.
exprt value
Initial value of symbol.
The type of an expression, extends irept.
#define INVARIANT_WITH_IREP(CONDITION, DESCRIPTION, IREP)
Equivalent to INVARIANT_STRUCTURED(CONDITION, invariant_failedt, pretty_print_invariant_with_irep(IRE...
static bool is_constructor(const irep_idt &method_name)
static std::unordered_set< irep_idt > init_symbol(const symbolt &sym, code_blockt &code_block, symbol_table_baset &symbol_table, const source_locationt &source_location, bool assume_init_pointers_not_null, const java_object_factory_parameterst &object_factory_parameters, const select_pointer_typet &pointer_type_selector, bool string_refinement_enabled, message_handlert &message_handler)
void gen_nondet_init(const exprt &expr, code_blockt &init_code, symbol_table_baset &symbol_table, const source_locationt &loc, bool skip_classid, lifetimet lifetime, const java_object_factory_parameterst &object_factory_parameters, const select_pointer_typet &pointer_type_selector, update_in_placet update_in_place, message_handlert &log)
Initializes a primitive-typed or reference-typed object tree rooted at expr, allocating child objects...
This module is responsible for the synthesis of code (in the form of a sequence of codet statements) ...
exprt make_clean_pointer_cast(const exprt &rawptr, const pointer_typet &target_type, const namespacet &ns)
empty_typet java_void_type()
const java_method_typet & to_java_method_type(const typet &type)
symbolt & fresh_java_symbol(const typet &type, const std::string &basename_prefix, const source_locationt &source_location, const irep_idt &function_name, symbol_table_baset &symbol_table)
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
void java_generate_simple_method_stub(const irep_idt &function_name, symbol_table_baset &symbol_table, bool assume_non_null, const java_object_factory_parameterst &object_factory_parameters, message_handlert &message_handler)
void java_generate_simple_method_stubs(symbol_table_baset &symbol_table, bool assume_non_null, const java_object_factory_parameterst &object_factory_parameters, message_handlert &message_handler)
Generates function stubs for most undefined functions in the symbol table, except as forbidden in jav...
Java simple opaque stub generation.
irep_idt function_id
Function id, used as a prefix for identifiers of temporaries.
size_t min_null_tree_depth
To force a certain depth of non-null objects.