Skip to content

Commit bb9e9cc

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 f2d42eb commit bb9e9cc

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/pointer-analysis/value_set.cpp

Lines changed: 6 additions & 5 deletions
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+
const 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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,11 @@ class value_sett
305305
/// Pretty-print this value-set
306306
/// \param ns: global namespace
307307
/// \param [out] out: stream to write to
308+
/// \param indent: string to use for indentation of the output
308309
void output(
309310
const namespacet &ns,
310-
std::ostream &out) const;
311+
std::ostream &out,
312+
const std::string &indent = "") const;
311313

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

0 commit comments

Comments
 (0)