[impurity] Remove mistakenly added Payload again

Reviewed By: jvillard

Differential Revision: D18479914

fbshipit-source-id: 144afa532
master
Ezgi Çiçek 5 years ago committed by Facebook Github Bot
parent 243835aca2
commit 128bf030ea

@ -15,7 +15,6 @@ type t =
; buffer_overrun_checker: BufferOverrunCheckerSummary.t option ; buffer_overrun_checker: BufferOverrunCheckerSummary.t option
; class_loads: ClassLoadsDomain.summary option ; class_loads: ClassLoadsDomain.summary option
; cost: CostDomain.summary option ; cost: CostDomain.summary option
; impurity: ImpurityDomain.t option
; lab_resource_leaks: ResourceLeakDomain.summary option ; lab_resource_leaks: ResourceLeakDomain.summary option
; litho_graphql_field_access: LithoDomain.t option ; litho_graphql_field_access: LithoDomain.t option
; litho_required_props: LithoDomain.t option ; litho_required_props: LithoDomain.t option
@ -45,7 +44,6 @@ let fields =
~buffer_overrun_checker:(fun f -> mk f "BufferOverrunChecker" BufferOverrunCheckerSummary.pp) ~buffer_overrun_checker:(fun f -> mk f "BufferOverrunChecker" BufferOverrunCheckerSummary.pp)
~class_loads:(fun f -> mk f "ClassLoads" ClassLoadsDomain.pp_summary) ~class_loads:(fun f -> mk f "ClassLoads" ClassLoadsDomain.pp_summary)
~cost:(fun f -> mk f "Cost" CostDomain.pp_summary) ~cost:(fun f -> mk f "Cost" CostDomain.pp_summary)
~impurity:(fun f -> mk f "Impurity" ImpurityDomain.pp)
~litho_graphql_field_access:(fun f -> mk f "Litho GraphQL Field Access" LithoDomain.pp) ~litho_graphql_field_access:(fun f -> mk f "Litho GraphQL Field Access" LithoDomain.pp)
~litho_required_props:(fun f -> mk f "Litho Required Props" LithoDomain.pp) ~litho_required_props:(fun f -> mk f "Litho Required Props" LithoDomain.pp)
~pulse:(fun f -> mk f "Pulse" PulseSummary.pp) ~pulse:(fun f -> mk f "Pulse" PulseSummary.pp)
@ -72,7 +70,6 @@ let empty =
; buffer_overrun_checker= None ; buffer_overrun_checker= None
; class_loads= None ; class_loads= None
; cost= None ; cost= None
; impurity= None
; lab_resource_leaks= None ; lab_resource_leaks= None
; litho_graphql_field_access= None ; litho_graphql_field_access= None
; litho_required_props= None ; litho_required_props= None

@ -19,7 +19,6 @@ include sig
; buffer_overrun_checker: BufferOverrunCheckerSummary.t option ; buffer_overrun_checker: BufferOverrunCheckerSummary.t option
; class_loads: ClassLoadsDomain.summary option ; class_loads: ClassLoadsDomain.summary option
; cost: CostDomain.summary option ; cost: CostDomain.summary option
; impurity: ImpurityDomain.t option
; lab_resource_leaks: ResourceLeakDomain.summary option ; lab_resource_leaks: ResourceLeakDomain.summary option
; litho_graphql_field_access: LithoDomain.t option ; litho_graphql_field_access: LithoDomain.t option
; litho_required_props: LithoDomain.t option ; litho_required_props: LithoDomain.t option

@ -15,12 +15,6 @@ let debug fmt = L.(debug Analysis Verbose fmt)
(* An impurity analysis that relies on pulse to determine how the state (* An impurity analysis that relies on pulse to determine how the state
changes *) changes *)
module Payload = SummaryPayload.Make (struct
type t = ImpurityDomain.t
let field = Payloads.Fields.impurity
end)
let get_matching_dest_addr_opt ~edges_pre ~edges_post : AbstractValue.t list option = let get_matching_dest_addr_opt ~edges_pre ~edges_post : AbstractValue.t list option =
match match
List.fold2 ~init:(Some []) List.fold2 ~init:(Some [])
@ -131,13 +125,12 @@ let report_errors summary modified_opt =
let pname_loc = Procdesc.get_loc pdesc in let pname_loc = Procdesc.get_loc pdesc in
let impure_fun_desc = F.asprintf "Impure function %a" Typ.Procname.pp proc_name in let impure_fun_desc = F.asprintf "Impure function %a" Typ.Procname.pp proc_name in
let impure_fun_ltr = Errlog.make_trace_element 0 pname_loc impure_fun_desc [] in let impure_fun_ltr = Errlog.make_trace_element 0 pname_loc impure_fun_desc [] in
match modified_opt with ( match modified_opt with
| None -> | None ->
Reporting.log_error summary ~loc:pname_loc ~ltr:[impure_fun_ltr] IssueType.impure_function Reporting.log_error summary ~loc:pname_loc ~ltr:[impure_fun_ltr] IssueType.impure_function
impure_fun_desc ; impure_fun_desc
summary
| Some (ImpurityDomain.{modified_globals; modified_params} as astate) -> | Some (ImpurityDomain.{modified_globals; modified_params} as astate) ->
( if Purity.should_report pdesc && not (ImpurityDomain.is_pure astate) then if Purity.should_report pdesc && not (ImpurityDomain.is_pure astate) then
let modified_ltr param_source set acc = let modified_ltr param_source set acc =
ImpurityDomain.ModifiedVarSet.fold ImpurityDomain.ModifiedVarSet.fold
(ImpurityDomain.add_to_errlog ~nesting:1 param_source) (ImpurityDomain.add_to_errlog ~nesting:1 param_source)
@ -148,7 +141,7 @@ let report_errors summary modified_opt =
:: modified_ltr Formal modified_params (modified_ltr Global modified_globals []) :: modified_ltr Formal modified_params (modified_ltr Global modified_globals [])
in in
Reporting.log_error summary ~loc:pname_loc ~ltr IssueType.impure_function impure_fun_desc ) ; Reporting.log_error summary ~loc:pname_loc ~ltr IssueType.impure_function impure_fun_desc ) ;
Payload.update_summary astate summary summary
let checker ({Callbacks.summary} as callback) : Summary.t = let checker ({Callbacks.summary} as callback) : Summary.t =

@ -66,14 +66,3 @@ let add_to_errlog ~nesting param_source ModifiedVar.{var; trace_list} errlog =
in in
let first_trace, rest = trace_list in let first_trace, rest = trace_list in
List.fold_left rest ~init:(aux ~nesting errlog first_trace) ~f:(aux ~nesting) List.fold_left rest ~init:(aux ~nesting errlog first_trace) ~f:(aux ~nesting)
let pp fmt ({modified_globals; modified_params} as astate) =
if is_pure astate then F.fprintf fmt "@\n pure @\n"
else if ModifiedVarSet.is_empty modified_params then
F.fprintf fmt "@\n impure, modified globals :%a @\n" ModifiedVarSet.pp modified_globals
else if ModifiedVarSet.is_empty modified_globals then
F.fprintf fmt "@\n impure, modified params :%a @\n" ModifiedVarSet.pp modified_params
else
F.fprintf fmt "@\n impure, modified params :%a, modified globals :%a @\n" ModifiedVarSet.pp
modified_params ModifiedVarSet.pp modified_globals

@ -34,5 +34,3 @@ val add_to_errlog :
-> Errlog.loc_trace_elem list -> Errlog.loc_trace_elem list
val join : t -> t -> t val join : t -> t -> t
val pp : Format.formatter -> t -> unit

Loading…
Cancel
Save