added OPERANDS_IN_GETSUB option

git-svn-id: svn+ssh://svn.cprover.org/srv/svn/cbmc/trunk@3541 6afb6bc1-c8e4-404c-8f48-9ae832c5b171
This commit is contained in:
kroening 2014-01-21 12:49:12 +00:00
parent 4dbd96cb29
commit 8a9ac1d283
1 changed files with 14 additions and 0 deletions

View File

@ -9,6 +9,8 @@ Author: Daniel Kroening, kroening@kroening.com
#ifndef CPROVER_EXPR_H
#define CPROVER_EXPR_H
//#define OPERANDS_IN_GETSUB
#include "type.h"
#define forall_operands(it, expr) \
@ -55,13 +57,25 @@ public:
inline const typet &type() const { return static_cast<const typet &>(find(ID_type)); }
inline bool has_operands() const
#ifdef OPERANDS_IN_GETSUB
{ return !get_sub().empty(); }
#else
{ return !find(ID_operands).is_nil(); }
#endif
inline operandst &operands()
#ifdef OPERANDS_IN_GETSUB
{ return (operandst &)get_sub(); }
#else
{ return (operandst &)(add(ID_operands).get_sub()); }
#endif
inline const operandst &operands() const
#ifdef OPERANDS_IN_GETSUB
{ return (const operandst &)get_sub(); }
#else
{ return (const operandst &)(find(ID_operands).get_sub()); }
#endif
inline exprt &op0()
{ return operands().front(); }