summaryrefslogtreecommitdiff
path: root/src/InterpreterUtils.ml
diff options
context:
space:
mode:
authorSon Ho2022-01-19 01:24:35 +0100
committerSon Ho2022-01-19 01:24:35 +0100
commit2c93d514d6d62f8eccba47b1efefa2db1e56954e (patch)
treea3addf7bad4824f9a6ad7d5acaee59c61b405f21 /src/InterpreterUtils.ml
parentc0f230dc6c331e9eb120900e8c31a03e1f5ab476 (diff)
Implement the sanity checks for consumption of symbolic values by
abstractions (as input or given back values)
Diffstat (limited to '')
-rw-r--r--src/InterpreterUtils.ml22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/InterpreterUtils.ml b/src/InterpreterUtils.ml
index ca437593..be899c08 100644
--- a/src/InterpreterUtils.ml
+++ b/src/InterpreterUtils.ml
@@ -224,3 +224,25 @@ let bottom_in_value (ended_regions : T.RegionId.Set.t) (v : V.typed_value) :
obj#visit_typed_value () v;
false
with Found -> true
+
+let value_has_ret_symbolic_value_with_borrow_under_mut (ctx : C.eval_ctx)
+ (v : V.typed_value) : bool =
+ let obj =
+ object
+ inherit [_] V.iter_typed_value
+
+ method! visit_symbolic_value _ s =
+ match s.sv_kind with
+ | V.FunCallRet ->
+ if ty_has_borrow_below_mut ctx.type_context.type_infos s.sv_ty then
+ raise Found
+ else ()
+ | V.SynthInput -> ()
+ | V.FunCallGivenBack | V.SynthGivenBack -> failwith "Unreachable"
+ end
+ in
+ (* We use exceptions *)
+ try
+ obj#visit_typed_value () v;
+ false
+ with Found -> true