Core.Std.Int

Reviewed By: cristianoc

Differential Revision: D4232424

fbshipit-source-id: 9f24a64
master
Josh Berdine 8 years ago committed by Facebook Github Bot
parent a0b83ed693
commit a2930b7007

@ -63,7 +63,7 @@ let module Node = {
preds: [], preds: [],
exn: [] 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 hash node => Hashtbl.hash node.id;
let equal node1 node2 => compare node1 node2 == 0; let equal node1 node2 => compare node1 node2 == 0;
@ -71,7 +71,7 @@ let module Node = {
let get_id node => node.id; let get_id node => node.id;
/** compare node ids */ /** compare node ids */
let compare_id = Core.Std.Int.compare; let compare_id = Int.compare;
let get_succs node => node.succs; let get_succs node => node.succs;
type node = t; type node = t;
let module NodeSet = Set.Make { let module NodeSet = Set.Make {

@ -1250,7 +1250,7 @@ let module AnalysisResults = {
if (n != 0) { if (n != 0) {
n n
} else { } else {
Core.Std.Int.compare Int.compare
summ1.Specs.attributes.ProcAttributes.loc.Location.line summ1.Specs.attributes.ProcAttributes.loc.Location.line
summ2.Specs.attributes.ProcAttributes.loc.Location.line summ2.Specs.attributes.ProcAttributes.loc.Location.line
} }

@ -41,10 +41,10 @@ module NodeVisitSet =
- 1 - 1
| Some d1, Some d2 -> | Some d1, Some d2 ->
(* shorter distance to exit is better *) (* 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 if n <> 0 then n else compare_ids n1 n2
let compare_number_of_visits x1 x2 = 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 if n <> 0 then n else compare_distance_to_exit x1 x2
let compare x1 x2 = let compare x1 x2 =
if !Config.footprint then if !Config.footprint then
@ -728,7 +728,7 @@ let compute_visited vset =
let node_loc = Procdesc.Node.get_loc n in 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 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 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 = let do_node n =
res := res :=
Specs.Visitedset.add (Procdesc.Node.get_id n, node_get_all_lines n) !res in Specs.Visitedset.add (Procdesc.Node.get_id n, node_get_all_lines n) !res in

@ -490,7 +490,7 @@ end = struct
() in () in
iter_shortest_sequence g pos_opt path; iter_shortest_sequence g pos_opt path;
let compare lt1 lt2 = 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 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 let relevant lt = lt.Errlog.lt_node_tags <> [] in
IList.remove_irrelevant_duplicates compare relevant (IList.rev !trace) IList.remove_irrelevant_duplicates compare relevant (IList.rev !trace)

@ -2232,7 +2232,7 @@ exception NO_COVER
(** Find miminum set of pi's in [cases] whose disjunction covers true *) (** Find miminum set of pi's in [cases] whose disjunction covers true *)
let find_minimum_pure_cover tenv cases = let find_minimum_pure_cover tenv cases =
let 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 in IList.sort compare cases in
let rec grow seen todo = match todo with let rec grow seen todo = match todo with
| [] -> raise NO_COVER | [] -> raise NO_COVER

@ -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) = let is_not_const (e, _, i) =
match AttributesTable.load_attributes callee_pname with match AttributesTable.load_attributes callee_pname with
| Some attrs -> | 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 ( if is_const then (
L.d_str (Printf.sprintf "Not havocing const argument number %d: " i); L.d_str (Printf.sprintf "Not havocing const argument number %d: " i);
Sil.d_exp e; Sil.d_exp e;

@ -10,6 +10,8 @@
(** General utility functions and definition with global scope *) (** General utility functions and definition with global scope *)
module Int = Core.Std.Int
module F = Format module F = Format
(** List police: don't use the list module to avoid non-tail recursive (** 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} *) (** {2 Useful Modules} *)
(** Set of integers *) (** Set of integers *)
module IntSet = Set.Make(Core.Std.Int) module IntSet = Set.Make(Int)
(** Hash table over strings *) (** Hash table over strings *)
module StringHash = Hashtbl.Make (Core.Std.String) module StringHash = Hashtbl.Make (Core.Std.String)
@ -68,7 +70,7 @@ module StringPPSet = PrettyPrintable.MakePPSet(struct
end) end)
(** Maps from integers *) (** Maps from integers *)
module IntMap = Map.Make (Core.Std.Int) module IntMap = Map.Make (Int)
(** Maps from strings *) (** Maps from strings *)
module StringMap = Map.Make (Core.Std.String) module StringMap = Map.Make (Core.Std.String)

@ -10,6 +10,8 @@
(** General utility functions *) (** General utility functions *)
module Int = Core.Std.Int
(** {2 Generic Utility Functions} *) (** {2 Generic Utility Functions} *)
(** List police: don't use the list module to avoid non-tail recursive (** List police: don't use the list module to avoid non-tail recursive

@ -175,7 +175,7 @@ let callback_test_dataflow { Callbacks.proc_desc; tenv } =
let verbose = false in let verbose = false in
let module DFCount = MakeDF(struct let module DFCount = MakeDF(struct
type t = int 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 join n m = if n = 0 then m else n
let do_node _ n s = let do_node _ n s =
if verbose then L.stdout "visiting node %a with state %d@." Procdesc.Node.pp n s; if verbose then L.stdout "visiting node %a with state %d@." Procdesc.Node.pp n s;

@ -25,7 +25,7 @@ module MockNode = struct
let loc _ = assert false let loc _ = assert false
let underlying_id _ = assert false let underlying_id _ = assert false
let kind _ = Procdesc.Node.Stmt_node "" let kind _ = Procdesc.Node.Stmt_node ""
let compare_id = Core.Std.Int.compare let compare_id = Int.compare
let pp_id fmt i = let pp_id fmt i =
F.fprintf fmt "%i" i F.fprintf fmt "%i" i
end end
@ -35,7 +35,7 @@ module MockProcCfg = struct
include (MockNode : module type of MockNode with type t := node) include (MockNode : module type of MockNode with type t := node)
type t = (node * node list) list type t = (node * node list) list
let compare_id = Core.Std.Int.compare let compare_id = Int.compare
let succs t n = let succs t n =
try try

Loading…
Cancel
Save