Skip to content

Commit 3f1afed

Browse files
author
Daniel Kroening
committed
added multi_ary_exprt
1 parent 915b488 commit 3f1afed

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

src/util/std_expr.h

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,68 @@ inline binary_relation_exprt &to_binary_relation_expr(exprt &expr)
603603
return static_cast<binary_relation_exprt &>(expr);
604604
}
605605

606+
/*! \brief A generic base class for multi-ary expressions
607+
*/
608+
class multi_ary_exprt:public exprt
609+
{
610+
public:
611+
multi_ary_exprt()
612+
{
613+
}
614+
615+
explicit multi_ary_exprt(const irep_idt &_id):exprt(_id)
616+
{
617+
}
618+
619+
multi_ary_exprt(
620+
const irep_idt &_id,
621+
const typet &_type):exprt(_id, _type)
622+
{
623+
}
624+
625+
multi_ary_exprt(
626+
const exprt &_lhs,
627+
const irep_idt &_id,
628+
const exprt &_rhs):
629+
exprt(_id, _lhs.type())
630+
{
631+
copy_to_operands(_lhs, _rhs);
632+
}
633+
634+
multi_ary_exprt(
635+
const exprt &_lhs,
636+
const irep_idt &_id,
637+
const exprt &_rhs,
638+
const typet &_type):
639+
exprt(_id, _type)
640+
{
641+
copy_to_operands(_lhs, _rhs);
642+
}
643+
};
644+
645+
/*! \brief Cast a generic exprt to a \ref multi_ary_exprt
646+
*
647+
* This is an unchecked conversion. \a expr must be known to be \ref
648+
* multi_ary_exprt.
649+
*
650+
* \param expr Source expression
651+
* \return Object of type \ref multi_ary_exprt
652+
*
653+
* \ingroup gr_std_expr
654+
*/
655+
inline const multi_ary_exprt &to_multi_ary_expr(const exprt &expr)
656+
{
657+
return static_cast<const multi_ary_exprt &>(expr);
658+
}
659+
660+
/*! \copydoc to_multi_ary_expr(const exprt &)
661+
* \ingroup gr_std_expr
662+
*/
663+
inline multi_ary_exprt &to_multi_ary_expr(exprt &expr)
664+
{
665+
return static_cast<multi_ary_exprt &>(expr);
666+
}
667+
606668
/*! \brief The plus expression
607669
*/
608670
class plus_exprt:public binary_exprt

0 commit comments

Comments
 (0)