[pulse][minor] alphabetise events and inline single-field record

Summary: In preparation for adding event types.

Reviewed By: skcho

Differential Revision: D17907981

fbshipit-source-id: 870e4aaec
master
Jules Villard 5 years ago committed by Facebook Github Bot
parent fcbcfc3913
commit 3e0c9809b9

@ -167,7 +167,7 @@ module PulseTransferFunctions = struct
[check_error summary result]
| Store {e1= lhs_exp; e2= rhs_exp; loc} ->
(* [*lhs_exp := rhs_exp] *)
let event = ValueHistory.Assignment {location= loc} in
let event = ValueHistory.Assignment loc in
let result =
PulseOperations.eval loc rhs_exp astate
>>= fun (astate, (rhs_addr, rhs_history)) ->

@ -123,32 +123,32 @@ end
module ValueHistory = struct
type event =
| VariableDeclaration of Location.t
| CppTemporaryCreated of Location.t
| Assignment of {location: Location.t}
| Capture of {captured_as: Pvar.t; location: Location.t}
| Assignment of Location.t
| Call of {f: CallEvent.t; location: Location.t}
| Capture of {captured_as: Pvar.t; location: Location.t}
| CppTemporaryCreated of Location.t
| VariableDeclaration of Location.t
[@@deriving compare]
let pp_event_no_location fmt = function
| VariableDeclaration _ ->
F.pp_print_string fmt "variable declared"
| CppTemporaryCreated _ ->
F.pp_print_string fmt "C++ temporary created"
| Capture {captured_as; location= _} ->
F.fprintf fmt "value captured as `%a`" (Pvar.pp Pp.text) captured_as
| Assignment _ ->
F.pp_print_string fmt "assigned"
| Call {f; location= _} ->
F.fprintf fmt "returned from call to %a" CallEvent.pp f
| Capture {captured_as; location= _} ->
F.fprintf fmt "value captured as `%a`" (Pvar.pp Pp.text) captured_as
| CppTemporaryCreated _ ->
F.pp_print_string fmt "C++ temporary created"
| VariableDeclaration _ ->
F.pp_print_string fmt "variable declared"
let location_of_event = function
| VariableDeclaration location
| CppTemporaryCreated location
| Assignment {location}
| Assignment location
| Call {location}
| Capture {location}
| Call {location} ->
| CppTemporaryCreated location
| VariableDeclaration location ->
location

@ -47,11 +47,11 @@ end
module ValueHistory : sig
type event =
| VariableDeclaration of Location.t
| CppTemporaryCreated of Location.t
| Assignment of {location: Location.t}
| Capture of {captured_as: Pvar.t; location: Location.t}
| Assignment of Location.t
| Call of {f: CallEvent.t; location: Location.t}
| Capture of {captured_as: Pvar.t; location: Location.t}
| CppTemporaryCreated of Location.t
| VariableDeclaration of Location.t
type t = event list [@@deriving compare]

Loading…
Cancel
Save