[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
master
Jules Villard 5 years ago committed by Facebook Github Bot
parent 669383d315
commit 4e3188a127

@ -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} ->

@ -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 =

@ -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

@ -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 =

Loading…
Cancel
Save