@@ -170,14 +170,15 @@ bool ci_lazy_methodst::operator()(
170
170
<< " callsites)"
171
171
<< eom;
172
172
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)
174
178
{
175
179
// This will also create a stub if a virtual callsite has no targets.
176
180
get_virtual_method_targets (
177
- *callsite,
178
- instantiated_classes,
179
- method_worklist2,
180
- symbol_table);
181
+ function, instantiated_classes, method_worklist2, symbol_table);
181
182
}
182
183
}
183
184
while (any_new_methods);
@@ -403,21 +404,20 @@ void ci_lazy_methodst::gather_virtual_callsites(
403
404
404
405
// / Find possible callees, excluding types that are not known to be
405
406
// / 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.
408
409
// / \param instantiated_classes: set of classes that can be instantiated. Any
409
410
// / potential callee not in this set will be ignored.
410
411
// / \param symbol_table: global symbol table
411
412
// / \param [out] callable_methods: Populated with all possible `c` callees,
412
413
// / taking `instantiated_classes` into account (virtual function overrides
413
414
// / defined on classes that are not 'needed' are ignored)
414
415
void ci_lazy_methodst::get_virtual_method_targets (
415
- const code_function_callt &c ,
416
+ const exprt &called_function ,
416
417
const std::set<irep_idt> &instantiated_classes,
417
418
std::vector<irep_idt> &callable_methods,
418
419
symbol_tablet &symbol_table)
419
420
{
420
- const auto &called_function=c.function ();
421
421
PRECONDITION (called_function.id ()==ID_virtual_function);
422
422
423
423
const auto &call_class=called_function.get (ID_C_class);
0 commit comments