[infer] Cleanup preanalysis

Summary: Preanalysis is performed at the frontend now. Hence, we don't need to repeatedly check/set when/if it is performed.

Reviewed By: mbouaziz

Differential Revision: D15863175

fbshipit-source-id: f9c6b7ae1
master
Ezgi Çiçek 6 years ago committed by Facebook Github Bot
parent 013d153538
commit fedb8e5136

@ -40,7 +40,6 @@ let pp_var_data fmt {name; typ; modify_in_block} =
type t =
{ access: PredSymb.access (** visibility access *)
; captured: (Mangled.t * Typ.t) list (** name and type of variables captured in blocks *)
; mutable did_preanalysis: bool (** true if we performed preanalysis on the CFG for this proc *)
; exceptions: string list (** exceptions thrown by the procedure *)
; formals: (Mangled.t * Typ.t) list (** name and type of formal parameters *)
; const_formals: int list (** list of indices of formals that are const-qualified *)
@ -67,7 +66,6 @@ type t =
let default translation_unit proc_name =
{ access= PredSymb.Default
; captured= []
; did_preanalysis= false
; exceptions= []
; formals= []
; const_formals= []
@ -99,7 +97,6 @@ let pp_parameters =
let pp f
({ access
; captured
; did_preanalysis
; exceptions
; formals
; const_formals
@ -147,7 +144,6 @@ let pp f
F.fprintf f "; func_attributes= [@[%a@]]@,"
(Pp.semicolon_seq ~print_env:Pp.text_break PredSymb.pp_func_attribute)
func_attributes ;
pp_bool_default ~default:default.did_preanalysis "did_preanalysis" did_preanalysis f () ;
pp_bool_default ~default:default.is_abstract "is_abstract" is_abstract f () ;
pp_bool_default ~default:default.is_bridge_method "is_bridge_method" is_bridge_method f () ;
pp_bool_default ~default:default.is_defined "is_defined" is_defined f () ;

@ -23,7 +23,6 @@ type var_data =
type t =
{ access: PredSymb.access (** visibility access *)
; captured: (Mangled.t * Typ.t) list (** name and type of variables captured in blocks *)
; mutable did_preanalysis: bool (** true if we performed preanalysis on the CFG for this proc *)
; exceptions: string list (** exceptions thrown by the procedure *)
; formals: (Mangled.t * Typ.t) list (** name and type of formal parameters *)
; const_formals: int list (** list of indices of formals that are const-qualified *)

@ -471,11 +471,6 @@ let compute_distance_to_exit_node pdesc =
mark_distance 0 [exit_node]
(** check or indicate if we have performed preanalysis on the CFG *)
let did_preanalysis pdesc = pdesc.attributes.did_preanalysis
let signal_did_preanalysis pdesc = pdesc.attributes.did_preanalysis <- true
let get_attributes pdesc = pdesc.attributes
let set_attributes pdesc attributes = pdesc.attributes <- attributes

@ -206,9 +206,6 @@ val create_node : t -> Location.t -> Node.nodekind -> Sil.instr list -> Node.t
val create_node_from_not_reversed :
t -> Location.t -> Node.nodekind -> Instrs.not_reversed_t -> Node.t
val did_preanalysis : t -> bool
(** true if we ran the preanalysis on the CFG associated with [t] *)
val fold_instrs : t -> init:'accum -> f:('accum -> Node.t -> Sil.instr -> 'accum) -> 'accum
(** fold over all nodes and their instructions *)
@ -296,9 +293,6 @@ val set_exit_node : t -> Node.t -> unit
val set_start_node : t -> Node.t -> unit
val signal_did_preanalysis : t -> unit
(** indicate that we have performed preanalysis on the CFG associated with [t] *)
val get_wto : t -> Node.t WeakTopologicalOrder.Partition.t
val is_loop_head : t -> Node.t -> bool

@ -195,16 +195,12 @@ let do_liveness pdesc tenv =
let liveness_inv_map =
LivenessAnalysis.exec_cfg liveness_proc_cfg (ProcData.make_default pdesc tenv) ~initial
in
add_nullify_instrs pdesc tenv liveness_inv_map ;
Procdesc.signal_did_preanalysis pdesc
add_nullify_instrs pdesc tenv liveness_inv_map
(** add Abstract instructions into the IR to give hints about when abstraction should be
performed *)
let do_abstraction pdesc =
add_abstraction_instructions pdesc ;
Procdesc.signal_did_preanalysis pdesc
let do_abstraction pdesc = add_abstraction_instructions pdesc
let do_funptr_sub pdesc tenv =
let updated = FunctionPointers.substitute_function_pointers pdesc tenv in
@ -212,10 +208,9 @@ let do_funptr_sub pdesc tenv =
let do_preanalysis pdesc tenv =
if not (Procdesc.did_preanalysis pdesc) then (
if
Config.function_pointer_specialization
&& not (Typ.Procname.is_java (Procdesc.get_proc_name pdesc))
then do_funptr_sub pdesc tenv ;
do_liveness pdesc tenv ;
do_abstraction pdesc )
if
Config.function_pointer_specialization
&& not (Typ.Procname.is_java (Procdesc.get_proc_name pdesc))
then do_funptr_sub pdesc tenv ;
do_liveness pdesc tenv ;
do_abstraction pdesc

Loading…
Cancel
Save