@@ -54,7 +54,7 @@ let current_node_state_json : (Node.t -> Yojson.Safe.t option) ref = ref (fun _
54
54
let current_varquery_global_state_json: (VarQuery. t option -> Yojson.Safe. t) ref = ref (fun _ -> `Null )
55
55
56
56
(* * Given a [Cfg], a [Spec], and an [Inc], computes the solution to [MCP.Path] *)
57
- module AnalyzeCFG (Cfg :CfgBidir ) (Spec :Spec ) (Inc :Increment ) =
57
+ module AnalyzeCFG (Cfg :CfgBidirSkip ) (Spec :Spec ) (Inc :Increment ) =
58
58
struct
59
59
60
60
module SpecSys : SpecSys with module Spec = Spec =
@@ -230,7 +230,7 @@ struct
230
230
res
231
231
232
232
(* * The main function to preform the selected analyses. *)
233
- let analyze (file : file ) (startfuns , exitfuns , otherfuns : Analyses.fundecs ) skippedByEdge =
233
+ let analyze (file : file ) (startfuns , exitfuns , otherfuns : Analyses.fundecs ) =
234
234
let module FileCfg: FileCfg =
235
235
struct
236
236
let file = file
@@ -625,13 +625,16 @@ struct
625
625
let node_values = LHT. enum lh |> map (Tuple2. map1 fst) in (* drop context from key *)
626
626
let hashtbl_size = if fast_count node_values then count node_values else 123 in
627
627
let by_loc, by_node = Hashtbl. create hashtbl_size, NodeH. create hashtbl_size in
628
- node_values |> iter (fun (node , v ) ->
629
- let loc = Node. location node in
630
- (* join values once for the same location and once for the same node *)
631
- let join = Option. some % function None -> v | Some v' -> Spec.D. join v v' in
632
- Hashtbl. modify_opt loc join by_loc;
633
- NodeH. modify_opt node join by_node;
634
- );
628
+ iter (fun (node , v ) ->
629
+ let loc = match node with
630
+ | Statement s -> Cil. get_stmtLoc s.skind (* nosemgrep: cilfacade *) (* Must use CIL's because syntactic search is in CIL. *)
631
+ | FunctionEntry _ | Function _ -> Node. location node
632
+ in
633
+ (* join values once for the same location and once for the same node *)
634
+ let join = Option. some % function None -> v | Some v' -> Spec.D. join v v' in
635
+ Hashtbl. modify_opt loc join by_loc;
636
+ NodeH. modify_opt node join by_node;
637
+ ) node_values;
635
638
by_loc, by_node
636
639
in
637
640
@@ -656,7 +659,10 @@ struct
656
659
let must_be_uncalled fd = not @@ BatSet.Int. mem fd.svar.vid calledFuns in
657
660
658
661
let skipped_statements from_node edge to_node =
659
- CfgTools.CfgEdgeH. find_default skippedByEdge (from_node, edge, to_node) []
662
+ try
663
+ Cfg. skippedByEdge from_node edge to_node
664
+ with Not_found ->
665
+ []
660
666
in
661
667
662
668
Transform. run_transformations file active_transformations
@@ -793,22 +799,22 @@ end
793
799
[analyze_loop] cannot reside in it anymore since each invocation of
794
800
[get_spec] in the loop might/should return a different module, and we
795
801
cannot swap the functor parameter from inside [AnalyzeCFG]. *)
796
- let rec analyze_loop (module CFG : CfgBidir ) file fs change_info skippedByEdge =
802
+ let rec analyze_loop (module CFG : CfgBidirSkip ) file fs change_info =
797
803
try
798
804
let (module Spec ) = get_spec () in
799
805
let module A = AnalyzeCFG (CFG ) (Spec ) (struct let increment = change_info end ) in
800
- GobConfig. with_immutable_conf (fun () -> A. analyze file fs skippedByEdge )
806
+ GobConfig. with_immutable_conf (fun () -> A. analyze file fs)
801
807
with Refinement. RestartAnalysis ->
802
808
(* Tail-recursively restart the analysis again, when requested.
803
809
All solving starts from scratch.
804
810
Whoever raised the exception should've modified some global state
805
811
to do a more precise analysis next time. *)
806
812
(* TODO: do some more incremental refinement and reuse parts of solution *)
807
- analyze_loop (module CFG ) file fs change_info skippedByEdge
813
+ analyze_loop (module CFG ) file fs change_info
808
814
809
815
(* * The main function to perform the selected analyses. *)
810
816
let analyze change_info (file : file ) fs =
811
817
Logs. debug " Generating the control flow graph." ;
812
- let (module CFG ), skippedByEdge = CfgTools. compute_cfg_skips file in
818
+ let (module CFG ) = CfgTools. compute_cfg file in
813
819
MyCFG. current_cfg := (module CFG );
814
- analyze_loop (module CFG ) file fs change_info skippedByEdge
820
+ analyze_loop (module CFG ) file fs change_info
0 commit comments