Wrapper for a function dereferencing pointer expressions using a value set.
More...
#include <value_set_dereference.h>
|
| class | valuet |
| | Return value for build_reference_to; see that method for documentation. More...
|
| |
|
| static bool | should_ignore_value (const exprt &what, bool exclude_null_derefs, const irep_idt &language_mode) |
| | Determine whether possible alias what should be ignored when replacing a pointer by its referees.
|
| |
| static valuet | build_reference_to (const exprt &what, const exprt &pointer, const namespacet &ns) |
| |
| static bool | dereference_type_compare (const typet &object_type, const typet &dereference_type, const namespacet &ns) |
| | Check if the two types have matching number of ID_pointer levels, with the dereference type eventually pointing to void; then this is ok for example:
|
| |
| static bool | memory_model (exprt &value, const typet &type, const exprt &offset, const namespacet &ns) |
| | Replace value by an expression of type to_type corresponding to the value at memory address value + offset.
|
| |
| static bool | memory_model_bytes (exprt &value, const typet &type, const exprt &offset, const namespacet &ns) |
| | Replace value by an expression of type to_type corresponding to the value at memory address value + offset.
|
| |
Wrapper for a function dereferencing pointer expressions using a value set.
Definition at line 22 of file value_set_dereference.h.
◆ value_set_dereferencet()
- Parameters
-
| _ns | Namespace |
| _new_symbol_table | A symbol_table to store new symbols in |
| _dereference_callback | Callback object for getting the set of objects a given pointer may point to. |
| _language_mode | Mode for any new symbols created to represent a dereference failure |
| _exclude_null_derefs | Ignore value-set entries that indicate a |
| _message_handler | Message handler for displaying points-to set |
Definition at line 34 of file value_set_dereference.h.
◆ ~value_set_dereferencet()
| virtual value_set_dereferencet::~value_set_dereferencet |
( |
| ) |
|
|
inlinevirtual |
◆ build_reference_to()
- Parameters
-
| what | value set entry to convert to an expression: either ID_unknown, ID_invalid, or an object_descriptor_exprt giving a referred object and offset. |
| pointer_expr | pointer expression that may point to what |
| ns | A namespace |
- Returns
- a
valuet object containing guard and value fields. The guard is an appropriate check to determine whether pointer_expr really points to what; for example pointer_expr == &what. The value corresponds to the dereferenced pointer_expr assuming it is pointing to the object described by what. For example, we might return {.value = global, .pointer_guard = (pointer_expr == &global)}
Definition at line 460 of file value_set_dereference.cpp.
◆ dereference()
Dereference the given pointer-expression.
Any errors are reported to the callback method given in the constructor.
- Parameters
-
| pointer | A pointer-typed expression, to be dereferenced. |
| display_points_to_sets | Display size and contents of points to sets |
Definition at line 143 of file value_set_dereference.cpp.
◆ dereference_type_compare()
Check if the two types have matching number of ID_pointer levels, with the dereference type eventually pointing to void; then this is ok for example:
- dereference_type=void is ok (no matter what object_type is);
- object_type=(int *), dereference_type=(void *) is ok;
- object_type=(int **), dereference_type=(void **) is ok;
- object_type=(int **), dereference_type=(void *) is ok;
- object_type=(int *), dereference_type=(void **) is not ok;
Definition at line 341 of file value_set_dereference.cpp.
◆ get_failure_value()
◆ handle_dereference_base_case()
| exprt value_set_dereferencet::handle_dereference_base_case |
( |
const exprt & |
pointer, |
|
|
bool |
display_points_to_sets |
|
) |
| |
|
private |
◆ memory_model()
Replace value by an expression of type to_type corresponding to the value at memory address value + offset.
If value is a bitvector or pointer of the same size as to_type, make value into the typecast expression (to_type)value. Otherwise perform the same operation as value_set_dereferencet::memory_model_bytes
- Returns
- true on success
Definition at line 708 of file value_set_dereference.cpp.
◆ memory_model_bytes()
Replace value by an expression of type to_type corresponding to the value at memory address value + offset.
If the type of value is an array of bitvectors of size 1 byte, and to_type also is bitvector of size 1 byte, then the resulting expression is value[offset] or (to_type)value[offset] when typecast is required. Otherwise the expression is byte_extract(value, offset).
- Returns
- false if the conversion cannot be made
Definition at line 755 of file value_set_dereference.cpp.
◆ should_ignore_value()
Determine whether possible alias what should be ignored when replacing a pointer by its referees.
We currently ignore a null object when exclude_null_derefs is true (pass true if you know the dereferenced pointer cannot be null), and also ignore integer addresses when language_mode is "java"
- Parameters
-
| what | value set entry to convert to an expression: either ID_unknown, ID_invalid, or an object_descriptor_exprt giving a referred object and offset. |
| exclude_null_derefs | Ignore value-set entries that indicate a given dereference may follow a null pointer |
| language_mode | Mode for any new symbols created to represent a dereference failure |
- Returns
- true if
what should be ignored as a possible alias
Definition at line 423 of file value_set_dereference.cpp.
◆ dereference_callback
◆ exclude_null_derefs
| const bool value_set_dereferencet::exclude_null_derefs |
|
private |
◆ language_mode
◆ message_handler
◆ new_symbol_table
◆ ns
The documentation for this class was generated from the following files: