Skip to content

Commit f5d3109

Browse files
author
Daniel Kroening
committed
usage of format() instead of from_expr for debugging
1 parent 27d6ec8 commit f5d3109

File tree

7 files changed

+88
-104
lines changed

7 files changed

+88
-104
lines changed

src/solvers/flattening/arrays.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -402,10 +402,8 @@ void arrayst::update_index_map(bool update_all)
402402
for(const auto &index : index_entry.second)
403403
std::cout << "Index set (" << index_entry.first << " = "
404404
<< arrays.find_number(index_entry.first) << " = "
405-
<< from_expr(ns, "",
406-
arrays[arrays.find_number(index_entry.first)])
407-
<< "): "
408-
<< from_expr(ns, "", index) << '\n';
405+
<< format(arrays[arrays.find_number(index_entry.first)])
406+
<< "): " << format(index) << '\n';
409407
std::cout << "-----\n";
410408
#endif
411409
}

src/solvers/refinement/string_constraint.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ Author: Romain Brenguier, romain.brenguier@diffblue.com
2020
#ifndef CPROVER_SOLVERS_REFINEMENT_STRING_CONSTRAINT_H
2121
#define CPROVER_SOLVERS_REFINEMENT_STRING_CONSTRAINT_H
2222

23-
#include <solvers/refinement/bv_refinement.h>
24-
#include <solvers/refinement/string_refinement_invariant.h>
23+
#include "bv_refinement.h"
24+
#include "string_refinement_invariant.h"
25+
2526
#include <util/refined_string_type.h>
2627
#include <util/string_expr.h>
27-
#include <langapi/language_util.h>
2828

2929
/// ### Universally quantified string constraint
3030
///
@@ -151,11 +151,11 @@ inline std::string from_expr(
151151
const irep_idt &identifier,
152152
const string_constraintt &expr)
153153
{
154-
return "forall "+from_expr(ns, identifier, expr.univ_var())+" in ["+
155-
from_expr(ns, identifier, expr.lower_bound())+", "+
156-
from_expr(ns, identifier, expr.upper_bound())+"). "+
157-
from_expr(ns, identifier, expr.premise())+" => "+
158-
from_expr(ns, identifier, expr.body());
154+
std::ostringstream out;
155+
out << "forall " << format(expr.univ_var()) << " in ["
156+
<< format(expr.lower_bound()) << ", " << format(expr.upper_bound())
157+
<< "). " << format(expr.premise()) << " => " << format(expr.body());
158+
return out.str();
159159
}
160160

161161
/// Constraints to encode non containement of strings.
@@ -226,14 +226,14 @@ inline std::string from_expr(
226226
const irep_idt &identifier,
227227
const string_not_contains_constraintt &expr)
228228
{
229-
return "forall x in ["+
230-
from_expr(ns, identifier, expr.univ_lower_bound())+", "+
231-
from_expr(ns, identifier, expr.univ_upper_bound())+"). "+
232-
from_expr(ns, identifier, expr.premise())+" => ("+
233-
"exists y in ["+from_expr(ns, identifier, expr.exists_lower_bound())+", "+
234-
from_expr(ns, identifier, expr.exists_upper_bound())+"). "+
235-
from_expr(ns, identifier, expr.s0())+"[x+y] != "+
236-
from_expr(ns, identifier, expr.s1())+"[y])";
229+
std::ostringstream out;
230+
out << "forall x in [" << format(expr.univ_lower_bound()) << ", "
231+
<< format(expr.univ_upper_bound()) << "). " << format(expr.premise())
232+
<< " => ("
233+
<< "exists y in [" << format(expr.exists_lower_bound()) << ", "
234+
<< format(expr.exists_upper_bound()) << "). " << format(expr.s0())
235+
<< "[x+y] != " << format(expr.s1()) << "[y])";
236+
return out.str();
237237
}
238238

239239
inline const string_not_contains_constraintt

0 commit comments

Comments
 (0)