File tree Expand file tree Collapse file tree 5 files changed +13
-22
lines changed Expand file tree Collapse file tree 5 files changed +13
-22
lines changed Original file line number Diff line number Diff line change @@ -377,13 +377,10 @@ bvt boolbvt::convert_symbol(const exprt &expr)
377
377
const typet &type=expr.type ();
378
378
std::size_t width=boolbv_width (type);
379
379
380
- bvt bv;
381
- bv.resize (width);
382
-
383
380
const irep_idt &identifier = expr.get (ID_identifier);
384
381
CHECK_RETURN (!identifier.empty ());
385
382
386
- map.get_literals (identifier, type, bv );
383
+ bvt bv = map.get_literals (identifier, type, width );
387
384
388
385
INVARIANT_WITH_DIAGNOSTICS (
389
386
std::all_of (
Original file line number Diff line number Diff line change @@ -57,8 +57,8 @@ bvt boolbvt::convert_index(const index_exprt &expr)
57
57
final_array.id () == ID_symbol || final_array.id () == ID_nondet_symbol)
58
58
{
59
59
std::size_t width = boolbv_width (array_type);
60
- bvt unused (width);
61
- map. get_literals ( final_array.get (ID_identifier), array_type, unused );
60
+ ( void )map. get_literals (
61
+ final_array.get (ID_identifier), array_type, width );
62
62
}
63
63
64
64
// make sure we have the index in the cache
@@ -77,8 +77,7 @@ bvt boolbvt::convert_index(const index_exprt &expr)
77
77
if (array.id () == ID_symbol || array.id () == ID_nondet_symbol)
78
78
{
79
79
std::size_t width = boolbv_width (array_type);
80
- bvt unused (width);
81
- map.get_literals (array.get (ID_identifier), array_type, unused);
80
+ (void )map.get_literals (array.get (ID_identifier), array_type, width);
82
81
}
83
82
84
83
// make sure we have the index in the cache
Original file line number Diff line number Diff line change @@ -38,10 +38,10 @@ void boolbv_mapt::show(std::ostream &out) const
38
38
out << pair.first << " =" << pair.second .get_value (prop) << ' \n ' ;
39
39
}
40
40
41
- void boolbv_mapt::get_literals (
41
+ const bvt & boolbv_mapt::get_literals (
42
42
const irep_idt &identifier,
43
43
const typet &type,
44
- bvt &literals )
44
+ std:: size_t width )
45
45
{
46
46
std::pair<mappingt::iterator, bool > result=
47
47
mapping.insert (std::pair<irep_idt, map_entryt>(
@@ -52,9 +52,9 @@ void boolbv_mapt::get_literals(
52
52
if (result.second )
53
53
{ // actually inserted
54
54
map_entry.type =type;
55
- map_entry.literal_map .reserve (literals. size () );
55
+ map_entry.literal_map .reserve (width );
56
56
57
- for (std::size_t bit = 0 ; bit < literals. size () ; ++bit)
57
+ for (std::size_t bit = 0 ; bit < width ; ++bit)
58
58
{
59
59
map_entry.literal_map .push_back (prop.new_variable ());
60
60
@@ -66,10 +66,10 @@ void boolbv_mapt::get_literals(
66
66
}
67
67
68
68
INVARIANT (
69
- map_entry.literal_map .size () == literals. size () ,
69
+ map_entry.literal_map .size () == width ,
70
70
" number of literals in the literal map shall equal the bitvector width" );
71
71
72
- literals = map_entry.literal_map ;
72
+ return map_entry.literal_map ;
73
73
}
74
74
75
75
void boolbv_mapt::set_literals (
Original file line number Diff line number Diff line change @@ -37,10 +37,10 @@ class boolbv_mapt
37
37
38
38
void show (std::ostream &out) const ;
39
39
40
- void get_literals (
40
+ const bvt & get_literals (
41
41
const irep_idt &identifier,
42
42
const typet &type,
43
- bvt &literals );
43
+ std:: size_t width );
44
44
45
45
void set_literals (
46
46
const irep_idt &identifier,
Original file line number Diff line number Diff line change @@ -231,12 +231,7 @@ bvt bv_pointerst::convert_pointer_type(const exprt &expr)
231
231
const irep_idt &identifier=to_symbol_expr (expr).get_identifier ();
232
232
const typet &type=expr.type ();
233
233
234
- bvt bv;
235
- bv.resize (bits);
236
-
237
- map.get_literals (identifier, type, bv);
238
-
239
- return bv;
234
+ return map.get_literals (identifier, type, bits);
240
235
}
241
236
else if (expr.id ()==ID_nondet_symbol)
242
237
{
You can’t perform that action at this time.
0 commit comments