@@ -156,7 +156,7 @@ bool java_bytecode_languaget::parse(
156
156
{
157
157
status () << " JAR file without entry point: loading it all" << eom;
158
158
java_class_loader.load_entire_jar (path);
159
- for (const auto & kv : java_class_loader.jar_map .at (path).entries )
159
+ for (const auto & kv : java_class_loader.jar_map .at (path).entries )
160
160
main_jar_classes.push_back (kv.first );
161
161
}
162
162
else
@@ -201,10 +201,10 @@ Function: get_virtual_method_target
201
201
\*******************************************************************/
202
202
203
203
static irep_idt get_virtual_method_target (
204
- const std::set<irep_idt>& needed_classes,
205
- const irep_idt& call_basename,
206
- const irep_idt& classname,
207
- const symbol_tablet& symbol_table)
204
+ const std::set<irep_idt> & needed_classes,
205
+ const irep_idt & call_basename,
206
+ const irep_idt & classname,
207
+ const symbol_tablet & symbol_table)
208
208
{
209
209
// Program-wide, is this class ever instantiated?
210
210
if (!needed_classes.count (classname))
@@ -238,24 +238,24 @@ Function: get_virtual_method_target
238
238
\*******************************************************************/
239
239
240
240
static void get_virtual_method_targets (
241
- const code_function_callt& c,
242
- const std::set<irep_idt>& needed_classes,
243
- std::vector<irep_idt>& needed_methods,
244
- symbol_tablet& symbol_table,
245
- const class_hierarchyt& class_hierarchy)
241
+ const code_function_callt & c,
242
+ const std::set<irep_idt> & needed_classes,
243
+ std::vector<irep_idt> & needed_methods,
244
+ symbol_tablet & symbol_table,
245
+ const class_hierarchyt & class_hierarchy)
246
246
{
247
- const auto & called_function=c.function ();
247
+ const auto & called_function=c.function ();
248
248
assert (called_function.id ()==ID_virtual_function);
249
249
250
- const auto & call_class=called_function.get (ID_C_class);
250
+ const auto & call_class=called_function.get (ID_C_class);
251
251
assert (call_class!=irep_idt ());
252
- const auto & call_basename=called_function.get (ID_component_name);
252
+ const auto & call_basename=called_function.get (ID_component_name);
253
253
assert (call_basename!=irep_idt ());
254
254
255
255
auto old_size=needed_methods.size ();
256
256
257
257
auto child_classes=class_hierarchy.get_children_trans (call_class);
258
- for (const auto & child_class : child_classes)
258
+ for (const auto & child_class : child_classes)
259
259
{
260
260
auto child_method=
261
261
get_virtual_method_target (
@@ -288,8 +288,8 @@ static void get_virtual_method_targets(
288
288
break ;
289
289
else
290
290
{
291
- const auto & entry=findit->second ;
292
- if (entry.parents .size ()== 0 )
291
+ const auto & entry=findit->second ;
292
+ if (entry.parents .empty () )
293
293
break ;
294
294
else
295
295
parent_class_id=entry.parents [0 ];
@@ -325,12 +325,12 @@ Function: gather_virtual_callsites
325
325
\*******************************************************************/
326
326
327
327
static void gather_virtual_callsites (
328
- const exprt& e,
329
- std::vector<const code_function_callt*>& result)
328
+ const exprt & e,
329
+ std::vector<const code_function_callt *> & result)
330
330
{
331
331
if (e.id ()!=ID_code)
332
332
return ;
333
- const codet& c=to_code (e);
333
+ const codet & c=to_code (e);
334
334
if (c.get_statement ()==ID_function_call &&
335
335
to_code_function_call (c).function ().id ()==ID_virtual_function)
336
336
result.push_back (&to_code_function_call (c));
@@ -354,13 +354,13 @@ Function: gather_needed_globals
354
354
\*******************************************************************/
355
355
356
356
static void gather_needed_globals (
357
- const exprt& e,
358
- const symbol_tablet& symbol_table,
359
- symbol_tablet& needed)
357
+ const exprt & e,
358
+ const symbol_tablet & symbol_table,
359
+ symbol_tablet & needed)
360
360
{
361
361
if (e.id ()==ID_symbol)
362
362
{
363
- const auto & sym=symbol_table.lookup (to_symbol_expr (e).get_identifier ());
363
+ const auto & sym=symbol_table.lookup (to_symbol_expr (e).get_identifier ());
364
364
if (sym.is_static_lifetime )
365
365
needed.add (sym);
366
366
}
@@ -387,12 +387,12 @@ Function: gather_field_types
387
387
\*******************************************************************/
388
388
389
389
static void gather_field_types (
390
- const typet& class_type,
391
- const namespacet& ns,
392
- std::set<irep_idt>& needed_classes)
390
+ const typet & class_type,
391
+ const namespacet & ns,
392
+ std::set<irep_idt> & needed_classes)
393
393
{
394
- const auto & underlying_type=to_struct_type (ns.follow (class_type));
395
- for (const auto & field : underlying_type.components ())
394
+ const auto & underlying_type=to_struct_type (ns.follow (class_type));
395
+ for (const auto & field : underlying_type.components ())
396
396
{
397
397
if (field.type ().id ()==ID_struct || field.type ().id ()==ID_symbol)
398
398
gather_field_types (field.type (), ns, needed_classes);
@@ -401,7 +401,7 @@ static void gather_field_types(
401
401
// Skip array primitive pointers, for example:
402
402
if (field.type ().subtype ().id ()!=ID_symbol)
403
403
continue ;
404
- const auto & field_classid=
404
+ const auto & field_classid=
405
405
to_symbol_type (field.type ().subtype ()).get_identifier ();
406
406
if (needed_classes.insert (field_classid).second )
407
407
gather_field_types (field.type ().subtype (), ns, needed_classes);
@@ -411,7 +411,7 @@ static void gather_field_types(
411
411
412
412
/* ******************************************************************\
413
413
414
- Function: initialise_needed_classes
414
+ Function: initialize_needed_classes
415
415
416
416
Inputs: `entry_points`: list of fully-qualified function names that
417
417
we should assume are reachable
@@ -426,26 +426,26 @@ Function: initialise_needed_classes
426
426
427
427
\*******************************************************************/
428
428
429
- static void initialise_needed_classes (
430
- const std::vector<irep_idt>& entry_points,
431
- const namespacet& ns,
432
- const class_hierarchyt& ch,
433
- std::set<irep_idt>& needed_classes)
429
+ static void initialize_needed_classes (
430
+ const std::vector<irep_idt> & entry_points,
431
+ const namespacet & ns,
432
+ const class_hierarchyt & ch,
433
+ std::set<irep_idt> & needed_classes)
434
434
{
435
- for (const auto & mname : entry_points)
435
+ for (const auto & mname : entry_points)
436
436
{
437
- const auto & symbol=ns.lookup (mname);
438
- const auto & mtype=to_code_type (symbol.type );
439
- for (const auto & param : mtype.parameters ())
437
+ const auto & symbol=ns.lookup (mname);
438
+ const auto & mtype=to_code_type (symbol.type );
439
+ for (const auto & param : mtype.parameters ())
440
440
{
441
441
if (param.type ().id ()==ID_pointer)
442
442
{
443
- const auto & param_classid=
443
+ const auto & param_classid=
444
444
to_symbol_type (param.type ().subtype ()).get_identifier ();
445
445
std::vector<irep_idt> class_and_parents=
446
446
ch.get_parents_trans (param_classid);
447
447
class_and_parents.push_back (param_classid);
448
- for (const auto & classid : class_and_parents)
448
+ for (const auto & classid : class_and_parents)
449
449
needed_classes.insert (classid);
450
450
gather_field_types (param.type ().subtype (), ns, needed_classes);
451
451
}
@@ -534,11 +534,11 @@ bool java_bytecode_languaget::do_ci_lazy_method_conversion(
534
534
reachable_classes.push_back (main_class);
535
535
else
536
536
reachable_classes=main_jar_classes;
537
- for (const auto & classname : reachable_classes)
537
+ for (const auto & classname : reachable_classes)
538
538
{
539
- const auto & methods=
539
+ const auto & methods=
540
540
java_class_loader.class_map .at (classname).parsed_class .methods ;
541
- for (const auto & method : methods)
541
+ for (const auto & method : methods)
542
542
{
543
543
const irep_idt methodid=" java::" +id2string (classname)+" ." +
544
544
id2string (method.name )+" :" +
@@ -551,7 +551,7 @@ bool java_bytecode_languaget::do_ci_lazy_method_conversion(
551
551
method_worklist2.push_back (main_function.main_function .name );
552
552
553
553
std::set<irep_idt> needed_classes;
554
- initialise_needed_classes (
554
+ initialize_needed_classes (
555
555
method_worklist2,
556
556
namespacet (symbol_table),
557
557
ch,
@@ -567,7 +567,7 @@ bool java_bytecode_languaget::do_ci_lazy_method_conversion(
567
567
while (method_worklist2.size ()!=0 )
568
568
{
569
569
std::swap (method_worklist1, method_worklist2);
570
- for (const auto & mname : method_worklist1)
570
+ for (const auto & mname : method_worklist1)
571
571
{
572
572
if (!methods_already_populated.insert (mname).second )
573
573
continue ;
@@ -578,7 +578,7 @@ bool java_bytecode_languaget::do_ci_lazy_method_conversion(
578
578
continue ;
579
579
}
580
580
debug () << " CI lazy methods: elaborate " << mname << eom;
581
- const auto & parsed_method=findit->second ;
581
+ const auto & parsed_method=findit->second ;
582
582
java_bytecode_convert_method (
583
583
*parsed_method.first ,
584
584
*parsed_method.second ,
@@ -604,7 +604,7 @@ bool java_bytecode_languaget::do_ci_lazy_method_conversion(
604
604
<< " callsites)"
605
605
<< eom;
606
606
607
- for (const auto & callsite : virtual_callsites)
607
+ for (const auto & callsite : virtual_callsites)
608
608
{
609
609
// This will also create a stub if a virtual callsite has no targets.
610
610
get_virtual_method_targets (*callsite, needed_classes, method_worklist2,
@@ -616,7 +616,7 @@ bool java_bytecode_languaget::do_ci_lazy_method_conversion(
616
616
// Remove symbols for methods that were declared but never used:
617
617
symbol_tablet keep_symbols;
618
618
619
- for (const auto & sym : symbol_table.symbols )
619
+ for (const auto & sym : symbol_table.symbols )
620
620
{
621
621
if (sym.second .is_static_lifetime )
622
622
continue ;
0 commit comments