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: 1 addition & 14 deletions src/goto-programs/builtin_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Author: Daniel Kroening, kroening@kroening.com
#include <util/c_types.h>
#include <util/cprover_prefix.h>
#include <util/expr_initializer.h>
#include <util/expr_util.h>
#include <util/pointer_offset_size.h>
#include <util/rational.h>
#include <util/rational_tools.h>
Expand Down Expand Up @@ -615,20 +616,6 @@ void goto_convertt::do_array_op(
copy(array_op_statement, OTHER, dest);
}

bool is_lvalue(const exprt &expr)
{
if(expr.id()==ID_index)
return is_lvalue(to_index_expr(expr).op0());
else if(expr.id()==ID_member)
return is_lvalue(to_member_expr(expr).op0());
else if(expr.id()==ID_dereference)
return true;
else if(expr.id()==ID_symbol)
return true;
else
return false;
}

exprt make_va_list(const exprt &expr)
{
// we first strip any typecast
Expand Down
13 changes: 13 additions & 0 deletions src/util/expr_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,19 @@ Author: Daniel Kroening, kroening@kroening.com
#include "namespace.h"
#include "arith_tools.h"

bool is_lvalue(const exprt &expr)
{
if(expr.id() == ID_index)
return is_lvalue(to_index_expr(expr).array());
else if(expr.id() == ID_member)
return is_lvalue(to_member_expr(expr).compound());
else if(expr.id() == ID_dereference)
return true;
else if(expr.id() == ID_symbol)
return true;
else
return false;
}
exprt make_binary(const exprt &expr)
{
const exprt::operandst &operands=expr.operands();
Expand Down
3 changes: 3 additions & 0 deletions src/util/expr_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class symbolt;
class typet;
class namespacet;

/// Returns true iff the argument is (syntactically) an lvalue.
bool is_lvalue(const exprt &expr);

/// splits an expression with >=3 operands into nested binary expressions
exprt make_binary(const exprt &);

Expand Down