[checkers] rename to_callee -> with_callsite

Summary:
There's not really a concept of callee here, so s/callee/callsite/, and "to"
suggests we get the callee whereas we update it, so s/to/with/.

Feel free to bikeshed further.

Reviewed By: sblackshear

Differential Revision: D4153426

fbshipit-source-id: 6ea762c
master
Jules Villard 8 years ago committed by Facebook Github Bot
parent caf9537305
commit 7705ffbc31

@ -22,8 +22,8 @@ module type S = sig
(** get a path for each of the reportable flows to a sink in this trace *) (** get a path for each of the reportable flows to a sink in this trace *)
val get_reportable_sink_paths : t -> trace_of_pname:(Procname.t -> t) -> sink_path list val get_reportable_sink_paths : t -> trace_of_pname:(Procname.t -> t) -> sink_path list
(** convert of the sinks to callee sinks for the given call site *) (** update sink with the given call site *)
val to_callee : t -> CallSite.t -> t val with_callsite : t -> CallSite.t -> t
end end
module MakeSink(TraceElem : TraceElem.S) = struct module MakeSink(TraceElem : TraceElem.S) = struct
@ -49,10 +49,10 @@ module Make (TraceElem : TraceElem.S) = struct
(fun (passthroughs, _, sinks) -> passthroughs, sinks) (fun (passthroughs, _, sinks) -> passthroughs, sinks)
(get_reportable_paths t ~trace_of_pname) (get_reportable_paths t ~trace_of_pname)
let to_callee t call_site = let with_callsite t call_site =
IList.fold_left IList.fold_left
(fun t_acc sink -> (fun t_acc sink ->
let callee_sink = Sink.to_callee sink call_site in let callee_sink = Sink.with_callsite sink call_site in
add_sink callee_sink t_acc) add_sink callee_sink t_acc)
initial initial
(Sinks.elements (sinks t)) (Sinks.elements (sinks t))

@ -18,8 +18,8 @@ module type S = sig
(** get a path for each of the reportable flows to a sink in this trace *) (** get a path for each of the reportable flows to a sink in this trace *)
val get_reportable_sink_paths : t -> trace_of_pname:(Procname.t -> t) -> sink_path list val get_reportable_sink_paths : t -> trace_of_pname:(Procname.t -> t) -> sink_path list
(** convert of the sinks to callee sinks for the given call site *) (** update sink with the given call site *)
val to_callee : t -> CallSite.t -> t val with_callsite : t -> CallSite.t -> t
end end
module MakeSink (TraceElem : TraceElem.S) : module MakeSink (TraceElem : TraceElem.S) :

@ -76,8 +76,10 @@ module TransferFunctions (CFG : ProcCfg.S) = struct
let callsite = CallSite.make callee_pname loc in let callsite = CallSite.make callee_pname loc in
let callee_globals = let callee_globals =
match Summary.read_summary tenv pdesc callee_pname with match Summary.read_summary tenv pdesc callee_pname with
| Some (Domain.NonBottom trace) -> Domain.NonBottom (SiofTrace.to_callee trace callsite) | Some (Domain.NonBottom trace) ->
| _ -> Domain.Bottom in Domain.NonBottom (SiofTrace.with_callsite trace callsite)
| _ ->
Domain.Bottom in
add_params_globals astate tenv pdesc loc params add_params_globals astate tenv pdesc loc params
|> Domain.join callee_globals |> Domain.join callee_globals
|> |>

@ -32,7 +32,7 @@ include SinkTrace.Make(struct
let make kind site = { kind; site; } let make kind site = { kind; site; }
let to_callee t site = { t with site; } let with_callsite t site = { t with site; }
let compare t1 t2 = let compare t1 t2 =
CallSite.compare t1.site t2.site CallSite.compare t1.site t2.site

@ -50,5 +50,5 @@ module Dummy = struct
let pp_element = pp let pp_element = pp
end) end)
let to_callee t _ = t let with_callsite t _ = t
end end

@ -245,7 +245,7 @@ module Make (Spec : Spec) = struct
caller_trace.sources caller_trace.sources
else else
IList.map IList.map
(fun sink -> Source.to_callee sink callee_site) (fun sink -> Source.with_callsite sink callee_site)
(Sources.elements non_footprint_callee_sources) (Sources.elements non_footprint_callee_sources)
|> Sources.of_list |> Sources.of_list
|> Sources.union caller_trace.sources in |> Sources.union caller_trace.sources in
@ -256,7 +256,7 @@ module Make (Spec : Spec) = struct
caller_trace.sinks caller_trace.sinks
else else
IList.map IList.map
(fun sink -> Sink.to_callee sink callee_site) (fun sink -> Sink.with_callsite sink callee_site)
(Sinks.elements callee_trace.sinks) (Sinks.elements callee_trace.sinks)
|> Sinks.of_list |> Sinks.of_list
|> Sinks.union caller_trace.sinks in |> Sinks.union caller_trace.sinks in

@ -25,7 +25,7 @@ module type S = sig
val kind : t -> Kind.t val kind : t -> Kind.t
val make : Kind.t -> CallSite.t -> t val make : Kind.t -> CallSite.t -> t
val to_callee : t -> CallSite.t -> t val with_callsite : t -> CallSite.t -> t
val pp : F.formatter -> t -> unit val pp : F.formatter -> t -> unit

@ -79,7 +79,7 @@ module CppSource = struct
| pname -> | pname ->
failwithf "Non-C++ procname %a in C++ analysis@." Procname.pp pname failwithf "Non-C++ procname %a in C++ analysis@." Procname.pp pname
let to_callee t callee_site = let with_callsite t callee_site =
{ t with site = callee_site; } { t with site = callee_site; }
let compare src1 src2 = let compare src1 src2 =
@ -159,7 +159,7 @@ module CppSink = struct
| pname -> | pname ->
failwithf "Non-C++ procname %a in C++ analysis@." Procname.pp pname failwithf "Non-C++ procname %a in C++ analysis@." Procname.pp pname
let to_callee t callee_site = let with_callsite t callee_site =
{ t with site = callee_site; } { t with site = callee_site; }
let compare snk1 snk2 = let compare snk1 snk2 =

@ -85,7 +85,7 @@ module JavaSource = struct
| pname when BuiltinDecl.is_declared pname -> None | pname when BuiltinDecl.is_declared pname -> None
| pname -> failwithf "Non-Java procname %a in Java analysis@." Procname.pp pname | pname -> failwithf "Non-Java procname %a in Java analysis@." Procname.pp pname
let to_callee t callee_site = let with_callsite t callee_site =
{ t with site = callee_site; } { t with site = callee_site; }
let compare src1 src2 = let compare src1 src2 =
@ -181,7 +181,7 @@ module JavaSink = struct
| pname when BuiltinDecl.is_declared pname -> [] | pname when BuiltinDecl.is_declared pname -> []
| pname -> failwithf "Non-Java procname %a in Java analysis@." Procname.pp pname | pname -> failwithf "Non-Java procname %a in Java analysis@." Procname.pp pname
let to_callee t callee_site = let with_callsite t callee_site =
{ t with site = callee_site; } { t with site = callee_site; }
let compare snk1 snk2 = let compare snk1 snk2 =

@ -27,7 +27,7 @@ module MockTrace = Trace.Make(struct
let compare = CallSite.compare let compare = CallSite.compare
let pp = CallSite.pp let pp = CallSite.pp
let to_callee t _ = t let with_callsite t _ = t
module Set = PrettyPrintable.MakePPSet(struct module Set = PrettyPrintable.MakePPSet(struct
type nonrec t = t type nonrec t = t

@ -54,7 +54,7 @@ module MockTraceElem = struct
let pp_element = pp let pp_element = pp
end) end)
let to_callee t _ = t let with_callsite t _ = t
end end
module MockSource = struct module MockSource = struct

Loading…
Cancel
Save