Skip to content

Commit ee4edcb

Browse files
author
Daniel Kroening
committed
goto_trace: strengthen signature of numeric_representation
1 parent 64d2fc0 commit ee4edcb

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/goto-programs/goto_trace.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -129,22 +129,24 @@ void goto_trace_stept::output(
129129
/// \param expr: expression to get numeric representation from
130130
/// \param options: configuration options
131131
/// \return a string with the numeric representation
132-
static std::string
133-
numeric_representation(const exprt &expr, const trace_optionst &options)
132+
static std::string numeric_representation(
133+
const constant_exprt &expr,
134+
const trace_optionst &options)
134135
{
135136
std::string result;
136137
std::string prefix;
138+
137139
if(options.hex_representation)
138140
{
139141
mp_integer value_int =
140-
bv2integer(id2string(to_constant_expr(expr).get_value()), false);
142+
bv2integer(id2string(expr.get_value()), false);
141143
result = integer2string(value_int, 16);
142144
prefix = "0x";
143145
}
144146
else
145147
{
146148
prefix = "0b";
147-
result = expr.get_string(ID_value);
149+
result = id2string(expr.get_value());
148150
}
149151

150152
std::ostringstream oss;
@@ -181,7 +183,8 @@ std::string trace_numeric_value(
181183
type.id()==ID_c_enum ||
182184
type.id()==ID_c_enum_tag)
183185
{
184-
const std::string &str = numeric_representation(expr, options);
186+
const std::string &str =
187+
numeric_representation(to_constant_expr(expr), options);
185188
return str;
186189
}
187190
else if(type.id()==ID_bool)

0 commit comments

Comments
 (0)