Skip to content

Commit 0802e42

Browse files
authored
Merge pull request #3157 from diffblue/format_expr_byte_operators
format() now prints type of byte_extract and byte_update
2 parents 6c3918a + 8f9598b commit 0802e42

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/util/format_expr.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Author: Daniel Kroening, [email protected]
1212
#include "format_expr.h"
1313

1414
#include "arith_tools.h"
15+
#include "byte_operators.h"
1516
#include "expr.h"
1617
#include "expr_iterator.h"
1718
#include "fixedbv.h"
@@ -210,6 +211,22 @@ std::ostream &format_rec(std::ostream &os, const exprt &expr)
210211
else if(id == ID_typecast)
211212
return os << "cast(" << format(to_typecast_expr(expr).op()) << ", "
212213
<< format(expr.type()) << ')';
214+
else if(
215+
id == ID_byte_extract_little_endian || id == ID_byte_extract_big_endian)
216+
{
217+
const auto &byte_extract_expr = to_byte_extract_expr(expr);
218+
return os << id << "(" << format(byte_extract_expr.op()) << ", "
219+
<< format(byte_extract_expr.offset()) << ", "
220+
<< format(byte_extract_expr.type()) << ')';
221+
}
222+
else if(id == ID_byte_update_little_endian || id == ID_byte_update_big_endian)
223+
{
224+
const auto &byte_update_expr = to_byte_update_expr(expr);
225+
return os << id << "(" << format(byte_update_expr.op()) << ", "
226+
<< format(byte_update_expr.offset()) << ", "
227+
<< format(byte_update_expr.value()) << ", "
228+
<< format(byte_update_expr.type()) << ')';
229+
}
213230
else if(id == ID_member)
214231
return os << format(to_member_expr(expr).op()) << '.'
215232
<< to_member_expr(expr).get_component_name();

0 commit comments

Comments
 (0)