Skip to content

Commit a76f7ad

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 a76f7ad

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/pointer-analysis/value_set.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ 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, std::ostream &out, std::string indent) const
135136
{
136137
values.iterate([&](const irep_idt &, const entryt &e) {
137138
irep_idt identifier, display_name;
@@ -158,9 +159,7 @@ void value_sett::output(const namespacet &ns, std::ostream &out) const
158159
#endif
159160
}
160161

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

165164
const object_map_dt &object_map = e.object_map.read();
166165

@@ -204,7 +203,7 @@ void value_sett::output(const namespacet &ns, std::ostream &out) const
204203
{
205204
out << ", ";
206205
if(width >= 40)
207-
out << "\n ";
206+
out << "\n" << std::string(' ', indent.size()) << " ";
208207
}
209208
}
210209

src/pointer-analysis/value_set.h

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

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

0 commit comments

Comments
 (0)