Skip to content

Commit 21b1aed

Browse files
Add indent argument to value_set output
Allows to customize the indentation of the output, for clearer logging of the value set.
1 parent b419e36 commit 21b1aed

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/pointer-analysis/value_set.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,10 @@ bool value_sett::insert(
131131
return true;
132132
}
133133

134-
void value_sett::output(const namespacet &ns, std::ostream &out) const
134+
void value_sett::output(
135+
const namespacet &ns,
136+
std::ostream &out,
137+
std::string indent) const
135138
{
136139
values.iterate([&](const irep_idt &, const entryt &e) {
137140
irep_idt identifier, display_name;
@@ -158,9 +161,7 @@ void value_sett::output(const namespacet &ns, std::ostream &out) const
158161
#endif
159162
}
160163

161-
out << display_name;
162-
163-
out << " = { ";
164+
out << indent << display_name << " = { ";
164165

165166
const object_map_dt &object_map = e.object_map.read();
166167

@@ -204,7 +205,7 @@ void value_sett::output(const namespacet &ns, std::ostream &out) const
204205
{
205206
out << ", ";
206207
if(width >= 40)
207-
out << "\n ";
208+
out << "\n" << std::string(' ', indent.size()) << " ";
208209
}
209210
}
210211

src/pointer-analysis/value_set.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -303,9 +303,9 @@ class value_sett
303303
/// Pretty-print this value-set
304304
/// \param ns: global namespace
305305
/// \param [out] out: stream to write to
306-
void output(
307-
const namespacet &ns,
308-
std::ostream &out) const;
306+
/// \param indent: string to use for indentation of the output
307+
void output(const namespacet &ns, std::ostream &out, std::string indent = "")
308+
const;
309309

310310
/// Stores the LHS ID -> RHS expression set map. See `valuest` documentation
311311
/// for more detail.

0 commit comments

Comments
 (0)