@@ -170,14 +170,15 @@ bool ci_lazy_methodst::operator()(
170170 << " callsites)"
171171 << eom;
172172
173- for (const auto &callsite : virtual_callsites)
173+ std::unordered_set<exprt, irep_hash> unique_functions;
174+ for (const code_function_callt *virtual_callsite : virtual_callsites)
175+ unique_functions.insert (virtual_callsite->function ());
176+
177+ for (const exprt &function : unique_functions)
174178 {
175179 // This will also create a stub if a virtual callsite has no targets.
176180 get_virtual_method_targets (
177- *callsite,
178- instantiated_classes,
179- method_worklist2,
180- symbol_table);
181+ function, instantiated_classes, method_worklist2, symbol_table);
181182 }
182183 }
183184 while (any_new_methods);
@@ -403,21 +404,20 @@ void ci_lazy_methodst::gather_virtual_callsites(
403404
404405// / Find possible callees, excluding types that are not known to be
405406// / instantiated.
406- // / \param c: function call whose potential target functions should
407- // / be determined.
407+ // / \param called_function: virtual function call whose concrete function calls
408+ // / should be determined.
408409// / \param instantiated_classes: set of classes that can be instantiated. Any
409410// / potential callee not in this set will be ignored.
410411// / \param symbol_table: global symbol table
411412// / \param [out] callable_methods: Populated with all possible `c` callees,
412413// / taking `instantiated_classes` into account (virtual function overrides
413414// / defined on classes that are not 'needed' are ignored)
414415void ci_lazy_methodst::get_virtual_method_targets (
415- const code_function_callt &c ,
416+ const exprt &called_function ,
416417 const std::set<irep_idt> &instantiated_classes,
417418 std::vector<irep_idt> &callable_methods,
418419 symbol_tablet &symbol_table)
419420{
420- const auto &called_function=c.function ();
421421 PRECONDITION (called_function.id ()==ID_virtual_function);
422422
423423 const auto &call_class=called_function.get (ID_C_class);
0 commit comments