@@ -121,7 +121,7 @@ bool ci_lazy_methodst::operator()(
121
121
}
122
122
123
123
std::unordered_set<irep_idt> methods_already_populated;
124
- std::vector< const code_function_callt *> virtual_callsites ;
124
+ std::unordered_set<exprt, irep_hash> virtual_function_calls ;
125
125
126
126
bool any_new_methods = true ;
127
127
while (any_new_methods)
@@ -148,8 +148,7 @@ bool ci_lazy_methodst::operator()(
148
148
continue ;
149
149
}
150
150
gather_virtual_callsites (
151
- symbol_table.lookup_ref (mname).value ,
152
- virtual_callsites);
151
+ symbol_table.lookup_ref (mname).value , virtual_function_calls);
153
152
any_new_methods=true ;
154
153
}
155
154
}
@@ -158,15 +157,9 @@ bool ci_lazy_methodst::operator()(
158
157
// possible virtual function call targets:
159
158
160
159
debug () << " CI lazy methods: add virtual method targets ("
161
- << virtual_callsites.size ()
162
- << " callsites)"
163
- << eom;
160
+ << virtual_function_calls.size () << " callsites)" << eom;
164
161
165
- std::unordered_set<exprt, irep_hash> unique_functions;
166
- for (const code_function_callt *virtual_callsite : virtual_callsites)
167
- unique_functions.insert (virtual_callsite->function ());
168
-
169
- for (const exprt &function : unique_functions)
162
+ for (const exprt &function : virtual_function_calls)
170
163
{
171
164
// This will also create a stub if a virtual callsite has no targets.
172
165
get_virtual_method_targets (
@@ -376,15 +369,15 @@ void ci_lazy_methodst::initialize_instantiated_classes_from_pointer(
376
369
// / e that calls a virtual function.
377
370
void ci_lazy_methodst::gather_virtual_callsites (
378
371
const exprt &e,
379
- std::vector< const code_function_callt * > &result)
372
+ std::unordered_set<exprt, irep_hash > &result)
380
373
{
381
374
if (e.id ()!=ID_code)
382
375
return ;
383
376
const codet &c=to_code (e);
384
377
if (c.get_statement ()==ID_function_call &&
385
378
to_code_function_call (c).function ().id ()==ID_virtual_function)
386
379
{
387
- result.push_back (& to_code_function_call (c));
380
+ result.insert ( to_code_function_call (c). function ( ));
388
381
}
389
382
else
390
383
{
0 commit comments