@@ -298,8 +298,7 @@ bool constant_propagator_domaint::valuest::is_constant(const exprt &expr) const
298
298
return false ;
299
299
300
300
if (expr.id ()==ID_symbol)
301
- if (replace_const.expr_map .find (to_symbol_expr (expr).get_identifier ())==
302
- replace_const.expr_map .end ())
301
+ if (!replace_const.replaces_symbol (to_symbol_expr (expr).get_identifier ()))
303
302
return false ;
304
303
305
304
if (expr.id ()==ID_index)
@@ -337,8 +336,7 @@ bool constant_propagator_domaint::valuest::is_constant_address_of(
337
336
// / Do not call this when iterating over replace_const.expr_map!
338
337
bool constant_propagator_domaint::valuest::set_to_top (const irep_idt &id)
339
338
{
340
- replace_symbolt::expr_mapt::size_type n_erased=
341
- replace_const.expr_map .erase (id);
339
+ const auto n_erased = replace_const.erase (id);
342
340
343
341
INVARIANT (n_erased==0 || !is_bottom, " bottom should have no elements at all" );
344
342
@@ -351,7 +349,7 @@ void constant_propagator_domaint::valuest::set_dirty_to_top(
351
349
const namespacet &ns)
352
350
{
353
351
typedef replace_symbolt::expr_mapt expr_mapt;
354
- expr_mapt &expr_map= replace_const.expr_map ;
352
+ expr_mapt &expr_map = replace_const.get_expr_map () ;
355
353
356
354
for (expr_mapt::iterator it=expr_map.begin ();
357
355
it!=expr_map.end ();)
@@ -377,19 +375,19 @@ void constant_propagator_domaint::valuest::output(
377
375
if (is_bottom)
378
376
{
379
377
out << " bottom\n " ;
380
- DATA_INVARIANT (replace_const. expr_map . empty (),
378
+ DATA_INVARIANT (is_empty (),
381
379
" If the domain is bottom, the map must be empty" );
382
380
return ;
383
381
}
384
382
385
383
INVARIANT (!is_bottom, " Have handled bottom" );
386
- if (replace_const. expr_map . empty ())
384
+ if (is_empty ())
387
385
{
388
386
out << " top\n " ;
389
387
return ;
390
388
}
391
389
392
- for (const auto &p : replace_const.expr_map )
390
+ for (const auto &p : replace_const.get_expr_map () )
393
391
{
394
392
out << ' ' << p.first << " =" << from_expr (ns, p.first , p.second ) << ' \n ' ;
395
393
}
@@ -424,20 +422,21 @@ bool constant_propagator_domaint::valuest::merge(const valuest &src)
424
422
425
423
bool changed=false ;
426
424
427
- replace_symbolt::expr_mapt &expr_map=replace_const.expr_map ;
428
- const replace_symbolt::expr_mapt &src_expr_map=src.replace_const .expr_map ;
429
-
430
425
// handle top
431
- if (src_expr_map. empty ())
426
+ if (src. is_empty ())
432
427
{
433
428
// change if it was not top
434
- changed=!expr_map. empty ();
429
+ changed = ! is_empty ();
435
430
436
431
set_to_top ();
437
432
438
433
return changed;
439
434
}
440
435
436
+ replace_symbolt::expr_mapt &expr_map = replace_const.get_expr_map ();
437
+ const replace_symbolt::expr_mapt &src_expr_map =
438
+ src.replace_const .get_expr_map ();
439
+
441
440
// remove those that are
442
441
// - different in src
443
442
// - do not exist in src
@@ -484,12 +483,12 @@ bool constant_propagator_domaint::valuest::meet(
484
483
485
484
bool changed=false ;
486
485
487
- for (const auto &m : src.replace_const .expr_map )
486
+ for (const auto &m : src.replace_const .get_expr_map () )
488
487
{
489
- replace_symbolt::expr_mapt::iterator
490
- c_it= replace_const.expr_map .find (m.first );
488
+ replace_symbolt::expr_mapt::const_iterator c_it =
489
+ replace_const.get_expr_map () .find (m.first );
491
490
492
- if (c_it!= replace_const.expr_map .end ())
491
+ if (c_it != replace_const.get_expr_map () .end ())
493
492
{
494
493
if (c_it->second !=m.second )
495
494
{
0 commit comments