[explicitrace] pp_human -> describe

Summary: `describe` is simply better.

Reviewed By: jvillard

Differential Revision: D17549700

fbshipit-source-id: 5c8719141
master
Nikos Gorogiannis 5 years ago committed by Facebook Github Bot
parent e44827b892
commit fd40a5df6c

@ -11,7 +11,7 @@ module L = Logging
module ClassLoad = struct
include String
let pp_human = pp
let describe = pp
let pp_call = ExplicitTrace.default_pp_call
end

@ -21,7 +21,7 @@ end
module type Element = sig
include PrettyPrintable.PrintableOrderedType
val pp_human : Format.formatter -> t -> unit
val describe : Format.formatter -> t -> unit
val pp_call : Format.formatter -> CallSite.t -> unit
end
@ -65,7 +65,7 @@ module MakeTraceElemWithComparator (Elem : Element) (Comp : Comparator with type
let pp fmt {elem} = Elem.pp fmt elem
let pp_human fmt {elem} = Elem.pp_human fmt elem
let describe fmt {elem} = Elem.describe fmt elem
let pp_call = Elem.pp_call
end
@ -88,7 +88,7 @@ module MakeTraceElemWithComparator (Elem : Element) (Comp : Comparator with type
let call = Errlog.make_trace_element ns (CallSite.loc callsite) descr [] in
(call :: tr, ns + 1) )
in
let endpoint_descr = F.asprintf "%a" Elem.pp_human e.elem in
let endpoint_descr = F.asprintf "%a" Elem.describe e.elem in
let endpoint = Errlog.make_trace_element nesting e.loc endpoint_descr [] in
List.rev (endpoint :: call_trace)

@ -20,7 +20,7 @@ end
module type Element = sig
include PrettyPrintable.PrintableOrderedType
val pp_human : Format.formatter -> t -> unit
val describe : Format.formatter -> t -> unit
(** Pretty printer used for trace construction; [pp] is used for debug output. *)
val pp_call : Format.formatter -> CallSite.t -> unit
@ -32,7 +32,7 @@ module type TraceElem = sig
(** An [elem] which occured at [loc], after the chain of steps (usually calls) in [trace]. *)
type t = private {elem: elem_t; loc: Location.t; trace: CallSite.t list}
(** Both [pp] and [pp_human] simply call the same function on the trace element. *)
(** Both [pp] and [describe] simply call the same function on the trace element. *)
include Element with type t := t
val make : elem_t -> Location.t -> t

@ -98,7 +98,7 @@ module Access = struct
let mono_lang_pp = MF.wrap_monospaced pp_exp
let pp_human fmt = function
let describe fmt = function
| Read {exp} | Write {exp} ->
F.fprintf fmt "access to %a" mono_lang_pp exp
| ContainerRead {exp; pname} ->

@ -384,7 +384,7 @@ let report_lockless_violations (tenv, summary) {StarvationDomain.events} report_
let error_message =
Format.asprintf "Method %a is annotated %s but%a." pname_pp pname
(MF.monospaced_to_string Annotations.lockless)
Event.pp_human event
Event.describe event
in
let loc = Event.get_loc event in
let ltr = Event.make_trace pname event in
@ -420,7 +420,7 @@ let report_deadlocks env {StarvationDomain.order; ui} report_map' =
Format.asprintf
"Potential deadlock. %a (Trace 1) and %a (Trace 2) acquire locks %a and %a in \
reverse orders."
pname_pp current_pname pname_pp endpoint_pname Lock.pp_human lock1 Lock.pp_human
pname_pp current_pname pname_pp endpoint_pname Lock.describe lock1 Lock.describe
lock2
in
let first_trace = Order.make_trace ~header:"[Trace 1] " current_pname current_elem in
@ -490,7 +490,7 @@ let report_starvation env {StarvationDomain.events; ui} report_map' =
| MayBlock (_, sev) ->
let error_message =
Format.asprintf "Method %a runs on UI thread (because %a), and may block; %a." pname_pp
current_pname UIThreadExplanationDomain.pp ui_explain Event.pp_human event
current_pname UIThreadExplanationDomain.pp ui_explain Event.describe event
in
let loc = Event.get_loc event in
let trace = Event.make_trace current_pname event in
@ -504,7 +504,7 @@ let report_starvation env {StarvationDomain.events; ui} report_map' =
let error_message =
Format.asprintf
"Method %a runs on UI thread (because %a), and may violate Strict Mode; %a." pname_pp
current_pname UIThreadExplanationDomain.pp ui_explain Event.pp_human event
current_pname UIThreadExplanationDomain.pp ui_explain Event.describe event
in
let loc = Event.get_loc event in
let trace = Event.make_trace current_pname event in

@ -50,7 +50,7 @@ module Lock = struct
None
let pp_human fmt lock =
let describe fmt lock =
let pp_owner fmt lock =
owner_class lock |> Option.iter ~f:(F.fprintf fmt " in %a" (MF.wrap_monospaced Typ.Name.pp))
in
@ -59,7 +59,7 @@ module Lock = struct
let pp_call = ExplicitTrace.default_pp_call
let pp_locks fmt lock = F.fprintf fmt " locks %a" pp_human lock
let pp_locks fmt lock = F.fprintf fmt " locks %a" describe lock
end
module Event = struct
@ -88,7 +88,7 @@ module Event = struct
F.fprintf fmt "StrictModeCall(%s)" msg
let pp_human fmt elem =
let describe fmt elem =
match elem with
| LockAcquire lock ->
Lock.pp_locks fmt lock
@ -139,7 +139,7 @@ module Order = struct
F.fprintf fmt "{first= %a; eventually= %a}" Lock.pp first Event.pp eventually
let pp_human fmt {first} = Lock.pp_locks fmt first
let describe fmt {first} = Lock.pp_locks fmt first
let pp_call = ExplicitTrace.default_pp_call
end
@ -206,7 +206,7 @@ module UIThreadExplanationDomain = struct
module StringElement = struct
include String
let pp_human = pp
let describe = pp
let pp_call = ExplicitTrace.default_pp_call
end

Loading…
Cancel
Save