Skip to content

Commit 1741c6e

Browse files
Adapt debugging function for cleaned-up generator
Some functions that were used for debugging have been remove from string constraint generator. We adapt to that by adding a vector tracking created symbols when the DEBUG flag is active.
1 parent 4350b1e commit 1741c6e

File tree

3 files changed

+14
-16
lines changed

3 files changed

+14
-16
lines changed

src/solvers/refinement/string_constraint_generator.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ class symbol_generatort final
3737

3838
private:
3939
unsigned symbol_count = 0;
40+
41+
#ifdef DEBUG
42+
public:
43+
/// Keep track of created symbols, for debugging purposes.
44+
std::vector<symbol_exprt> created_symbols;
45+
#endif
4046
};
4147

4248
/// Correspondance between arrays and pointers string representations

src/solvers/refinement/string_constraint_generator_main.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,11 @@ operator()(const irep_idt &prefix, const typet &type)
4444
std::ostringstream buf;
4545
buf << "string_refinement#" << prefix << "#" << ++symbol_count;
4646
irep_idt name(buf.str());
47-
return symbol_exprt(name, type);
47+
symbol_exprt result(name, type);
48+
#ifdef DEBUG
49+
created_symbols.push_back(result);
50+
#endif
51+
return result;
4852
}
4953

5054
exprt sum_overflows(const plus_exprt &sum)

src/solvers/refinement/string_refinement.cpp

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,8 +1013,7 @@ void debug_model(
10131013
messaget::mstreamt &stream,
10141014
const namespacet &ns,
10151015
const std::function<exprt(const exprt &)> &super_get,
1016-
const std::vector<symbol_exprt> &boolean_symbols,
1017-
const std::vector<symbol_exprt> &index_symbols)
1016+
const std::vector<symbol_exprt> &symbols)
10181017
{
10191018
stream << "debug_model:" << '\n';
10201019
for(const auto &pointer_array : generator.array_pool.get_arrays_of_pointers())
@@ -1028,13 +1027,7 @@ void debug_model(
10281027
<< " - model: " << format(model) << messaget::eom;
10291028
}
10301029

1031-
for(const auto &symbol : boolean_symbols)
1032-
{
1033-
stream << " - " << symbol.get_identifier() << ": "
1034-
<< format(super_get(symbol)) << '\n';
1035-
}
1036-
1037-
for(const auto &symbol : index_symbols)
1030+
for(const auto &symbol : symbols)
10381031
{
10391032
stream << " - " << symbol.get_identifier() << ": "
10401033
<< format(super_get(symbol)) << '\n';
@@ -1266,12 +1259,7 @@ static std::pair<bool, std::vector<exprt>> check_axioms(
12661259

12671260
#ifdef DEBUG
12681261
debug_model(
1269-
generator,
1270-
stream,
1271-
ns,
1272-
get,
1273-
generator.get_boolean_symbols(),
1274-
generator.get_index_symbols());
1262+
generator, stream, ns, get, generator.fresh_symbol.created_symbols);
12751263
#endif
12761264

12771265
// Maps from indexes of violated universal axiom to a witness of violation

0 commit comments

Comments
 (0)