28 main_arguments.resize(parameters.size());
30 for(std::size_t param_number=0;
31 param_number<parameters.size();
38 main_arguments[param_number]=
48 return main_arguments;
56 bool has_return_value=
62 codet output(ID_output);
82 for(
const auto &p : parameters)
84 if(p.get_identifier().empty())
87 irep_idt identifier=p.get_identifier();
91 if(symbol.
type.
id()==ID_pointer)
93 codet output(ID_output);
126 std::list<irep_idt> matches;
131 symbol_tablet::symbolst::const_iterator s_it=
132 symbol_table.
symbols.find(it->second);
134 if(s_it==symbol_table.
symbols.end())
137 if(s_it->second.type.id()==ID_code)
138 matches.push_back(it->second);
149 if(matches.size()>=2)
157 main_symbol=matches.front();
163 symbol_tablet::symbolst::const_iterator s_it=
164 symbol_table.
symbols.find(main_symbol);
166 if(s_it==symbol_table.
symbols.end())
169 const symbolt &symbol=s_it->second;
205 symbol_tablet::symbolst::const_iterator init_it=
208 if(init_it==symbol_table.
symbols.end())
219 call_init.
function()=init_it->second.symbol_expr();
234 return_symbol.
mode=ID_C;
236 return_symbol.
name=
"return'";
240 symbol_table.
add(return_symbol);
247 if(symbol.
name==ID_main)
249 if(parameters.empty())
253 else if(parameters.size()==2 || parameters.size()==3)
267 init_code.move_to_operands(assumption);
281 init_code.move_to_operands(assumption);
286 codet input(ID_input);
294 if(parameters.size()==3)
301 if(envp_size_symbol.
type.
id()==ID_signedbv)
305 else if(envp_size_symbol.
type.
id()==ID_unsignedbv)
315 envp_size_symbol.
symbol_expr(), ID_le, max_minus_one);
318 init_code.move_to_operands(assumption);
351 index_expr.
set(
"bounds_check",
false);
353 init_code.copy_to_operands(
code_assignt(index_expr, null));
356 if(parameters.size()==3)
368 index_expr.
set(
"bounds_check",
false);
373 init_code.move_to_operands(assumption2);
379 if(parameters.size()==3)
384 exprt &op0=operands[0];
385 exprt &op1=operands[1];
390 const exprt &arg1=parameters[1];
400 index_expr.
set(
"bounds_check",
false);
406 if(parameters.size()==3)
409 exprt &op2=operands[2];
411 const exprt &arg2=parameters[2];
437 init_code.move_to_operands(call_main);
451 if(!symbol_table.
insert(std::move(new_symbol)).second)
void record_function_outputs(const symbolt &function, code_blockt &init_code, symbol_tablet &symbol_table)
irep_idt name
The unique identifier.
struct configt::ansi_ct ansi_c
A generic base class for relations, i.e., binary predicates.
const std::string & id2string(const irep_idt &d)
pointer_typet pointer_type(const typet &subtype)
const signedbv_typet & to_signedbv_type(const typet &type)
Cast a generic typet to a signedbv_typet.
irep_idt mode
Language mode.
const code_typet & to_code_type(const typet &type)
Cast a generic typet to a code_typet.
const symbol_base_mapt & symbol_base_map
Goto Programs with Functions.
void move_to_operands(exprt &expr)
The null pointer constant.
std::vector< parametert > parameterst
exprt value
Initial value of symbol.
bool static_lifetime_init(symbol_tablet &symbol_table, const source_locationt &source_location, message_handlert &message_handler)
Symbol table entry.This is a symbol in the symbol table, stored in an object of type symbol_tablet...
static mstreamt & eom(mstreamt &m)
exprt c_nondet_symbol_factory(code_blockt &init_code, symbol_tablet &symbol_table, const irep_idt base_name, const typet &type, const source_locationt &loc, bool allow_null)
Creates a symbol and generates code so that it can vary over all possible values for its type...
const irep_idt & id() const
const irep_idt & get_base_name() const
class symbol_exprt symbol_expr() const
produces a symbol_exprt for a symbol
exprt::operandst build_function_environment(const code_typet::parameterst ¶meters, code_blockt &init_code, symbol_tablet &symbol_table)
#define INITIALIZE_FUNCTION
bool generate_ansi_c_start_function(const symbolt &symbol, symbol_tablet &symbol_table, message_handlert &message_handler)
Generate a _start function for a specific function.
Internally generated symbol table entryThis is a symbol generated as part of translation to or modifi...
#define PRECONDITION(CONDITION)
virtual void set_message_handler(message_handlert &_message_handler)
bool ansi_c_entry_point(symbol_tablet &symbol_table, message_handlert &message_handler)
mp_integer largest() const
bitvector_typet index_type()
dstringt has one field, an unsigned integer no which is an index into a static table of strings...
Operator to return the address of an object.
std::vector< exprt > operandst
const unsignedbv_typet & to_unsignedbv_type(const typet &type)
Cast a generic typet to an unsignedbv_typet.
An assumption, which must hold in subsequent code.
typet type
Type of symbol.
source_locationt location
Source code location of definition of symbol.
mp_integer largest() const
static irep_idt entry_point()
#define forall_symbol_base_map(it, expr, base_name)
Base class for all expressions.
const parameterst & parameters() const
irep_idt base_name
Base (non-scoped) name.
std::string to_string(const string_constraintt &expr)
Used for debug printing.
const source_locationt & source_location() const
source_locationt & add_source_location()
bool add(const symbolt &symbol)
Add a new symbol to the symbol table.
const pointer_typet & to_pointer_type(const typet &type)
Cast a generic typet to a pointer_typet.
goto_programt coverage_criteriont message_handlert & message_handler
A statement in a programming language.
const typet & subtype() const
const symbolt * lookup(const irep_idt &name) const
Find a symbol in the symbol table for read-only access.
const typet & return_type() const
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See namespace_baset::lookup().
void set(const irep_namet &name, const irep_idt &value)
virtual std::pair< symbolt &, bool > insert(symbolt symbol) override
Author: Diffblue Ltd.