@@ -293,8 +293,8 @@ struct
293293 Invariant. (acc || R. ask_local_node n ~local (Invariant {Invariant. default_context with lvals})) [@ coverage off] (* bisect_ppx cannot handle redefined (||) *)
294294 ) (Invariant. bot () ) ns
295295 in
296- match inv with
297- | `Lifted inv ->
296+ match Invariant. to_exp inv with
297+ | Some inv ->
298298 let fundec = Node. find_fundec (List. hd ns) in (* TODO: fix location hack *)
299299 let location_function = fundec.svar.vname in
300300 let location = Entry. location ~location: loc ~location_function in
@@ -305,7 +305,7 @@ struct
305305 incr cnt_location_invariant;
306306 entry :: acc
307307 ) acc invs
308- | `Bot | `Top -> (* TODO: 0 for bot (dead code)? *)
308+ | None -> (* TODO: 0 for bot (dead code)? *)
309309 acc
310310 ) (Lazy. force location_nodes) entries
311311 )
@@ -323,8 +323,8 @@ struct
323323 Invariant. (acc || R. ask_local_node n ~local (Invariant Invariant. default_context)) [@ coverage off] (* bisect_ppx cannot handle redefined (||) *)
324324 ) (Invariant. bot () ) ns
325325 in
326- match inv with
327- | `Lifted inv ->
326+ match Invariant. to_exp inv with
327+ | Some inv ->
328328 let fundec = Node. find_fundec (List. hd ns) in (* TODO: fix location hack *)
329329 let location_function = fundec.svar.vname in
330330 let location = Entry. location ~location: loc ~location_function in
@@ -335,7 +335,7 @@ struct
335335 incr cnt_loop_invariant;
336336 entry :: acc
337337 ) acc invs
338- | `Bot | `Top -> (* TODO: 0 for bot (dead code)? *)
338+ | None -> (* TODO: 0 for bot (dead code)? *)
339339 acc
340340 )
341341 else
@@ -372,24 +372,24 @@ struct
372372 GHT. fold (fun g v acc ->
373373 match g with
374374 | `Left g -> (* global unknown from analysis Spec *)
375- begin match R. ask_global (InvariantGlobal (Obj. repr g)), GobConfig. get_string " witness.invariant.flow_insensitive-as" with
376- | `Lifted inv , "flow_insensitive_invariant" ->
375+ begin match Invariant. to_exp ( R. ask_global (InvariantGlobal (Obj. repr g) )), GobConfig. get_string " witness.invariant.flow_insensitive-as" with
376+ | Some inv , "flow_insensitive_invariant" ->
377377 let invs = WitnessUtil.InvariantExp. process_exp inv in
378378 List. fold_left (fun acc inv ->
379379 let invariant = Entry. invariant (CilType.Exp. show inv) in
380380 let entry = Entry. flow_insensitive_invariant ~task ~invariant in
381381 incr cnt_flow_insensitive_invariant;
382382 entry :: acc
383383 ) acc invs
384- | `Lifted inv , "location_invariant" ->
384+ | Some inv , "location_invariant" ->
385385 fold_flow_insensitive_as_location ~inv (fun ~location ~inv acc ->
386386 let invariant = Entry. invariant (CilType.Exp. show inv) in
387387 let entry = Entry. location_invariant ~task ~location ~invariant in
388388 incr cnt_location_invariant;
389389 entry :: acc
390390 ) acc
391- | `Lifted _, _
392- | `Bot , _ | `Top , _ -> (* global bot might only be possible for alloc variables, if at all, so emit nothing *)
391+ | Some _, _
392+ | None , _ -> (* global bot might only be possible for alloc variables, if at all, so emit nothing *)
393393 acc
394394 end
395395 | `Right _ -> (* global unknown for FromSpec contexts *)
@@ -450,11 +450,11 @@ struct
450450 let fc_map : con_inv list FCMap.t = FCMap. create 103 in
451451 FMap. iter (fun f con_invs ->
452452 List. iter (fun current_c ->
453- begin match current_c.invariant with
454- | `Lifted c_inv ->
453+ begin match Invariant. to_exp current_c.invariant with
454+ | Some c_inv ->
455455 (* Collect all start states that may satisfy the invariant of current_c *)
456456 List. iter (fun c ->
457- let x = R. ask_local (c.node, c.context) ~local: c.state (Queries. EvalInt c_inv) in
457+ let x = R. ask_local (c.node, c.context) ~local: c.state (Queries. EvalInt c_inv) in (* TODO: illegal query *)
458458 if Queries.ID. is_bot x || Queries.ID. is_bot_ikind x then (* dead code *)
459459 failwith " Bottom not expected when querying context state" (* Maybe this is reachable, failwith for now so we see when this happens *)
460460 else if Queries.ID. to_bool x = Some false then () (* Nothing to do, the c does definitely not satisfy the predicate of current_c *)
@@ -463,7 +463,7 @@ struct
463463 FCMap. modify_def [] (f, current_c.context) (fun cs -> c::cs) fc_map;
464464 end
465465 ) con_invs;
466- | `Bot | `Top ->
466+ | None ->
467467 (* If the context invariant is None, we will not generate a precondition invariant. Nothing to do here. *)
468468 ()
469469 end
@@ -484,25 +484,25 @@ struct
484484 let fundec = Node. find_fundec n in
485485 let pre_lvar = (Node. FunctionEntry fundec, c) in
486486 let query = Queries. Invariant Invariant. default_context in
487- begin match R. ask_local pre_lvar query with
488- | `Lifted c_inv ->
487+ begin match Invariant. to_exp ( R. ask_local pre_lvar query) with
488+ | Some c_inv ->
489489 (* Find unknowns for which the preceding start state satisfies the precondtion *)
490490 let xs = find_matching_states lvar in
491491
492492 (* Generate invariants. Give up in case one invariant could not be generated. *)
493493 let invs = GobList. fold_while_some (fun acc local ->
494494 let lvals = local_lvals n local in
495- match R. ask_local_node n ~local (Invariant {Invariant. default_context with lvals}) with
496- | `Lifted c -> Some ((`Lifted c)::acc)
497- | `Bot | `Top -> None
495+ match Invariant. to_exp ( R. ask_local_node n ~local (Invariant {Invariant. default_context with lvals}) ) with
496+ | Some c -> Some ((Invariant. of_exp c)::acc)
497+ | None -> None
498498 ) [] xs
499499 in
500500 begin match invs with
501501 | None
502502 | Some [] -> acc
503503 | Some (x ::xs ) ->
504- begin match List. fold_left (fun acc inv -> Invariant. (acc || inv) [@ coverage off]) x xs with (* bisect_ppx cannot handle redefined (||) *)
505- | `Lifted inv ->
504+ begin match Invariant. to_exp ( List. fold_left (fun acc inv -> Invariant. (acc || inv) [@ coverage off]) x xs) with (* bisect_ppx cannot handle redefined (||) *)
505+ | Some inv ->
506506 let invs = WitnessUtil.InvariantExp. process_exp inv in
507507 let c_inv = InvariantCil. exp_replace_original_name c_inv in (* cannot be split *)
508508 List. fold_left (fun acc inv ->
@@ -513,7 +513,7 @@ struct
513513 let entry = Entry. precondition_loop_invariant ~task ~location ~precondition ~invariant in
514514 entry :: acc
515515 ) acc invs
516- | `Bot | `Top -> acc
516+ | None -> acc
517517 end
518518 end
519519 | _ -> (* Do not construct precondition invariants if we cannot express precondition *)
@@ -542,8 +542,8 @@ struct
542542 Invariant. (acc || R. ask_local_node n ~local (Invariant {Invariant. default_context with lvals})) [@ coverage off] (* bisect_ppx cannot handle redefined (||) *)
543543 ) (Invariant. bot () ) ns
544544 in
545- match inv with
546- | `Lifted inv ->
545+ match Invariant. to_exp inv with
546+ | Some inv ->
547547 let fundec = Node. find_fundec (List. hd ns) in (* TODO: fix location hack *)
548548 let location_function = fundec.svar.vname in
549549 let location = Entry. location ~location: loc ~location_function in
@@ -554,7 +554,7 @@ struct
554554 incr cnt_location_invariant;
555555 invariant :: acc
556556 ) acc invs
557- | `Bot | `Top -> (* TODO: 0 for bot (dead code)? *)
557+ | None -> (* TODO: 0 for bot (dead code)? *)
558558 acc
559559 ) (Lazy. force location_nodes) invariants
560560 )
@@ -572,8 +572,8 @@ struct
572572 Invariant. (acc || R. ask_local_node n ~local (Invariant Invariant. default_context)) [@ coverage off] (* bisect_ppx cannot handle redefined (||) *)
573573 ) (Invariant. bot () ) ns
574574 in
575- match inv with
576- | `Lifted inv ->
575+ match Invariant. to_exp inv with
576+ | Some inv ->
577577 let fundec = Node. find_fundec (List. hd ns) in (* TODO: fix location hack *)
578578 let location_function = fundec.svar.vname in
579579 let location = Entry. location ~location: loc ~location_function in
@@ -584,7 +584,7 @@ struct
584584 incr cnt_loop_invariant;
585585 invariant :: acc
586586 ) acc invs
587- | `Bot | `Top -> (* TODO: 0 for bot (dead code)? *)
587+ | None -> (* TODO: 0 for bot (dead code)? *)
588588 acc
589589 )
590590 else
@@ -601,15 +601,15 @@ struct
601601 GHT. fold (fun g v acc ->
602602 match g with
603603 | `Left g -> (* global unknown from analysis Spec *)
604- begin match R. ask_global (InvariantGlobal (Obj. repr g)) with
605- | `Lifted inv ->
604+ begin match Invariant. to_exp ( R. ask_global (InvariantGlobal (Obj. repr g) )) with
605+ | Some inv ->
606606 fold_flow_insensitive_as_location ~inv (fun ~location ~inv acc ->
607607 let invariant = CilType.Exp. show inv in
608608 let invariant = Entry. location_invariant' ~location ~invariant in
609609 incr cnt_location_invariant;
610610 invariant :: acc
611611 ) acc
612- | `Bot | `Top -> (* global bot might only be possible for alloc variables, if at all, so emit nothing *)
612+ | None -> (* global bot might only be possible for alloc variables, if at all, so emit nothing *)
613613 acc
614614 end
615615 | `Right _ -> (* global unknown for FromSpec contexts *)
0 commit comments