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 
40  goto_programt &goto_program,
41  bool checks_only=false);
42 
44  goto_functionst &goto_functions,
45  bool checks_only=false);
46 
47  void pointer_checks(goto_programt &goto_program);
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  const std::set<irep_idt> *valid_local_variables;
92 
93  std::set<exprt> assertions;
95 };
96 
97 void dereference(
99  exprt &expr,
100  const namespacet &ns,
102 
103 void remove_pointers(
104  goto_programt &goto_program,
105  symbol_tablet &symbol_table,
107 
108 void remove_pointers(
109  goto_functionst &goto_functions,
110  symbol_tablet &symbol_table,
112 
113 void pointer_checks(
114  goto_programt &goto_program,
115  symbol_tablet &symbol_table,
116  const optionst &options,
118 
119 void pointer_checks(
120  goto_functionst &goto_functions,
121  symbol_tablet &symbol_table,
122  const optionst &options,
124 
125 #endif // CPROVER_POINTER_ANALYSIS_GOTO_PROGRAM_DEREFERENCE_H
virtual bool is_valid_object(const irep_idt &identifier)
Goto Programs with Functions.
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:33
void dereference_rec(exprt &expr, guardt &guard, const value_set_dereferencet::modet mode)
Pointer Dereferencing.
virtual void get_value_set(const exprt &expr, value_setst::valuest &dest)
void pointer_checks(goto_programt &goto_program)
instructionst::const_iterator const_targett
Value Set Propagation.
const std::set< irep_idt > * valid_local_variables
The symbol table.
Definition: symbol_table.h:52
TO_BE_DOCUMENTED.
Definition: namespace.h:62
virtual void dereference_failure(const std::string &property, const std::string &msg, const guardt &guard)
A specialization of goto_program_templatet over goto programs in which instructions have codet type...
Definition: goto_program.h:24
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)
void remove_pointers(goto_programt &goto_program, symbol_tablet &symbol_table, value_setst &value_sets)
value_set_dereferencet dereference
void dereference_program(goto_programt &goto_program, bool checks_only=false)
Base class for all expressions.
Definition: expr.h:46
virtual bool has_failed_symbol(const exprt &expr, const symbolt *&symbol)
void dereference_instruction(goto_programt::targett target, bool checks_only=false)
std::list< exprt > valuest
Definition: value_sets.h:28