cprover
goto_program_dereference.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Value Set
4 
5 Author: 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 
15 #include <util/namespace.h>
16 
18 
19 #include "value_sets.h"
20 #include "value_set_dereference.h"
21 
23 {
24 public:
25  // Note: this currently doesn't specify a source language
26  // for the final argument to value_set_dereferencet.
27  // This means that language-inappropriate values such as
28  // (struct A*)some_integer_value in Java, may be returned.
30  const namespacet &_ns,
31  symbol_tablet &_new_symbol_table,
32  const optionst &_options,
33  value_setst &_value_sets):
34  options(_options),
35  ns(_ns),
36  value_sets(_value_sets),
37  dereference(_ns, _new_symbol_table, _options, *this, ID_nil) { }
38 
41  bool checks_only=false);
42 
44  goto_functionst &goto_functions,
45  bool checks_only=false);
46 
48  void pointer_checks(goto_functionst &goto_functions);
49 
52  exprt &expr);
53 
55  {
56  }
57 
58 protected:
59  const optionst &options;
60  const namespacet &ns;
63 
64  virtual bool is_valid_object(const irep_idt &identifier);
65 
66  virtual bool has_failed_symbol(
67  const exprt &expr,
68  const symbolt *&symbol);
69 
70  virtual void dereference_failure(
71  const std::string &property,
72  const std::string &msg,
73  const guardt &guard);
74 
75  virtual void get_value_set(const exprt &expr, value_setst::valuest &dest);
76 
79  bool checks_only=false);
80 
81 protected:
82  void dereference_rec(
83  exprt &expr, guardt &guard, const value_set_dereferencet::modet mode);
84  void dereference_expr(
85  exprt &expr,
86  const bool checks_only,
88 
89 #if 0
90  const std::set<irep_idt> *valid_local_variables;
91 #endif
94 
95  std::set<exprt> assertions;
97 };
98 
99 void dereference(
101  exprt &expr,
102  const namespacet &,
103  value_setst &);
104 
105 void remove_pointers(
106  goto_modelt &,
107  value_setst &);
108 
109 void remove_pointers(
110  goto_functionst &,
111  symbol_tablet &,
112  value_setst &);
113 
114 void pointer_checks(
115  goto_programt &,
116  symbol_tablet &,
117  const optionst &,
118  value_setst &);
119 
120 void pointer_checks(
121  goto_functionst &,
122  symbol_tablet &,
123  const optionst &,
124  value_setst &);
125 
126 #endif // CPROVER_POINTER_ANALYSIS_GOTO_PROGRAM_DEREFERENCE_H
virtual bool is_valid_object(const irep_idt &identifier)
goto_programt::const_targett current_target
goto_program_dereferencet(const namespacet &_ns, symbol_tablet &_new_symbol_table, const optionst &_options, value_setst &_value_sets)
Definition: guard.h:19
Symbol table entry.This is a symbol in the symbol table, stored in an object of type symbol_tablet...
Definition: symbol.h:30
void dereference_rec(exprt &expr, guardt &guard, const value_set_dereferencet::modet mode)
Pointer Dereferencing.
void remove_pointers(goto_modelt &, value_setst &)
virtual void get_value_set(const exprt &expr, value_setst::valuest &dest)
void pointer_checks(goto_programt &goto_program)
Symbol Table + CFG.
Value Set Propagation.
instructionst::iterator targett
Definition: goto_program.h:397
The symbol table.
Definition: symbol_table.h:19
instructionst::const_iterator const_targett
Definition: goto_program.h:398
TO_BE_DOCUMENTED.
Definition: namespace.h:74
virtual void dereference_failure(const std::string &property, const std::string &msg, const guardt &guard)
A generic container class for the GOTO intermediate representation of one function.
Definition: goto_program.h:70
void dereference_expr(exprt &expr, const bool checks_only, const value_set_dereferencet::modet mode)
void dereference_expression(goto_programt::const_targett target, exprt &expr)
value_set_dereferencet dereference
void dereference_program(goto_programt &goto_program, bool checks_only=false)
Base class for all expressions.
Definition: expr.h:42
virtual bool has_failed_symbol(const exprt &expr, const symbolt *&symbol)
void dereference_instruction(goto_programt::targett target, bool checks_only=false)
goto_programt & goto_program
Definition: cover.cpp:63
std::list< exprt > valuest
Definition: value_sets.h:28
void pointer_checks(goto_programt &, symbol_tablet &, const optionst &, value_setst &)
void dereference(goto_programt::const_targett target, exprt &expr, const namespacet &, value_setst &)