@@ -292,8 +292,7 @@ bool constant_propagator_domaint::valuest::is_constant(const exprt &expr) const
292
292
return false ;
293
293
294
294
if (expr.id ()==ID_symbol)
295
- if (replace_const.expr_map .find (to_symbol_expr (expr).get_identifier ())==
296
- replace_const.expr_map .end ())
295
+ if (!replace_const.replaces_symbol (to_symbol_expr (expr).get_identifier ()))
297
296
return false ;
298
297
299
298
if (expr.id ()==ID_index)
@@ -331,8 +330,7 @@ bool constant_propagator_domaint::valuest::is_constant_address_of(
331
330
// / Do not call this when iterating over replace_const.expr_map!
332
331
bool constant_propagator_domaint::valuest::set_to_top (const irep_idt &id)
333
332
{
334
- replace_symbolt::expr_mapt::size_type n_erased=
335
- replace_const.expr_map .erase (id);
333
+ const auto n_erased = replace_const.erase (id);
336
334
337
335
INVARIANT (n_erased==0 || !is_bottom, " bottom should have no elements at all" );
338
336
@@ -345,7 +343,7 @@ void constant_propagator_domaint::valuest::set_dirty_to_top(
345
343
const namespacet &ns)
346
344
{
347
345
typedef replace_symbolt::expr_mapt expr_mapt;
348
- expr_mapt &expr_map= replace_const.expr_map ;
346
+ expr_mapt &expr_map = replace_const.get_expr_map () ;
349
347
350
348
for (expr_mapt::iterator it=expr_map.begin ();
351
349
it!=expr_map.end ();)
@@ -371,19 +369,19 @@ void constant_propagator_domaint::valuest::output(
371
369
if (is_bottom)
372
370
{
373
371
out << " bottom\n " ;
374
- DATA_INVARIANT (replace_const. expr_map . empty (),
372
+ DATA_INVARIANT (is_empty (),
375
373
" If the domain is bottom, the map must be empty" );
376
374
return ;
377
375
}
378
376
379
377
INVARIANT (!is_bottom, " Have handled bottom" );
380
- if (replace_const. expr_map . empty ())
378
+ if (is_empty ())
381
379
{
382
380
out << " top\n " ;
383
381
return ;
384
382
}
385
383
386
- for (const auto &p : replace_const.expr_map )
384
+ for (const auto &p : replace_const.get_expr_map () )
387
385
{
388
386
out << ' ' << p.first << " =" << from_expr (ns, p.first , p.second ) << ' \n ' ;
389
387
}
@@ -418,20 +416,21 @@ bool constant_propagator_domaint::valuest::merge(const valuest &src)
418
416
419
417
bool changed=false ;
420
418
421
- replace_symbolt::expr_mapt &expr_map=replace_const.expr_map ;
422
- const replace_symbolt::expr_mapt &src_expr_map=src.replace_const .expr_map ;
423
-
424
419
// handle top
425
- if (src_expr_map. empty ())
420
+ if (src. is_empty ())
426
421
{
427
422
// change if it was not top
428
- changed=!expr_map. empty ();
423
+ changed = ! is_empty ();
429
424
430
425
set_to_top ();
431
426
432
427
return changed;
433
428
}
434
429
430
+ replace_symbolt::expr_mapt &expr_map = replace_const.get_expr_map ();
431
+ const replace_symbolt::expr_mapt &src_expr_map =
432
+ src.replace_const .get_expr_map ();
433
+
435
434
// remove those that are
436
435
// - different in src
437
436
// - do not exist in src
@@ -476,12 +475,12 @@ bool constant_propagator_domaint::valuest::meet(const valuest &src)
476
475
477
476
bool changed=false ;
478
477
479
- for (const auto &m : src.replace_const .expr_map )
478
+ for (const auto &m : src.replace_const .get_expr_map () )
480
479
{
481
- replace_symbolt::expr_mapt::iterator
482
- c_it= replace_const.expr_map .find (m.first );
480
+ replace_symbolt::expr_mapt::const_iterator c_it =
481
+ replace_const.get_expr_map () .find (m.first );
483
482
484
- if (c_it!= replace_const.expr_map .end ())
483
+ if (c_it != replace_const.get_expr_map () .end ())
485
484
{
486
485
if (c_it->second !=m.second )
487
486
{
0 commit comments