From 3e0c9809b91592ab135de1e52af4e98f48a8f1a9 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Tue, 15 Oct 2019 03:37:04 -0700 Subject: [PATCH] [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 --- infer/src/pulse/Pulse.ml | 2 +- infer/src/pulse/PulseDomain.ml | 28 ++++++++++++++-------------- infer/src/pulse/PulseDomain.mli | 8 ++++---- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/infer/src/pulse/Pulse.ml b/infer/src/pulse/Pulse.ml index 57a2ead6a..5fb4e353a 100644 --- a/infer/src/pulse/Pulse.ml +++ b/infer/src/pulse/Pulse.ml @@ -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)) -> diff --git a/infer/src/pulse/PulseDomain.ml b/infer/src/pulse/PulseDomain.ml index e743e77a8..e77be54ef 100644 --- a/infer/src/pulse/PulseDomain.ml +++ b/infer/src/pulse/PulseDomain.ml @@ -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 diff --git a/infer/src/pulse/PulseDomain.mli b/infer/src/pulse/PulseDomain.mli index dc066c076..837e3d627 100644 --- a/infer/src/pulse/PulseDomain.mli +++ b/infer/src/pulse/PulseDomain.mli @@ -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]