60 std::set<irep_idt> &visited)
const;
63 const irep_idt &component_name)
const;
82 const auto &vcall_source_loc=target->source_location;
85 assert(
function.
id()==ID_virtual_function);
98 if(functions.size()==1)
100 assert(target->is_function_call());
105 functions.begin()->symbol_expr;
113 t_final->source_location=vcall_source_loc;
115 t_final->make_skip();
126 const auto &base_classid=functions.back().class_id;
127 const auto &base_function_symbol=functions.back().symbol_expr;
131 std::map<irep_idt, goto_programt::targett> calls;
133 for(
auto it=functions.crbegin(), itend=functions.crend(); it!=itend; ++it)
136 auto insertit=calls.insert(
143 t1->source_location=vcall_source_loc;
144 if(!fun.symbol_expr.get_identifier().empty())
147 t1->make_function_call(code);
149 newcall.function()=fun.symbol_expr;
152 if(!
type_eq(newcall.arguments()[0].type(), need_type,
ns))
153 newcall.arguments()[0].make_typecast(need_type);
160 insertit.first->second=t1;
163 t3->source_location=vcall_source_loc;
169 if(fun.symbol_expr!=base_function_symbol)
173 t4->source_location=vcall_source_loc;
174 t4->make_goto(insertit.first->second,
equal_exprt(c_id1, c_id2));
188 const irep_idt property_class=it->source_location.get_property_class();
190 it->source_location=target->source_location;
191 it->function=target->function;
192 if(!property_class.
empty())
193 it->source_location.set_property_class(property_class);
195 it->source_location.set_comment(comment);
223 std::set<irep_idt> &visited)
const 229 for(
const auto &child : findit->second.children)
231 if(!visited.insert(child).second)
238 function.symbol_expr.set(ID_C_class, child);
242 function.symbol_expr=last_method_defn;
244 functions.push_back(
function);
248 function.symbol_expr,
256 const exprt &
function,
259 const irep_idt class_id=
function.get(ID_C_class);
260 const irep_idt component_name=
function.get(ID_component_name);
261 assert(!class_id.
empty());
272 root_function.class_id=c;
274 root_function.symbol_expr.set(ID_C_class, c);
286 if(root_function.class_id.empty())
289 root_function.class_id=class_id;
293 std::set<irep_idt> visited;
296 root_function.symbol_expr,
302 functions.push_back(root_function);
307 const irep_idt &component_name)
const 322 bool did_something=
false;
325 if(target->is_function_call())
342 return did_something;
347 bool did_something=
false;
349 for(goto_functionst::function_mapt::iterator f_it=
369 rvf(symbol_table, goto_functions);
bool type_eq(const typet &type1, const typet &type2, const namespacet &ns)
The type of an expression.
void operator()(goto_functionst &goto_functions)
void update()
Update all indices.
virtual bool lookup(const irep_idt &name, const symbolt *&symbol) const
targett add_instruction()
Adds an instruction at the end.
const std::string & id2string(const irep_idt &d)
remove_virtual_functionst(const symbol_tablet &_symbol_table, const goto_functionst &goto_functions)
pointer_typet pointer_type(const typet &subtype)
bool remove_virtual_functions(goto_programt &goto_program)
Remove Virtual Function (Method) Calls.
std::string comment(const rw_set_baset::entryt &entry, bool write)
symbol_tablet symbol_table
Symbol table entry.This is a symbol in the symbol table, stored in an object of type symbol_tablet...
A constant literal expression.
const irep_idt & id() const
class symbol_exprt symbol_expr() const
produces a symbol_exprt for a symbol
The boolean constant true.
void compute_location_numbers()
A reference into the symbol table.
exprt get_method(const irep_idt &class_id, const irep_idt &component_name) const
const symbol_tablet & symbol_table
std::vector< functiont > functionst
exprt get_class_identifier_field(const exprt &this_expr_in, const symbol_typet &suggested_type, const namespacet &ns)
functiont(const irep_idt &_class_id)
function_mapt function_map
The boolean constant false.
void get_functions(const exprt &, functionst &)
std::vector< irep_idt > idst
A specialization of goto_program_templatet over goto programs in which instructions have codet type...
void get_child_functions_rec(const irep_idt &, const symbol_exprt &, const irep_idt &, functionst &, std::set< irep_idt > &visited) const
Used by get_functions to track the most-derived parent that provides an override of a given function...
Base class for all expressions.
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast a generic exprt to a symbol_exprt.
#define Forall_goto_program_instructions(it, program)
void destructive_insert(const_targett target, goto_program_templatet< codeT, guardT > &p)
Inserts the given program at the given location.
Expression to hold a symbol (variable)
void destructive_append(goto_program_templatet< codeT, guardT > &p)
Appends the given program, which is destroyed.
Extract class identifier.
goto_functionst goto_functions
void remove_virtual_function(goto_programt &goto_program, goto_programt::targett target)
const code_function_callt & to_code_function_call(const codet &code)
instructionst::iterator targett
class_hierarchyt class_hierarchy