move a bunch of files to/from absint/

Summary:
This is needed to make absint/ its own dune library. Modules in absint/
cannot depend on modules in backend/. This is because backend/Summary.ml
depends on *all* the (inteprocedural) analyses since its stores elements
of their domains. But analyses are supposed to depend on absint/ to
use the AI framework and others. Thus absint/ cannot depend on backend/
otherwise it creates a dependency cycle.

Right now infer builds with this cycle because we consider all these
directories to be one library and there is no dependency cycle between
the individual modules, but making absint/ a library makes the situation
coarser.

One actual change in there: one function in PatternMatch was specific to
nullsafe and was moved there.

Reviewed By: ngorogiannis

Differential Revision: D21257467

fbshipit-source-id: 42af43315
master
Jules Villard 5 years ago committed by Facebook GitHub Bot
parent a144c8e4df
commit 858fdcf4db

@ -300,26 +300,6 @@ let method_is_initializer (tenv : Tenv.t) (proc_attributes : ProcAttributes.t) :
false false
(** Get the vararg values by looking for array assignments to the pvar. *)
let java_get_vararg_values node pvar idenv =
let values_of_instr acc = function
| Sil.Store {e1= Exp.Lindex (array_exp, _); e2= content_exp}
when Exp.equal (Exp.Lvar pvar) (Idenv.expand_expr idenv array_exp) ->
(* Each vararg argument is an assignment to a pvar denoting an array of objects. *)
content_exp :: acc
| _ ->
acc
in
let values_of_node acc n =
Procdesc.Node.get_instrs n |> Instrs.fold ~f:values_of_instr ~init:acc
in
match Errdesc.find_program_variable_assignment node pvar with
| Some (node', _) ->
Procdesc.fold_slope_range node' node ~f:values_of_node ~init:[]
| None ->
[]
let proc_calls resolve_attributes pdesc filter : (Procname.t * ProcAttributes.t) list = let proc_calls resolve_attributes pdesc filter : (Procname.t * ProcAttributes.t) list =
let res = ref [] in let res = ref [] in
let do_instruction _ instr = let do_instruction _ instr =

@ -104,9 +104,6 @@ val supertype_find_map_opt : Tenv.t -> (Typ.Name.t -> 'a option) -> Typ.Name.t -
(** Return the first non-None result found when applying the given function to supertypes of the (** Return the first non-None result found when applying the given function to supertypes of the
named type, including the type itself *) named type, including the type itself *)
val java_get_vararg_values : Procdesc.Node.t -> Pvar.t -> Idenv.t -> Exp.t list
(** Get the values of a vararg parameter given the pvar used to assign the elements. *)
val proc_calls : val proc_calls :
(Procname.t -> ProcAttributes.t option) (Procname.t -> ProcAttributes.t option)
-> Procdesc.t -> Procdesc.t

@ -476,6 +476,27 @@ let typecheck_expr_for_errors ~nullsafe_mode find_canonical_duplicate curr_pdesc
node instr_ref typestate1 exp1 Typ.void TypeOrigin.OptimisticFallback loc1) node instr_ref typestate1 exp1 Typ.void TypeOrigin.OptimisticFallback loc1)
(** Get the values of a vararg parameter given the pvar used to assign the elements by looking for
array assignments to the pvar. *)
let java_get_vararg_values node pvar idenv =
let values_of_instr acc = function
| Sil.Store {e1= Exp.Lindex (array_exp, _); e2= content_exp}
when Exp.equal (Exp.Lvar pvar) (Idenv.expand_expr idenv array_exp) ->
(* Each vararg argument is an assignment to a pvar denoting an array of objects. *)
content_exp :: acc
| _ ->
acc
in
let values_of_node acc n =
Procdesc.Node.get_instrs n |> Instrs.fold ~f:values_of_instr ~init:acc
in
match Errdesc.find_program_variable_assignment node pvar with
| Some (node', _) ->
Procdesc.fold_slope_range node' node ~f:values_of_node ~init:[]
| None ->
[]
(* Handle Preconditions.checkNotNull. *) (* Handle Preconditions.checkNotNull. *)
let do_preconditions_check_not_null instr_ref tenv find_canonical_duplicate node loc curr_pdesc let do_preconditions_check_not_null instr_ref tenv find_canonical_duplicate node loc curr_pdesc
curr_pname curr_annotated_signature checks call_params idenv parameter_num ~is_vararg typestate' curr_pname curr_annotated_signature checks call_params idenv parameter_num ~is_vararg typestate'
@ -529,7 +550,7 @@ let do_preconditions_check_not_null instr_ref tenv find_canonical_duplicate node
| _ -> | _ ->
ts ts
in in
let vararg_values = PatternMatch.java_get_vararg_values node pvar idenv in let vararg_values = java_get_vararg_values node pvar idenv in
List.fold_right ~f:do_vararg_value vararg_values ~init:typestate' List.fold_right ~f:do_vararg_value vararg_values ~init:typestate'
else else
pvar_apply instr_ref idenv tenv curr_pname curr_annotated_signature loc pvar_apply instr_ref idenv tenv curr_pname curr_annotated_signature loc

Loading…
Cancel
Save