Skip to content

Commit 2b2a841

Browse files
author
Lukasz A.J. Wrona
committed
Convert display_index_set to a free function
1 parent 9fff116 commit 2b2a841

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

src/solvers/refinement/string_refinement.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,29 +96,34 @@ string_refinementt::string_refinementt(const infot &info):
9696
string_refinementt(info, validate(info)) { }
9797

9898
/// display the current index set, for debugging
99-
void string_refinementt::display_index_set()
99+
static void display_index_set(
100+
const messaget& message,
101+
const namespacet& ns,
102+
const std::map<exprt, std::set<exprt>>& current_index_set,
103+
const std::map<exprt, std::set<exprt>>& index_set)
100104
{
101105
std::size_t count=0;
102106
std::size_t count_current=0;
103107
for(const auto &i : index_set)
104108
{
105109
const exprt &s=i.first;
106-
debug() << "IS(" << from_expr(ns, "", s) << ")=={" << eom;
110+
message.debug() << "IS(" << from_expr(ns, "", s) << ")=={" << message.eom;
107111

108112
for(auto j : i.second)
109113
{
110-
if(current_index_set[i.first].find(j)!=current_index_set[i.first].end())
114+
const auto it=current_index_set.find(i.first);
115+
if(it!=current_index_set.end() && it->second.find(j)!=it->second.end())
111116
{
112117
count_current++;
113-
debug() << "**";
118+
message.debug() << "**";
114119
}
115-
debug() << " " << from_expr(ns, "", j) << ";" << eom;
120+
message.debug() << " " << from_expr(ns, "", j) << ";" << message.eom;
116121
count++;
117122
}
118-
debug() << "}" << eom;
123+
message.debug() << "}" << message.eom;
119124
}
120-
debug() << count << " elements in index set (" << count_current
121-
<< " newly added)" << eom;
125+
message.debug() << count << " elements in index set (" << count_current
126+
<< " newly added)" << message.eom;
122127
}
123128

124129
/// compute the index set for all formulas, instantiate the formulas with the
@@ -592,7 +597,7 @@ decision_proceduret::resultt string_refinementt::dec_solve()
592597
}
593598
}
594599

595-
display_index_set();
600+
display_index_set(*this, ns, current_index_set, index_set);
596601
debug()<< "instantiating NOT_CONTAINS constraints" << eom;
597602
for(unsigned i=0; i<not_contains_axioms.size(); i++)
598603
{

src/solvers/refinement/string_refinement.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ class string_refinementt final: public bv_refinementt
9999

100100
void add_equivalence(const irep_idt & lhs, const exprt & rhs);
101101

102-
void display_index_set();
103-
104102
void add_lemma(const exprt &lemma,
105103
bool simplify=true,
106104
bool add_to_index_set=true);

0 commit comments

Comments
 (0)