[inferbo] Type name for eval_sym

Reviewed By: skcho

Differential Revision: D13071774

fbshipit-source-id: 1dc412646
master
Mehdi Bouaziz 6 years ago committed by Facebook Github Bot
parent 68a08a8a09
commit 7c00591747

@ -56,7 +56,7 @@ module ArrInfo = struct
let diff : t -> t -> Itv.astate = fun arr1 arr2 -> Itv.minus arr1.offset arr2.offset
let subst : t -> (Symb.Symbol.t -> Bounds.Bound.t bottom_lifted) -> t =
let subst : t -> Bound.eval_sym -> t =
fun arr eval_sym ->
{arr with offset= Itv.subst arr.offset eval_sym; size= Itv.subst arr.size eval_sym}
@ -141,7 +141,7 @@ let get_pow_loc : astate -> PowLoc.t =
fold pow_loc_of_allocsite array PowLoc.bot
let subst : astate -> (Symb.Symbol.t -> Bound.t bottom_lifted) -> astate =
let subst : astate -> Bound.eval_sym -> astate =
fun a eval_sym -> map (fun info -> ArrInfo.subst info eval_sym) a

@ -229,6 +229,8 @@ module Bound = struct
| PInf
[@@deriving compare]
type eval_sym = t Symb.Symbol.eval
let equal = [%compare.equal: t]
let pp : F.formatter -> t -> unit =
@ -812,8 +814,7 @@ module Bound = struct
(** Substitutes ALL symbols in [x] with respect to [eval_sym]. Under/over-Approximate as good as possible according to [subst_pos]. *)
let subst :
subst_pos:Symb.BoundEnd.t -> t -> (Symb.Symbol.t -> t bottom_lifted) -> t bottom_lifted =
let subst : subst_pos:Symb.BoundEnd.t -> t -> eval_sym -> t bottom_lifted =
fun ~subst_pos x eval_sym ->
let get s =
match eval_sym s with

@ -35,6 +35,8 @@ module Bound : sig
| MinMax of Z.t * sign * min_max * Z.t * Symb.Symbol.t
| PInf
type eval_sym = t Symb.Symbol.eval
val compare : t -> t -> int
val equal : t -> t -> bool
@ -109,15 +111,9 @@ module Bound : sig
val is_not_infty : t -> bool
val subst_lb :
t
-> (Symb.Symbol.t -> t AbstractDomain.Types.bottom_lifted)
-> t AbstractDomain.Types.bottom_lifted
val subst_lb : t -> eval_sym -> t AbstractDomain.Types.bottom_lifted
val subst_ub :
t
-> (Symb.Symbol.t -> t AbstractDomain.Types.bottom_lifted)
-> t AbstractDomain.Types.bottom_lifted
val subst_ub : t -> eval_sym -> t AbstractDomain.Types.bottom_lifted
val simplify_bound_ends_from_paths : t -> t

@ -295,11 +295,7 @@ module Val = struct
fun x -> {x with itv= Itv.normalize x.itv; arrayblk= ArrayBlk.normalize x.arrayblk}
let subst :
t
-> (Symb.Symbol.t -> Bounds.Bound.t bottom_lifted) * (Symb.Symbol.t -> TraceSet.t)
-> Location.t
-> t =
let subst : t -> Bounds.Bound.eval_sym * (Symb.Symbol.t -> TraceSet.t) -> Location.t -> t =
fun x (eval_sym, trace_of_sym) location ->
let symbols = get_symbols x in
let traces_caller =

@ -289,12 +289,7 @@ module ArrayAccessCondition = struct
{report_issue_type; propagate= is_symbolic}
let subst :
(Symb.Symbol.t -> Bound.t bottom_lifted)
-> Relation.SubstMap.t
-> Relation.astate
-> t
-> t option =
let subst : Bound.eval_sym -> Relation.SubstMap.t -> Relation.astate -> t -> t option =
fun eval_sym rel_map caller_relation c ->
match
(ItvPure.subst c.offset eval_sym, ItvPure.subst c.idx eval_sym, ItvPure.subst c.size eval_sym)

@ -63,7 +63,7 @@ module ConditionSet : sig
val subst :
summary_t
-> (Symb.Symbol.t -> Bounds.Bound.t bottom_lifted) * (Symb.Symbol.t -> ValTraceSet.t)
-> Bounds.Bound.eval_sym * (Symb.Symbol.t -> ValTraceSet.t)
-> Relation.SubstMap.t
-> Relation.astate
-> Typ.Procname.t

@ -79,7 +79,7 @@ module type NonNegativeSymbol = sig
val int_ub : t -> NonNegativeInt.t option
val subst : t -> (Symb.Symbol.t -> t bottom_lifted) -> (NonNegativeInt.t, t) Bounds.valclass
val subst : t -> t Symb.Symbol.eval -> (NonNegativeInt.t, t) Bounds.valclass
val pp : F.formatter -> t -> unit
end
@ -780,7 +780,7 @@ module ItvPure = struct
let normalize : t -> t bottom_lifted = fun x -> if is_invalid x then Bottom else NonBottom x
let subst : t -> (Symb.Symbol.t -> Bound.t bottom_lifted) -> t bottom_lifted =
let subst : t -> Bound.eval_sym -> t bottom_lifted =
fun (l, u) eval_sym ->
match (Bound.subst_lb l eval_sym, Bound.subst_ub u eval_sym) with
| NonBottom l, NonBottom u ->
@ -1025,7 +1025,7 @@ let prune_eq : t -> t -> t = bind2 ItvPure.prune_eq
let prune_ne : t -> t -> t = bind2 ItvPure.prune_ne
let subst : t -> (Symb.Symbol.t -> Bound.t bottom_lifted) -> t =
let subst : t -> Bound.eval_sym -> t =
fun x eval_sym -> match x with NonBottom x' -> ItvPure.subst x' eval_sym | _ -> x

@ -50,7 +50,7 @@ module NonNegativePolynomial : sig
val min_default_left : astate -> astate -> astate
val subst : astate -> (Symb.Symbol.t -> Bound.t bottom_lifted) -> astate
val subst : astate -> Bound.eval_sym -> astate
val degree : astate -> int option
@ -138,7 +138,7 @@ module ItvPure : sig
val get_symbols : t -> SymbolSet.t
val subst : t -> (Symb.Symbol.t -> Bound.t bottom_lifted) -> t bottom_lifted
val subst : t -> Bound.eval_sym -> t bottom_lifted
val neg : t -> t
@ -253,4 +253,4 @@ val prune_eq : t -> t -> t
val prune_ne : t -> t -> t
val subst : t -> (Symb.Symbol.t -> Bound.t bottom_lifted) -> t
val subst : t -> Bound.eval_sym -> t

@ -57,6 +57,8 @@ module Symbol = struct
type t =
{id: int; pname: Typ.Procname.t; unsigned: bool; path: SymbolPath.t; bound_end: BoundEnd.t}
type 'res eval = t -> 'res AbstractDomain.Types.bottom_lifted
let compare s1 s2 =
(* Symbols only make sense within a given function, so shouldn't be compared across function boundaries. *)
assert (phys_equal s1.pname s2.pname) ;

@ -38,6 +38,8 @@ end
module Symbol : sig
type t
type 'res eval = t -> 'res AbstractDomain.Types.bottom_lifted
val compare : t -> t -> int
val is_unsigned : t -> bool

Loading…
Cancel
Save