You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.3 KiB
59 lines
1.3 KiB
8 years ago
|
(*
|
||
6 years ago
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
8 years ago
|
*
|
||
7 years ago
|
* This source code is licensed under the MIT license found in the
|
||
|
* LICENSE file in the root directory of this source tree.
|
||
8 years ago
|
*)
|
||
|
|
||
8 years ago
|
open! IStd
|
||
8 years ago
|
module F = Format
|
||
|
|
||
|
module type Kind = sig
|
||
5 years ago
|
include TaintTraceElem.Kind
|
||
8 years ago
|
|
||
5 years ago
|
val get : Procname.t -> HilExp.t list -> CallFlags.t -> Tenv.t -> (t * IntSet.t) list
|
||
8 years ago
|
end
|
||
8 years ago
|
|
||
8 years ago
|
module type S = sig
|
||
5 years ago
|
include TaintTraceElem.S
|
||
8 years ago
|
|
||
6 years ago
|
val get : CallSite.t -> HilExp.t list -> CallFlags.t -> Tenv.t -> t list
|
||
8 years ago
|
|
||
|
val indexes : t -> IntSet.t
|
||
6 years ago
|
|
||
|
val with_indexes : t -> IntSet.t -> t
|
||
8 years ago
|
end
|
||
|
|
||
|
module Make (Kind : Kind) = struct
|
||
|
module Kind = Kind
|
||
|
|
||
8 years ago
|
type t = {kind: Kind.t; site: CallSite.t; indexes: IntSet.t} [@@deriving compare]
|
||
8 years ago
|
|
||
8 years ago
|
let kind t = t.kind
|
||
8 years ago
|
|
||
8 years ago
|
let call_site t = t.site
|
||
8 years ago
|
|
||
8 years ago
|
let indexes t = t.indexes
|
||
8 years ago
|
|
||
6 years ago
|
let make ?(indexes = IntSet.empty) kind site = {kind; site; indexes}
|
||
8 years ago
|
|
||
7 years ago
|
let get site actuals call_flags tenv =
|
||
6 years ago
|
Kind.get (CallSite.pname site) actuals call_flags tenv
|
||
|
|> List.rev_map ~f:(fun (kind, indexes) -> {kind; site; indexes})
|
||
7 years ago
|
|
||
8 years ago
|
|
||
|
let with_callsite t callee_site = {t with site= callee_site}
|
||
|
|
||
6 years ago
|
let with_indexes t indexes = {t with indexes}
|
||
|
|
||
8 years ago
|
let pp fmt s = F.fprintf fmt "%a(%a)" Kind.pp s.kind CallSite.pp s.site
|
||
8 years ago
|
|
||
8 years ago
|
module Set = PrettyPrintable.MakePPSet (struct
|
||
|
type nonrec t = t
|
||
8 years ago
|
|
||
8 years ago
|
let compare = compare
|
||
8 years ago
|
|
||
8 years ago
|
let pp = pp
|
||
|
end)
|
||
8 years ago
|
end
|