CBMC
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
write_stack_entry.cpp
Go to the documentation of this file.
1/*******************************************************************\
2
3 Module: Analyses Variable Sensitivity
4
5 Author: DiffBlue Limited.
6
7\*******************************************************************/
8
11
12#include <unordered_set>
13
15#include "write_stack_entry.h"
16
23 std::shared_ptr<const write_stack_entryt> new_entry,
25 const namespacet &ns)
26{
27 return false;
28}
29
32simple_entryt::simple_entryt(exprt expr) : simple_entry(expr)
33{
34 // Invalid simple expression added to the stack
36 expr.id() == ID_member || expr.id() == ID_symbol ||
37 expr.id() == ID_dynamic_object);
38}
39
43std::pair<exprt, bool> simple_entryt::get_access_expr() const
44{
45 return {simple_entry, false};
46}
47
49 : offset(offset_value)
50{
51 // The type of the abstract object should be an integral number
52 static const std::unordered_set<irep_idt, irep_id_hash> integral_types = {
55 integral_types.find(offset_value->type().id()) != integral_types.cend());
56}
57
61std::pair<exprt, bool> offset_entryt::get_access_expr() const
62{
63 return {offset->to_constant(), true};
64}
65
74 std::shared_ptr<const write_stack_entryt> new_entry,
76 const namespacet &ns)
77{
78 std::shared_ptr<const offset_entryt> cast_entry =
79 std::dynamic_pointer_cast<const offset_entryt>(new_entry);
80 if(cast_entry)
81 {
83 cast_entry->offset->to_constant(), offset->to_constant());
85 return true;
86 }
87 return false;
88}
An abstract version of a program environment.
sharing_ptrt< class abstract_objectt > abstract_object_pointert
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Definition ai.h:562
Base class for all expressions.
Definition expr.h:56
const irep_idt & id() const
Definition irep.h:388
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition namespace.h:91
offset_entryt(abstract_object_pointert offset_value)
std::pair< exprt, bool > get_access_expr() const override
Get the expression part needed to read this stack entry.
bool try_squash_in(std::shared_ptr< const write_stack_entryt > new_entry, const abstract_environmentt &enviroment, const namespacet &ns) override
Try to combine a new stack element with the current top of the stack.
abstract_object_pointert offset
The plus expression Associativity is not specified.
Definition std_expr.h:1002
std::pair< exprt, bool > get_access_expr() const override
Get the expression part needed to read this stack entry.
simple_entryt(exprt expr)
Build a simple entry based off a single expression.
virtual bool try_squash_in(std::shared_ptr< const write_stack_entryt > new_entry, const abstract_environmentt &enviroment, const namespacet &ns)
Try to combine a new stack element with the current top of the stack.
#define PRECONDITION(CONDITION)
Definition invariant.h:463
Represents an entry in the write_stackt.