[inferbo] Better pp

Summary: Use `pp` functions until it needs to be turned into a string.

Reviewed By: jvillard

Differential Revision: D5941473

fbshipit-source-id: 87ca9df
master
Mehdi Bouaziz 7 years ago committed by Facebook Github Bot
parent 2adf654950
commit cfd6148dab

@ -625,7 +625,7 @@ module Report = struct
| None
-> ()
| Some bucket when Typ.Procname.equal pname caller_pname
-> let description = Dom.Condition.to_string cond in
-> let description = Dom.Condition.description cond in
let error_desc = Localise.desc_buffer_overrun bucket description in
let exn = Exceptions.Checkers (IssueType.buffer_overrun.unique_id, error_desc) in
let trace =

@ -125,19 +125,22 @@ module Condition = struct
let invalid : t -> bool = fun x -> Itv.invalid x.idx || Itv.invalid x.size
let to_string : t -> string =
fun c ->
let c = set_size_pos c in
"Offset: " ^ Itv.to_string c.idx ^ " Size: " ^ Itv.to_string c.size
^
let pp_trace : F.formatter -> t -> unit =
fun fmt c ->
match c.cond_trace with
| Inter (_, pname, _)
when Config.bo_debug >= 1 || not (SourceFile.is_cpp_model c.loc.Location.file)
-> let loc = pp_location F.str_formatter c ; F.flush_str_formatter () in
" @ " ^ loc ^ " by call " ^ MF.monospaced_to_string (Typ.Procname.to_string pname ^ "()")
^ " "
-> F.fprintf fmt " %@ %a by call %a " pp_location c MF.pp_monospaced
(Typ.Procname.to_string pname ^ "()")
| _
-> ""
-> ()
let pp_description : F.formatter -> t -> unit =
fun fmt c ->
let c = set_size_pos c in
F.fprintf fmt "Offset: %a Size: %a%a" Itv.pp c.idx Itv.pp c.size pp_trace c
let description : t -> string = fun c -> Format.asprintf "%a" pp_description c
let subst
: t -> Itv.Bound.t Itv.SubstMap.t * TraceSet.t Itv.SubstMap.t -> Typ.Procname.t

Loading…
Cancel
Save