File tree 3 files changed +36
-0
lines changed
cbmc/src/pointer-analysis 3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,14 @@ class namespacet;
39
39
// / pairs of an `exprt` and an optional offset if known (0 for both dynamic
40
40
// / objects in the example given above). RHS expressions are represented using
41
41
// / numbering to avoid storing redundant duplicate expressions.
42
+ // /
43
+ // / This object is used both for building and querying a single value set
44
+ // /
45
+ // / To query the value set use get_value_set and get_reference_set
46
+ // / get_value_set takes an expression representing a pointer and returns all
47
+ // / the objects pointed to by that pointer
48
+ // / get_reference_set takes an expression reprsenting a value and returns
49
+ // / other expressions that refer to the same memory as the passed expression
42
50
class value_sett
43
51
{
44
52
public:
Original file line number Diff line number Diff line change @@ -959,6 +959,20 @@ void local_value_set_analysist::get_values_reconstructed(
959
959
query_value_set.value_set .get_value_set (expr, dest, ns);
960
960
}
961
961
962
+ void local_value_set_analysist::get_references_reconstructed (
963
+ locationt l, const exprt &expr, value_setst::valuest &dest)
964
+ {
965
+ optionalt<local_value_set_domaint> reconstructed_value_set =
966
+ reconstruct_value_set (l);
967
+
968
+ // If reconstruct returns nothing, no reconstruction was necessary--
969
+ // query the real value set.
970
+ const local_value_set_domaint &query_value_set =
971
+ reconstructed_value_set ? *reconstructed_value_set : (*this )[l];
972
+
973
+ query_value_set.value_set .get_reference_set (expr, dest, ns);
974
+ }
975
+
962
976
optionalt<local_value_set_domaint>
963
977
local_value_set_analysist::reconstruct_value_set (locationt l)
964
978
{
Original file line number Diff line number Diff line change 30
30
// / external value sets or fields thereof (represented as a suffix, e.g.
31
31
// / `some_static_field.x` or `dynamic_object13.y`).
32
32
// / RHS expressions can be dynamic objects, external value sets or null.
33
+ // /
34
+ // / This object is used both for building and querying value sets for each
35
+ // / program location
36
+ // /
37
+ // / To query a value set use get_values_reconstructed and
38
+ // / get_references_reconstructed
39
+ // / get_values_reconstructed takes a location and an expression representing a
40
+ // / pointer and returns all the objects pointed to by that pointer
41
+ // / get_references_reconstructed takes a location and an expression
42
+ // / reprsenting a value and returns other expressions that refer to the same
43
+ // / memory as the passed expression
33
44
class lvsaa_single_external_set_summaryt : public summaryt
34
45
{
35
46
public:
@@ -237,6 +248,9 @@ class local_value_set_analysist
237
248
void get_values_reconstructed (
238
249
locationt l, const exprt &expr, value_setst::valuest &dest);
239
250
251
+ void get_references_reconstructed (
252
+ locationt l, const exprt &expr, value_setst::valuest &dest);
253
+
240
254
void reconstruct_all_value_sets (const goto_programt &);
241
255
242
256
protected:
You can’t perform that action at this time.
0 commit comments