diff --git a/infer/src/bufferoverrun/absLoc.ml b/infer/src/bufferoverrun/absLoc.ml index fdc14c9ce..b8dd89923 100644 --- a/infer/src/bufferoverrun/absLoc.ml +++ b/infer/src/bufferoverrun/absLoc.ml @@ -227,14 +227,11 @@ module Loc = struct (Allocsite.Known {path= Some (SP.Deref ((SP.Deref_COneValuePointer | SP.Deref_CPointer), p))}) ; fn= f } -> - BufferOverrunField.pp ~pp_lhs:(SP.pp_partial_paren ~paren:true) - ~pp_lhs_alone:(SP.pp_pointer ~paren) ~sep:"->" fmt p f + BufferOverrunField.pp ~pp_lhs:(SP.pp_partial_paren ~paren:true) ~sep:"->" fmt p f | Field {prefix= l; fn= f} -> - BufferOverrunField.pp ~pp_lhs:(pp_paren ~paren:true) ~pp_lhs_alone:(pp_paren ~paren) - ~sep:"." fmt l f + BufferOverrunField.pp ~pp_lhs:(pp_paren ~paren:true) ~sep:"." fmt l f | StarField {prefix; last_field} -> - BufferOverrunField.pp ~pp_lhs:(pp_star ~paren:true) ~pp_lhs_alone:(pp_star ~paren) ~sep:"." - fmt prefix last_field + BufferOverrunField.pp ~pp_lhs:(pp_star ~paren:true) ~sep:"." fmt prefix last_field and pp_star ~paren fmt l = pp_paren ~paren fmt l ; F.pp_print_string fmt ".*" diff --git a/infer/src/bufferoverrun/bufferOverrunField.ml b/infer/src/bufferoverrun/bufferOverrunField.ml index 87842463e..0b43f651d 100644 --- a/infer/src/bufferoverrun/bufferOverrunField.ml +++ b/infer/src/bufferoverrun/bufferOverrunField.ml @@ -8,22 +8,7 @@ open! IStd module F = Format module L = Logging -(** If fn is empty, prints [pp_lhs_alone lhs] Otherwise prints [pp_lhs lhs ^ sep ^ fn] - - Create invisible phantom fields by giving them a name ending in '.' The name preceeding the '.' - will be used in debug mode. *) -let pp ~pp_lhs ~pp_lhs_alone ~sep f lhs fn = - let fieldname = Typ.Fieldname.get_field_name fn in - if String.is_empty fieldname then - if Config.bo_debug > 0 then - let fieldname = - Option.value ~default:"" - (Typ.Fieldname.to_simplified_string fn |> String.chop_suffix ~suffix:".") - in - F.fprintf f "%a%s%s" pp_lhs lhs sep fieldname - else pp_lhs_alone f lhs - else F.fprintf f "%a%s%s" pp_lhs lhs sep fieldname - +let pp ~pp_lhs ~sep f lhs fn = F.fprintf f "%a%s%s" pp_lhs lhs sep (Typ.Fieldname.get_field_name fn) let mk, get_type = let class_name = "__infer__" in diff --git a/infer/src/bufferoverrun/symb.ml b/infer/src/bufferoverrun/symb.ml index 97190a475..285673d98 100644 --- a/infer/src/bufferoverrun/symb.ml +++ b/infer/src/bufferoverrun/symb.ml @@ -132,16 +132,13 @@ module SymbolPath = struct | Deref ((Deref_COneValuePointer | Deref_CPointer | Deref_JavaPointer), p) -> pp_pointer ~paren fmt p | Field {fn; prefix= Deref ((Deref_COneValuePointer | Deref_CPointer), p)} -> - BufferOverrunField.pp ~pp_lhs:(pp_partial_paren ~paren:true) - ~pp_lhs_alone:(pp_pointer ~paren) ~sep:"->" fmt p fn + BufferOverrunField.pp ~pp_lhs:(pp_partial_paren ~paren:true) ~sep:"->" fmt p fn | Field {fn; prefix= p} -> - BufferOverrunField.pp ~pp_lhs:(pp_partial_paren ~paren:true) - ~pp_lhs_alone:(pp_partial_paren ~paren) ~sep:"." fmt p fn + BufferOverrunField.pp ~pp_lhs:(pp_partial_paren ~paren:true) ~sep:"." fmt p fn | Callsite {cs} -> Typ.Procname.pp_simplified_string ~withclass:true fmt (CallSite.pname cs) | StarField {last_field; prefix} -> - BufferOverrunField.pp ~pp_lhs:(pp_star ~paren:true) ~pp_lhs_alone:(pp_star ~paren) ~sep:"." - fmt prefix last_field + BufferOverrunField.pp ~pp_lhs:(pp_star ~paren:true) ~sep:"." fmt prefix last_field and pp_pointer ~paren fmt p = diff --git a/infer/src/bufferoverrun/symb.mli b/infer/src/bufferoverrun/symb.mli index 58a1eda07..9903ada4f 100644 --- a/infer/src/bufferoverrun/symb.mli +++ b/infer/src/bufferoverrun/symb.mli @@ -46,8 +46,6 @@ module SymbolPath : sig val pp_partial_paren : paren:bool -> F.formatter -> partial -> unit - val pp_pointer : paren:bool -> F.formatter -> partial -> unit - val of_pvar : Pvar.t -> partial val of_callsite : ret_typ:Typ.t -> CallSite.t -> partial