CBMC
Loading...
Searching...
No Matches
goto_program_dereference.h
Go to the documentation of this file.
1/*******************************************************************\
2
3Module: Value Set
4
5Author: Daniel Kroening, kroening@kroening.com
6
7\*******************************************************************/
8
11
12#ifndef CPROVER_POINTER_ANALYSIS_GOTO_PROGRAM_DEREFERENCE_H
13#define CPROVER_POINTER_ANALYSIS_GOTO_PROGRAM_DEREFERENCE_H
14
17
18class exprt;
19class goto_functionst;
20class goto_modelt;
21class namespacet;
22class optionst;
24class value_setst;
25
29{
30public:
31 // Note: this currently doesn't specify a source language
32 // for the final argument to value_set_dereferencet.
33 // This means that language-inappropriate values such as
34 // (struct A*)some_integer_value in Java, may be returned.
35 // Note: value_set_dereferencet requires a message_handlert instance
36 // as one of its arguments to display the points-to set
37 // during symex. Display is not done during goto-program
38 // conversion. To ensure this the display_points_to_sets
39 // parameter in value_set_dereferencet::dereference()
40 // is set to false by default and is not changed by the
41 // goto program conversion modules.
43 const namespacet &_ns,
44 symbol_table_baset &_new_symbol_table,
45 const optionst &_options,
46 value_setst &_value_sets,
47 message_handlert &message_handler)
48 : options(_options),
49 ns(_ns),
50 value_sets(_value_sets),
51 dereference(_ns, _new_symbol_table, *this, ID_nil, false, message_handler)
52 {
53 }
54
56 goto_programt &goto_program,
57 bool checks_only=false);
58
60 goto_functionst &goto_functions,
61 bool checks_only=false);
62
64 const irep_idt &function_id,
66 exprt &expr);
67
69 {
70 }
71
72protected:
74 const namespacet &ns;
77
78 const symbolt *get_or_create_failed_symbol(const exprt &expr) override;
79
80 std::vector<exprt> get_value_set(const exprt &expr) const override;
81
84 bool checks_only=false);
85
86protected:
87 void dereference_rec(exprt &expr);
88 void dereference_expr(exprt &expr, const bool checks_only);
89
93};
94
95void dereference(
96 const irep_idt &function_id,
98 exprt &expr,
99 const namespacet &,
100 value_setst &,
102
104
105#define OPT_REMOVE_POINTERS "(remove-pointers)"
106
107#define HELP_REMOVE_POINTERS \
108 " {y--remove-pointers} \t " \
109 "converts pointer arithmetic to base+offset expressions\n"
110
111#endif // CPROVER_POINTER_ANALYSIS_GOTO_PROGRAM_DEREFERENCE_H
Base class for pointer value set analysis.
Base class for all expressions.
Definition expr.h:57
A collection of goto functions.
void dereference_program(goto_programt &goto_program, bool checks_only=false)
const symbolt * get_or_create_failed_symbol(const exprt &expr) override
void dereference_expr(exprt &expr, const bool checks_only)
Remove dereference expressions contained in expr.
value_set_dereferencet dereference
std::vector< exprt > get_value_set(const exprt &expr) const override
Gets the value set corresponding to the current target and expression expr.
void dereference_instruction(goto_programt::targett target, bool checks_only=false)
Remove dereference from expressions contained in the instruction at target.
void dereference_rec(exprt &expr)
Turn subexpression of expr of the form &*p into p and use dereference on subexpressions of the form *...
goto_programt::const_targett current_target
goto_program_dereferencet(const namespacet &_ns, symbol_table_baset &_new_symbol_table, const optionst &_options, value_setst &_value_sets, message_handlert &message_handler)
void dereference_expression(const irep_idt &function_id, goto_programt::const_targett target, exprt &expr)
Set the current target to target and remove derefence from expr.
A generic container class for the GOTO intermediate representation of one function.
instructionst::iterator targett
instructionst::const_iterator const_targett
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition namespace.h:91
The symbol table base class interface.
Symbol table entry.
Definition symbol.h:28
Wrapper for a function dereferencing pointer expressions using a value set.
Pointer Dereferencing.
void dereference(const irep_idt &function_id, goto_programt::const_targett target, exprt &expr, const namespacet &, value_setst &, message_handlert &)
Remove dereferences in expr using value_sets to determine to what objects the pointers may be pointin...
void remove_pointers(goto_modelt &, value_setst &, message_handlert &)
Remove dereferences in all expressions contained in the program goto_model.
Pointer Dereferencing.
dstringt irep_idt