Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions src/goto-instrument/goto_program2code.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,15 @@ Author: Daniel Kroening, [email protected]

#include <sstream>

#include <util/c_types.h>
#include <util/arith_tools.h>
#include <util/config.h>
#include <util/c_types.h>
#include <util/expr_util.h>
#include <util/find_symbols.h>
#include <util/prefix.h>
#include <util/simplify_expr.h>
#include <util/find_symbols.h>
#include <util/arith_tools.h>
#include <util/type_eq.h>

static const exprt &skip_typecast(const exprt &expr)
{
if(expr.id()!=ID_typecast)
return expr;

return skip_typecast(to_typecast_expr(expr).op());
}

void goto_program2codet::operator()()
{
// labels stored for cleanup
Expand Down
8 changes: 8 additions & 0 deletions src/util/expr_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,11 @@ if_exprt lift_if(const exprt &src, std::size_t operand_number)

return result;
}

const exprt &skip_typecast(const exprt &expr)
{
if(expr.id()!=ID_typecast)
return expr;

return skip_typecast(to_typecast_expr(expr).op());
}
3 changes: 3 additions & 0 deletions src/util/expr_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,7 @@ bool has_subtype(const typet &, const irep_idt &id, const namespacet &);
/// lift up an if_exprt one level
if_exprt lift_if(const exprt &, std::size_t operand_number);

/// find the expression nested inside typecasts, if any
const exprt &skip_typecast(const exprt &expr);

#endif // CPROVER_UTIL_EXPR_UTIL_H