diff --git a/infer/src/IR/HilInstr.ml b/infer/src/IR/HilInstr.ml index 9afb58d82..c75af9003 100644 --- a/infer/src/IR/HilInstr.ml +++ b/infer/src/IR/HilInstr.ml @@ -22,13 +22,13 @@ let pp_call fmt = function | Indirect access_path -> F.fprintf fmt "*%a" AccessPath.Raw.pp access_path type t = - | Write of AccessPath.Raw.t * HilExp.t * Location.t + | Assign of AccessPath.Raw.t * HilExp.t * Location.t | Assume of HilExp.t * [`Then | `Else] * Sil.if_kind * Location.t | Call of AccessPath.base option * call * HilExp.t list * CallFlags.t * Location.t [@@deriving compare] let pp fmt = function - | Write (access_path, exp, loc) -> + | Assign (access_path, exp, loc) -> F.fprintf fmt "%a := %a [%a]" AccessPath.Raw.pp access_path HilExp.pp exp Location.pp loc | Assume (exp, _, _, loc) -> F.fprintf fmt "assume %a [%a]" HilExp.pp exp Location.pp loc @@ -54,7 +54,7 @@ let of_sil ~f_resolve_id (instr : Sil.instr) = | [rhs_access_path] -> Bind (lhs_id, rhs_access_path) | _ -> - Instr (Write (((lhs_id, rhs_typ), []), rhs_hil_exp, loc)) in + Instr (Assign (((lhs_id, rhs_typ), []), rhs_hil_exp, loc)) in match instr with | Load (lhs_id, rhs_exp, rhs_typ, loc) -> analyze_id_assignment (Var.of_id lhs_id) rhs_exp rhs_typ loc @@ -70,7 +70,7 @@ let of_sil ~f_resolve_id (instr : Sil.instr) = match HilExp.of_sil ~f_resolve_id lhs_exp typ with | AccessPath ap -> ap | _ -> invalid_argf "Non-assignable LHS expression %a" Exp.pp lhs_exp in - Instr (Write (lhs_access_path, HilExp.of_sil ~f_resolve_id rhs_exp typ, loc)) + Instr (Assign (lhs_access_path, HilExp.of_sil ~f_resolve_id rhs_exp typ, loc)) | Call (ret_opt, call_exp, formals, loc, call_flags) -> let hil_ret = Option.map ~f:(fun (ret_id, ret_typ) -> Var.of_id ret_id, ret_typ) ret_opt in let hil_call = diff --git a/infer/src/IR/HilInstr.mli b/infer/src/IR/HilInstr.mli index fe26fcfba..c72557f9f 100644 --- a/infer/src/IR/HilInstr.mli +++ b/infer/src/IR/HilInstr.mli @@ -20,7 +20,7 @@ type call = val pp_call : F.formatter -> call -> unit type t = - | Write of AccessPath.Raw.t * HilExp.t * Location.t + | Assign of AccessPath.Raw.t * HilExp.t * Location.t (** LHS access path, RHS expression *) | Assume of HilExp.t * [`Then | `Else] * Sil.if_kind * Location.t (** Assumed expression, true_branch boolean, source of the assume (conditional, ternary, etc.) *) diff --git a/infer/src/checkers/ThreadSafety.ml b/infer/src/checkers/ThreadSafety.ml index 1034d9c81..3fb460df7 100644 --- a/infer/src/checkers/ThreadSafety.ml +++ b/infer/src/checkers/ThreadSafety.ml @@ -574,7 +574,7 @@ module TransferFunctions (CFG : ProcCfg.S) = struct astate_callee end - | Write (lhs_access_path, rhs_exp, loc) -> + | Assign (lhs_access_path, rhs_exp, loc) -> let rhs_accesses = add_access rhs_exp loc Read astate.accesses astate.locks astate.attribute_map proc_data in diff --git a/infer/src/quandary/TaintAnalysis.ml b/infer/src/quandary/TaintAnalysis.ml index 29f84ff37..708897ea9 100644 --- a/infer/src/quandary/TaintAnalysis.ml +++ b/infer/src/quandary/TaintAnalysis.ml @@ -283,21 +283,21 @@ module Make (TaintSpecification : TaintSpec.S) = struct ~default:TaintDomain.empty_node in TaintDomain.add_node (AccessPath.Exact lhs_access_path) rhs_node astate in match instr with - | Write (((Var.ProgramVar pvar, _), []), HilExp.Exception _, _) when Pvar.is_return pvar -> + | Assign (((Var.ProgramVar pvar, _), []), HilExp.Exception _, _) when Pvar.is_return pvar -> (* the Java frontend translates `throw Exception` as `return Exception`, which is a bit wonky. this translation causes problems for us in computing a summary when an exception is "returned" from a void function. skip code like this for now, fix via t14159157 later *) astate - | Write (((Var.ProgramVar pvar, _), []), rhs_exp, _) + | Assign (((Var.ProgramVar pvar, _), []), rhs_exp, _) when Pvar.is_return pvar && HilExp.is_null_literal rhs_exp && Typ.equal_desc Tvoid (Procdesc.get_ret_type proc_data.pdesc).desc -> (* similar to the case above; the Java frontend translates "return no exception" as `return null` in a void function *) astate - | Write (lhs_access_path, rhs_exp, _) -> + | Assign (lhs_access_path, rhs_exp, _) -> exec_write lhs_access_path rhs_exp astate | Call (ret_opt, Direct called_pname, actuals, call_flags, callee_loc) ->