From 4e3188a127eca83d771bb59401874e9b765c23b3 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Wed, 16 Oct 2019 07:48:29 -0700 Subject: [PATCH] [pulse][minor] reorder arguments of AddressOfStackVariable Summary: I dunno, seemed wrong before. About to introduce another attribute with similar arguments so making them consistent in advance. Reviewed By: skcho Differential Revision: D17930349 fbshipit-source-id: 944b58bac --- infer/src/pulse/PulseAbductiveDomain.ml | 2 +- infer/src/pulse/PulseDomain.ml | 10 +++++----- infer/src/pulse/PulseDomain.mli | 4 ++-- infer/src/pulse/PulseOperations.ml | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/infer/src/pulse/PulseAbductiveDomain.ml b/infer/src/pulse/PulseAbductiveDomain.ml index a0279d90d..fff5cdc70 100644 --- a/infer/src/pulse/PulseAbductiveDomain.ml +++ b/infer/src/pulse/PulseAbductiveDomain.ml @@ -319,7 +319,7 @@ module PrePost = struct BaseMemory.fold_attrs (fun addr attrs heap -> Attributes.get_address_of_stack_variable attrs - |> Option.value_map ~default:heap ~f:(fun (var, history, location) -> + |> Option.value_map ~default:heap ~f:(fun (var, location, history) -> let get_local_typ_opt pvar = Procdesc.get_locals pdesc |> List.find_map ~f:(fun ProcAttributes.{name; typ} -> diff --git a/infer/src/pulse/PulseDomain.ml b/infer/src/pulse/PulseDomain.ml index 3fa53de78..a057a2823 100644 --- a/infer/src/pulse/PulseDomain.ml +++ b/infer/src/pulse/PulseDomain.ml @@ -268,7 +268,7 @@ module Attribute = struct type t = | AddressOfCppTemporary of Var.t * ValueHistory.t - | AddressOfStackVariable of Var.t * ValueHistory.t * Location.t + | AddressOfStackVariable of Var.t * Location.t * ValueHistory.t | Closure of Typ.Procname.t | Constant of Const.t | Invalid of Invalidation.t Trace.t @@ -289,7 +289,7 @@ module Attribute = struct let pname = Typ.Procname.from_string_c_fun "" in let var = Var.of_pvar (Pvar.mk (Mangled.from_string "") pname) in let location = Location.dummy in - Variants.to_rank (AddressOfStackVariable (var, [], location)) + Variants.to_rank (AddressOfStackVariable (var, location, [])) let invalid_rank = @@ -307,7 +307,7 @@ module Attribute = struct let pp f = function | AddressOfCppTemporary (var, history) -> F.fprintf f "t&%a (%a)" Var.pp var ValueHistory.pp history - | AddressOfStackVariable (var, history, location) -> + | AddressOfStackVariable (var, location, history) -> F.fprintf f "s&%a (%a) at %a" Var.pp var ValueHistory.pp history Location.pp location | Closure pname -> Typ.Procname.pp f pname @@ -363,8 +363,8 @@ module Attributes = struct let get_address_of_stack_variable attrs = Set.find_rank attrs Attribute.address_of_stack_variable_rank |> Option.map ~f:(fun attr -> - let[@warning "-8"] (Attribute.AddressOfStackVariable (var, history, loc)) = attr in - (var, history, loc) ) + let[@warning "-8"] (Attribute.AddressOfStackVariable (var, loc, history)) = attr in + (var, loc, history) ) let is_std_vector_reserved attrs = diff --git a/infer/src/pulse/PulseDomain.mli b/infer/src/pulse/PulseDomain.mli index 68fba9cc1..9a4d1d80f 100644 --- a/infer/src/pulse/PulseDomain.mli +++ b/infer/src/pulse/PulseDomain.mli @@ -85,7 +85,7 @@ end module Attribute : sig type t = | AddressOfCppTemporary of Var.t * ValueHistory.t - | AddressOfStackVariable of Var.t * ValueHistory.t * Location.t + | AddressOfStackVariable of Var.t * Location.t * ValueHistory.t | Closure of Typ.Procname.t | Constant of Const.t | Invalid of Invalidation.t Trace.t @@ -104,7 +104,7 @@ module Attributes : sig val get_written_to : t -> unit InterprocAction.t option - val get_address_of_stack_variable : t -> (Var.t * ValueHistory.t * Location.t) option + val get_address_of_stack_variable : t -> (Var.t * Location.t * ValueHistory.t) option val is_modified : t -> bool end diff --git a/infer/src/pulse/PulseOperations.ml b/infer/src/pulse/PulseOperations.ml index 4dbcd5d1c..c1b24e332 100644 --- a/infer/src/pulse/PulseOperations.ml +++ b/infer/src/pulse/PulseOperations.ml @@ -355,7 +355,7 @@ let mark_address_of_cpp_temporary history variable address astate = let mark_address_of_stack_variable history variable location address astate = - Memory.add_attribute address (AddressOfStackVariable (variable, history, location)) astate + Memory.add_attribute address (AddressOfStackVariable (variable, location, history)) astate let remove_vars vars location astate =