[inferbo] No phantom field in inferbo

Summary: We do not use any phantom field for now.

Reviewed By: ngorogiannis

Differential Revision: D19088326

fbshipit-source-id: 4dc398044
master
Sungkeun Cho 5 years ago committed by Facebook Github Bot
parent 831b487b6a
commit 396d1d20ce

@ -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 ".*"

@ -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

@ -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 =

@ -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

Loading…
Cancel
Save