CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
expr_skeleton.cpp
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Symbolic Execution
4
5Author: Romain Brenguier, romain.brenguier@diffblue.com
6
7\*******************************************************************/
8
11
12#include "expr_skeleton.h"
13
14#include <util/std_expr.h>
15
19
21{
23 PRECONDITION(e.operands().size() >= 1);
24 to_multi_ary_expr(e).op0().make_nil();
25 return expr_skeletont{std::move(e)};
26}
27
29{
31 exprt result = skeleton;
32 exprt *p = &result;
33
34 while(p->is_not_nil())
35 {
37 p->id() != ID_symbol,
38 "expected pointed-to expression not to be a symbol");
40 p->operands().size() >= 1,
41 "expected pointed-to expression to have at least one operand");
42 p = &to_multi_ary_expr(*p).op0();
43 }
44
45 INVARIANT(p->is_nil(), "expected pointed-to expression to be nil");
46
47 *p = std::move(expr);
48 return result;
49}
50
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
Expression in which some part is missing and can be substituted for another expression.
exprt apply(exprt expr) const
Replace the missing part by the given expression, to end-up with a complete expression.
expr_skeletont()
Empty skeleton.
expr_skeletont compose(expr_skeletont other) const
Replace the missing part of the current skeleton by another skeleton, ending in a bigger skeleton cor...
static expr_skeletont remove_op0(exprt e)
Create a skeleton by removing the first operand of e.
exprt skeleton
In skeleton, nil_exprt is used to mark the sub expression to be substituted.
Base class for all expressions.
Definition expr.h:56
operandst & operands()
Definition expr.h:94
bool is_not_nil() const
Definition irep.h:372
const irep_idt & id() const
Definition irep.h:388
bool is_nil() const
Definition irep.h:368
The NIL expression.
Definition std_expr.h:3208
Expression skeleton.
#define PRECONDITION(CONDITION)
Definition invariant.h:463
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
Definition invariant.h:423
API to expression classes.
const multi_ary_exprt & to_multi_ary_expr(const exprt &expr)
Cast an exprt to a multi_ary_exprt.
Definition std_expr.h:987