Skip to content

Commit 762388c

Browse files
author
Daniel Kroening
committed
replace usage of format() by debug_formatter()
1 parent 1f75edf commit 762388c

File tree

10 files changed

+56
-59
lines changed

10 files changed

+56
-59
lines changed

src/analyses/constant_propagator.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Author: Peter Schrammel
1313

1414
#ifdef DEBUG
1515
#include <iostream>
16-
#include <util/format_expr.h>
16+
#include <util/formatter.h>
1717
#endif
1818

1919
#include <util/find_symbols.h>
@@ -220,7 +220,7 @@ bool constant_propagator_domaint::two_way_propagate_rec(
220220
const namespacet &ns)
221221
{
222222
#ifdef DEBUG
223-
std::cout << "two_way_propagate_rec: " << format(expr) << '\n';
223+
std::cout << "two_way_propagate_rec: " << debug_formatter(expr) << '\n';
224224
#endif
225225

226226
bool change=false;

src/goto-programs/generate_function_bodies.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Author: Diffblue Ltd.
99
#include "generate_function_bodies.h"
1010

1111
#include <util/arith_tools.h>
12-
#include <util/format_expr.h>
12+
#include <util/formatter.h>
1313
#include <util/make_unique.h>
1414
#include <util/string_utils.h>
1515

@@ -102,7 +102,7 @@ class assert_false_generate_function_bodiest : public generate_function_bodiest
102102
const namespacet ns(symbol_table);
103103
std::ostringstream comment_stream;
104104
comment_stream << id2string(ID_assertion) << " "
105-
<< format(assert_instruction->guard);
105+
<< debug_formatter(assert_instruction->guard);
106106
assert_instruction->source_location.set_comment(comment_stream.str());
107107
assert_instruction->source_location.set_property_class(ID_assertion);
108108
auto end_instruction = add_instruction();
@@ -134,7 +134,7 @@ class assert_false_then_assume_false_generate_function_bodiest
134134
const namespacet ns(symbol_table);
135135
std::ostringstream comment_stream;
136136
comment_stream << id2string(ID_assertion) << " "
137-
<< format(assert_instruction->guard);
137+
<< debug_formatter(assert_instruction->guard);
138138
assert_instruction->source_location.set_comment(comment_stream.str());
139139
assert_instruction->source_location.set_property_class(ID_assertion);
140140
auto assume_instruction = add_instruction();
@@ -203,7 +203,7 @@ class havoc_generate_function_bodiest : public generate_function_bodiest,
203203
bool constant_known_array_size = lhs_array_type.size().is_constant();
204204
if(!constant_known_array_size)
205205
{
206-
warning() << "Cannot havoc non-const array " << format(lhs)
206+
warning() << "Cannot havoc non-const array " << debug_formatter(lhs)
207207
<< " in function " << function_name
208208
<< ": Unknown array size" << eom;
209209
}
@@ -219,7 +219,7 @@ class havoc_generate_function_bodiest : public generate_function_bodiest,
219219
// Pretty much the same thing as a unknown size array
220220
// Technically not allowed by the C standard, but we model
221221
// unknown size arrays in structs this way
222-
warning() << "Cannot havoc non-const array " << format(lhs)
222+
warning() << "Cannot havoc non-const array " << debug_formatter(lhs)
223223
<< " in function " << function_name << ": Array size 0"
224224
<< eom;
225225
}

src/goto-programs/goto_trace.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Author: Daniel Kroening
1717
#include <ostream>
1818

1919
#include <util/arith_tools.h>
20-
#include <util/format_expr.h>
20+
#include <util/formatter.h>
2121
#include <util/symbol.h>
2222

2323
#include <ansi-c/printf_formatter.h>
@@ -74,8 +74,8 @@ void goto_trace_stept::output(
7474

7575
if(is_assignment())
7676
{
77-
out << " " << format(full_lhs)
78-
<< " = " << format(full_lhs_value)
77+
out << " " << debug_formatter(full_lhs)
78+
<< " = " << debug_formatter(full_lhs_value)
7979
<< '\n';
8080
}
8181

@@ -95,7 +95,7 @@ void goto_trace_stept::output(
9595
if(!comment.empty())
9696
out << " " << comment << '\n';
9797

98-
out << " " << format(pc->guard) << '\n';
98+
out << " " << debug_formatter(pc->guard) << '\n';
9999
out << '\n';
100100
}
101101
}

src/goto-symex/equation_conversion_exceptions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Author: Diffblue Ltd.
1414

1515
#include <sstream>
1616

17-
#include <util/format_expr.h>
17+
#include <util/formatter.h>
1818

1919
#include "symex_target_equation.h"
2020

@@ -28,7 +28,7 @@ class equation_conversion_exceptiont : public std::runtime_error
2828
{
2929
std::ostringstream error_msg;
3030
error_msg << runtime_error::what();
31-
error_msg << "\nSource GOTO statement: " << format(step.source.pc->code);
31+
error_msg << "\nSource GOTO statement: " << debug_formatter(step.source.pc->code);
3232
error_msg << "\nStep:\n";
3333
step.output(error_msg);
3434
error_message = error_msg.str();

src/goto-symex/slice_by_trace.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Author: Daniel Kroening, [email protected]
2121
#include <util/arith_tools.h>
2222
#include <util/std_expr.h>
2323
#include <util/guard.h>
24-
#include <util/format_expr.h>
24+
#include <util/formatter.h>
2525

2626
void symex_slice_by_tracet::slice_by_trace(
2727
std::string trace_files,
@@ -257,10 +257,10 @@ void symex_slice_by_tracet::compute_ts_back(
257257

258258
#if 0
259259
std::cout << "EVENT: " << event << '\n';
260-
std::cout << "GUARD: " << format(guard) << '\n';
260+
std::cout << "GUARD: " << debug_formatter(guard) << '\n';
261261
for(size_t j=0; j < t.size(); j++)
262262
{
263-
std::cout << "t[" << j << "]=" << format(t[j]) <<
263+
std::cout << "t[" << j << "]=" << debug_formatter(t[j]) <<
264264
'\n';
265265
}
266266
#endif

src/goto-symex/symex_target_equation.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Author: Daniel Kroening, [email protected]
1111

1212
#include "symex_target_equation.h"
1313

14-
#include <util/format_expr.h>
14+
#include <util/formatter.h>
1515
#include <util/std_expr.h>
1616
#include <util/throw_with_nested.h>
1717
#include <util/unwrap_nested_exception.h>
@@ -786,10 +786,10 @@ void symex_target_equationt::SSA_stept::output(std::ostream &out) const
786786
switch(type)
787787
{
788788
case goto_trace_stept::typet::ASSERT:
789-
out << "ASSERT " << format(cond_expr) << '\n';
789+
out << "ASSERT " << debug_formatter(cond_expr) << '\n';
790790
break;
791791
case goto_trace_stept::typet::ASSUME:
792-
out << "ASSUME " << format(cond_expr) << '\n';
792+
out << "ASSUME " << debug_formatter(cond_expr) << '\n';
793793
break;
794794
case goto_trace_stept::typet::LOCATION:
795795
out << "LOCATION" << '\n';
@@ -803,7 +803,7 @@ void symex_target_equationt::SSA_stept::output(std::ostream &out) const
803803

804804
case goto_trace_stept::typet::DECL:
805805
out << "DECL" << '\n';
806-
out << format(ssa_lhs) << '\n';
806+
out << debug_formatter(ssa_lhs) << '\n';
807807
break;
808808

809809
case goto_trace_stept::typet::ASSIGNMENT:
@@ -867,21 +867,21 @@ void symex_target_equationt::SSA_stept::output(std::ostream &out) const
867867
out << "MEMORY_BARRIER\n";
868868
break;
869869
case goto_trace_stept::typet::GOTO:
870-
out << "IF " << format(cond_expr) << " GOTO\n";
870+
out << "IF " << debug_formatter(cond_expr) << " GOTO\n";
871871
break;
872872

873873
default:
874874
UNREACHABLE;
875875
}
876876

877877
if(is_assert() || is_assume() || is_assignment() || is_constraint())
878-
out << format(cond_expr) << '\n';
878+
out << debug_formatter(cond_expr) << '\n';
879879

880880
if(is_assert() || is_constraint())
881881
out << comment << '\n';
882882

883883
if(is_shared_read() || is_shared_write())
884-
out << format(ssa_lhs) << '\n';
884+
out << debug_formatter(ssa_lhs) << '\n';
885885

886-
out << "Guard: " << format(guard) << '\n';
886+
out << "Guard: " << debug_formatter(guard) << '\n';
887887
}

src/pointer-analysis/dereference.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Author: Daniel Kroening, [email protected]
1313

1414
#ifdef DEBUG
1515
#include <iostream>
16-
#include <util/format_expr.h>
16+
#include <util/formatter.h>
1717
#endif
1818

1919
#include <util/std_expr.h>
@@ -37,7 +37,7 @@ exprt dereferencet::operator()(const exprt &pointer)
3737
const typet &type=pointer.type().subtype();
3838

3939
#ifdef DEBUG
40-
std::cout << "DEREF: " << format(pointer) << '\n';
40+
std::cout << "DEREF: " << debug_formatter(pointer) << '\n';
4141
#endif
4242

4343
return dereference_rec(

src/pointer-analysis/value_set.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ Author: Daniel Kroening, [email protected]
2424

2525
#ifdef DEBUG
2626
#include <iostream>
27-
#include <util/format_expr.h>
28-
#include <util/format_type.h>
27+
#include <util/formatter.h>
2928
#endif
3029

3130
#include "add_failed_symbols.h"
@@ -327,7 +326,7 @@ void value_sett::get_value_set(
327326
#if 0
328327
for(value_setst::valuest::const_iterator it=dest.begin();
329328
it!=dest.end(); it++)
330-
std::cout << "GET_VALUE_SET: " << format(*it) << '\n';
329+
std::cout << "GET_VALUE_SET: " << debug_formatter(*it) << '\n';
331330
#endif
332331
}
333332

@@ -352,7 +351,7 @@ void value_sett::get_value_set_rec(
352351
const namespacet &ns) const
353352
{
354353
#if 0
355-
std::cout << "GET_VALUE_SET_REC EXPR: " << format(expr) << "\n";
354+
std::cout << "GET_VALUE_SET_REC EXPR: " << debug_formatter(expr) << "\n";
356355
std::cout << "GET_VALUE_SET_REC SUFFIX: " << suffix << '\n';
357356
#endif
358357

@@ -884,7 +883,7 @@ void value_sett::get_value_set_rec(
884883
for(const auto &obj : dest.read())
885884
{
886885
const exprt &e=to_expr(obj);
887-
std::cout << " " << format(e) << "\n";
886+
std::cout << " " << debug_formatter(e) << "\n";
888887
}
889888
std::cout << "\n";
890889
#endif
@@ -929,7 +928,7 @@ void value_sett::get_reference_set_rec(
929928
const namespacet &ns) const
930929
{
931930
#if 0
932-
std::cout << "GET_REFERENCE_SET_REC EXPR: " << format(expr)
931+
std::cout << "GET_REFERENCE_SET_REC EXPR: " << debug_formatter(expr)
933932
<< '\n';
934933
#endif
935934

@@ -956,7 +955,7 @@ void value_sett::get_reference_set_rec(
956955
#if 0
957956
for(expr_sett::const_iterator it=value_set.begin();
958957
it!=value_set.end(); it++)
959-
std::cout << "VALUE_SET: " << format(*it) << '\n';
958+
std::cout << "VALUE_SET: " << debug_formatter(*it) << '\n';
960959
#endif
961960

962961
return;
@@ -1093,10 +1092,10 @@ void value_sett::assign(
10931092
bool add_to_sets)
10941093
{
10951094
#if 0
1096-
std::cout << "ASSIGN LHS: " << format(lhs) << " : "
1097-
<< format(lhs.type()) << '\n';
1098-
std::cout << "ASSIGN RHS: " << format(rhs) << " : "
1099-
<< format(rhs.type()) << '\n';
1095+
std::cout << "ASSIGN LHS: " << debug_formatter(lhs) << " : "
1096+
<< debug_formatter(lhs.type()) << '\n';
1097+
std::cout << "ASSIGN RHS: " << debug_formatter(rhs) << " : "
1098+
<< debug_formatter(rhs.type()) << '\n';
11001099
std::cout << "--------------------------------------------\n";
11011100
output(ns, std::cout);
11021101
#endif
@@ -1301,15 +1300,15 @@ void value_sett::assign_rec(
13011300
bool add_to_sets)
13021301
{
13031302
#if 0
1304-
std::cout << "ASSIGN_REC LHS: " << format(lhs) << '\n';
1303+
std::cout << "ASSIGN_REC LHS: " << debug_formatter(lhs) << '\n';
13051304
std::cout << "ASSIGN_REC LHS ID: " << lhs.id() << '\n';
13061305
std::cout << "ASSIGN_REC SUFFIX: " << suffix << '\n';
13071306

13081307
for(object_map_dt::const_iterator it=values_rhs.read().begin();
13091308
it!=values_rhs.read().end();
13101309
it++)
13111310
std::cout << "ASSIGN_REC RHS: " <<
1312-
format(object_numbering[it->first]) << '\n';
1311+
debug_formatter(object_numbering[it->first]) << '\n';
13131312
std::cout << '\n';
13141313
#endif
13151314

src/pointer-analysis/value_set_dereference.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Author: Daniel Kroening, [email protected]
1313

1414
#ifdef DEBUG
1515
#include <iostream>
16-
#include <util/format_expr.h>
1716
#endif
1817

1918
#include <util/arith_tools.h>
@@ -23,7 +22,7 @@ Author: Daniel Kroening, [email protected]
2322
#include <util/c_types.h>
2423
#include <util/config.h>
2524
#include <util/cprover_prefix.h>
26-
#include <util/format_type.h>
25+
#include <util/formatter.h>
2726
#include <util/guard.h>
2827
#include <util/options.h>
2928
#include <util/pointer_offset_size.h>
@@ -77,7 +76,7 @@ exprt value_set_dereferencet::dereference(
7776
const typet &type=pointer.type().subtype();
7877

7978
#if 0
80-
std::cout << "DEREF: " << format(pointer) << '\n';
79+
std::cout << "DEREF: " << debug_formatter(pointer) << '\n';
8180
#endif
8281

8382
// collect objects the pointer may point to
@@ -90,7 +89,7 @@ exprt value_set_dereferencet::dereference(
9089
it=points_to_set.begin();
9190
it!=points_to_set.end();
9291
it++)
93-
std::cout << "P: " << format(*it) << '\n';
92+
std::cout << "P: " << debug_formatter(*it) << '\n';
9493
#endif
9594

9695
// get the values of these
@@ -105,8 +104,8 @@ exprt value_set_dereferencet::dereference(
105104
valuet value=build_reference_to(*it, mode, pointer, guard);
106105

107106
#if 0
108-
std::cout << "V: " << format(value.pointer_guard) << " --> ";
109-
std::cout << format(value.value) << '\n';
107+
std::cout << "V: " << debug_formatter(value.pointer_guard) << " --> ";
108+
std::cout << debug_formatter(value.value) << '\n';
110109
#endif
111110

112111
values.push_back(value);
@@ -191,7 +190,7 @@ exprt value_set_dereferencet::dereference(
191190
}
192191

193192
#if 0
194-
std::cout << "R: " << format(value) << "\n\n";
193+
std::cout << "R: " << debug_formatter(value) << "\n\n";
195194
#endif
196195

197196
return value;
@@ -281,7 +280,7 @@ value_set_dereferencet::valuet value_set_dereferencet::build_reference_to(
281280
const exprt &object=o.object();
282281

283282
#if 0
284-
std::cout << "O: " << format(root_object) << '\n';
283+
std::cout << "O: " << debug_formatter(root_object) << '\n';
285284
#endif
286285

287286
valuet result;
@@ -561,8 +560,8 @@ value_set_dereferencet::valuet value_set_dereferencet::build_reference_to(
561560
{
562561
std::ostringstream msg;
563562
msg << "memory model not applicable (got `"
564-
<< format(result.value.type()) << "', expected `"
565-
<< format(dereference_type) << "')";
563+
<< debug_formatter(result.value.type()) << "', expected `"
564+
<< debug_formatter(dereference_type) << "')";
566565

567566
dereference_callback.dereference_failure(
568567
"pointer dereference", msg.str(), tmp_guard);

0 commit comments

Comments
 (0)