Skip to content

Commit 0c26a53

Browse files
author
Daniel Kroening
committed
let_count_idt is now a struct
1 parent e0a5142 commit 0c26a53

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

src/solvers/smt2/smt2_conv.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -4759,12 +4759,12 @@ exprt smt2_convt::letify_rec(
47594759
exprt current=let_order[i];
47604760
assert(map.find(current)!=map.end());
47614761

4762-
if(map.find(current)->second.first<LET_COUNT)
4762+
if(map.find(current)->second.count < LET_COUNT)
47634763
return letify_rec(expr, let_order, map, i+1);
47644764

47654765
let_exprt let;
47664766

4767-
let.symbol() = map.find(current)->second.second;
4767+
let.symbol() = map.find(current)->second.let_symbol;
47684768
let.value() = substitute_let(current, map);
47694769
let.where() = letify_rec(expr, let_order, map, i+1);
47704770

@@ -4781,7 +4781,7 @@ void smt2_convt::collect_bindings(
47814781
if(it!=map.end())
47824782
{
47834783
let_count_idt &count_id=it->second;
4784-
++(count_id.first);
4784+
++(count_id.count);
47854785
return;
47864786
}
47874787

@@ -4797,7 +4797,7 @@ void smt2_convt::collect_bindings(
47974797
symbol_exprt let=
47984798
symbol_exprt("_let_"+std::to_string(++let_id_count), expr.type());
47994799

4800-
map.insert(std::make_pair(expr, std::make_pair(1, let)));
4800+
map.insert(std::make_pair(expr, let_count_idt(1, let)));
48014801

48024802
let_order.push_back(expr);
48034803
}

src/solvers/smt2/smt2_conv.h

+13-4
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,17 @@ class smt2_convt:public prop_convt
170170
void find_symbols_rec(const typet &type, std::set<irep_idt> &recstack);
171171

172172
// letification
173-
typedef std::pair<unsigned, symbol_exprt> let_count_idt;
173+
struct let_count_idt
174+
{
175+
let_count_idt(std::size_t _count, const symbol_exprt &_let_symbol)
176+
: count(_count), let_symbol(_let_symbol)
177+
{
178+
}
179+
180+
std::size_t count;
181+
symbol_exprt let_symbol;
182+
};
183+
174184
typedef std::unordered_map<exprt, let_count_idt, irep_hash> seen_expressionst;
175185
unsigned let_id_count;
176186
static const unsigned LET_COUNT=2;
@@ -185,10 +195,9 @@ class smt2_convt:public prop_convt
185195
void operator()(exprt &expr)
186196
{
187197
seen_expressionst::const_iterator it=let_map.find(expr);
188-
if(it!=let_map.end() &&
189-
it->second.first>=LET_COUNT)
198+
if(it != let_map.end() && it->second.count >= LET_COUNT)
190199
{
191-
symbol_exprt symb=it->second.second;
200+
const symbol_exprt &symb = it->second.let_symbol;
192201
expr=symb;
193202
}
194203
}

0 commit comments

Comments
 (0)