From a2930b70070dcce73df3421e3fda19df7d090438 Mon Sep 17 00:00:00 2001 From: Josh Berdine Date: Fri, 9 Dec 2016 16:25:23 -0800 Subject: [PATCH] Core.Std.Int Reviewed By: cristianoc Differential Revision: D4232424 fbshipit-source-id: 9f24a64 --- infer/src/IR/Procdesc.re | 4 ++-- infer/src/backend/InferPrint.re | 2 +- infer/src/backend/interproc.ml | 6 +++--- infer/src/backend/paths.ml | 2 +- infer/src/backend/prover.ml | 2 +- infer/src/backend/symExec.ml | 2 +- infer/src/base/Utils.ml | 6 ++++-- infer/src/base/Utils.mli | 2 ++ infer/src/checkers/dataflow.ml | 2 +- infer/src/unit/schedulerTests.ml | 4 ++-- 10 files changed, 18 insertions(+), 14 deletions(-) diff --git a/infer/src/IR/Procdesc.re b/infer/src/IR/Procdesc.re index a21bef2e8..48e53e8ac 100644 --- a/infer/src/IR/Procdesc.re +++ b/infer/src/IR/Procdesc.re @@ -63,7 +63,7 @@ let module Node = { preds: [], exn: [] }; - let compare node1 node2 => Core.Std.Int.compare node1.id node2.id; + let compare node1 node2 => Int.compare node1.id node2.id; let hash node => Hashtbl.hash node.id; let equal node1 node2 => compare node1 node2 == 0; @@ -71,7 +71,7 @@ let module Node = { let get_id node => node.id; /** compare node ids */ - let compare_id = Core.Std.Int.compare; + let compare_id = Int.compare; let get_succs node => node.succs; type node = t; let module NodeSet = Set.Make { diff --git a/infer/src/backend/InferPrint.re b/infer/src/backend/InferPrint.re index e06fa9b8d..06108e64f 100644 --- a/infer/src/backend/InferPrint.re +++ b/infer/src/backend/InferPrint.re @@ -1250,7 +1250,7 @@ let module AnalysisResults = { if (n != 0) { n } else { - Core.Std.Int.compare + Int.compare summ1.Specs.attributes.ProcAttributes.loc.Location.line summ2.Specs.attributes.ProcAttributes.loc.Location.line } diff --git a/infer/src/backend/interproc.ml b/infer/src/backend/interproc.ml index 7e048abc6..839c98fa4 100644 --- a/infer/src/backend/interproc.ml +++ b/infer/src/backend/interproc.ml @@ -41,10 +41,10 @@ module NodeVisitSet = - 1 | Some d1, Some d2 -> (* shorter distance to exit is better *) - Core.Std.Int.compare d1 d2 in + Int.compare d1 d2 in if n <> 0 then n else compare_ids n1 n2 let compare_number_of_visits x1 x2 = - let n = Core.Std.Int.compare x1.visits x2.visits in (* visited fewer times is better *) + let n = Int.compare x1.visits x2.visits in (* visited fewer times is better *) if n <> 0 then n else compare_distance_to_exit x1 x2 let compare x1 x2 = if !Config.footprint then @@ -728,7 +728,7 @@ let compute_visited vset = let node_loc = Procdesc.Node.get_loc n in let instrs_loc = IList.map Sil.instr_get_loc (Procdesc.Node.get_instrs n) in let lines = IList.map (fun loc -> loc.Location.line) (node_loc :: instrs_loc) in - IList.remove_duplicates Core.Std.Int.compare (IList.sort Core.Std.Int.compare lines) in + IList.remove_duplicates Int.compare (IList.sort Int.compare lines) in let do_node n = res := Specs.Visitedset.add (Procdesc.Node.get_id n, node_get_all_lines n) !res in diff --git a/infer/src/backend/paths.ml b/infer/src/backend/paths.ml index de39c3a53..178c87557 100644 --- a/infer/src/backend/paths.ml +++ b/infer/src/backend/paths.ml @@ -490,7 +490,7 @@ end = struct () in iter_shortest_sequence g pos_opt path; let compare lt1 lt2 = - let n = Core.Std.Int.compare lt1.Errlog.lt_level lt2.Errlog.lt_level in + let n = Int.compare lt1.Errlog.lt_level lt2.Errlog.lt_level in if n <> 0 then n else Location.compare lt1.Errlog.lt_loc lt2.Errlog.lt_loc in let relevant lt = lt.Errlog.lt_node_tags <> [] in IList.remove_irrelevant_duplicates compare relevant (IList.rev !trace) diff --git a/infer/src/backend/prover.ml b/infer/src/backend/prover.ml index f245957c8..ef3c7a383 100644 --- a/infer/src/backend/prover.ml +++ b/infer/src/backend/prover.ml @@ -2232,7 +2232,7 @@ exception NO_COVER (** Find miminum set of pi's in [cases] whose disjunction covers true *) let find_minimum_pure_cover tenv cases = let cases = - let compare (pi1, _) (pi2, _) = Core.Std.Int.compare (IList.length pi1) (IList.length pi2) + let compare (pi1, _) (pi2, _) = Int.compare (IList.length pi1) (IList.length pi2) in IList.sort compare cases in let rec grow seen todo = match todo with | [] -> raise NO_COVER diff --git a/infer/src/backend/symExec.ml b/infer/src/backend/symExec.ml index 522016ccf..604b7c853 100644 --- a/infer/src/backend/symExec.ml +++ b/infer/src/backend/symExec.ml @@ -1335,7 +1335,7 @@ and add_constraints_on_actuals_by_ref tenv prop actuals_by_ref callee_pname call let is_not_const (e, _, i) = match AttributesTable.load_attributes callee_pname with | Some attrs -> - let is_const = IList.mem Core.Std.Int.equal i attrs.ProcAttributes.const_formals in + let is_const = IList.mem Int.equal i attrs.ProcAttributes.const_formals in if is_const then ( L.d_str (Printf.sprintf "Not havocing const argument number %d: " i); Sil.d_exp e; diff --git a/infer/src/base/Utils.ml b/infer/src/base/Utils.ml index 75d16097b..41a78d2ff 100644 --- a/infer/src/base/Utils.ml +++ b/infer/src/base/Utils.ml @@ -10,6 +10,8 @@ (** General utility functions and definition with global scope *) +module Int = Core.Std.Int + module F = Format (** List police: don't use the list module to avoid non-tail recursive @@ -40,7 +42,7 @@ let int_of_bool b = if b then 1 else 0 (** {2 Useful Modules} *) (** Set of integers *) -module IntSet = Set.Make(Core.Std.Int) +module IntSet = Set.Make(Int) (** Hash table over strings *) module StringHash = Hashtbl.Make (Core.Std.String) @@ -68,7 +70,7 @@ module StringPPSet = PrettyPrintable.MakePPSet(struct end) (** Maps from integers *) -module IntMap = Map.Make (Core.Std.Int) +module IntMap = Map.Make (Int) (** Maps from strings *) module StringMap = Map.Make (Core.Std.String) diff --git a/infer/src/base/Utils.mli b/infer/src/base/Utils.mli index e196e0d4d..a677d4025 100644 --- a/infer/src/base/Utils.mli +++ b/infer/src/base/Utils.mli @@ -10,6 +10,8 @@ (** General utility functions *) +module Int = Core.Std.Int + (** {2 Generic Utility Functions} *) (** List police: don't use the list module to avoid non-tail recursive diff --git a/infer/src/checkers/dataflow.ml b/infer/src/checkers/dataflow.ml index 0ac05ee6f..8c88db373 100644 --- a/infer/src/checkers/dataflow.ml +++ b/infer/src/checkers/dataflow.ml @@ -175,7 +175,7 @@ let callback_test_dataflow { Callbacks.proc_desc; tenv } = let verbose = false in let module DFCount = MakeDF(struct type t = int - let equal = Core.Std.Int.equal + let equal = Int.equal let join n m = if n = 0 then m else n let do_node _ n s = if verbose then L.stdout "visiting node %a with state %d@." Procdesc.Node.pp n s; diff --git a/infer/src/unit/schedulerTests.ml b/infer/src/unit/schedulerTests.ml index 29d886f05..2c764b1dd 100644 --- a/infer/src/unit/schedulerTests.ml +++ b/infer/src/unit/schedulerTests.ml @@ -25,7 +25,7 @@ module MockNode = struct let loc _ = assert false let underlying_id _ = assert false let kind _ = Procdesc.Node.Stmt_node "" - let compare_id = Core.Std.Int.compare + let compare_id = Int.compare let pp_id fmt i = F.fprintf fmt "%i" i end @@ -35,7 +35,7 @@ module MockProcCfg = struct include (MockNode : module type of MockNode with type t := node) type t = (node * node list) list - let compare_id = Core.Std.Int.compare + let compare_id = Int.compare let succs t n = try