From 7f1b4e0a2bbc902c70c23cbf18f83702f9ae7f49 Mon Sep 17 00:00:00 2001 From: Mehdi Bouaziz Date: Thu, 26 Apr 2018 09:30:41 -0700 Subject: [PATCH] InstrNode: abstract instruction index Summary: Now that the cost analysis doesn't hackily compute the instruction index, we can make this an abstract type to ensure `List.nth_exn` in `OneInstrPerNode` will not fail. Depends on D7618320 Reviewed By: sblackshear Differential Revision: D7628908 fbshipit-source-id: 89e8618 --- infer/src/absint/ProcCfg.ml | 6 ++++-- infer/src/absint/ProcCfg.mli | 8 +++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/infer/src/absint/ProcCfg.ml b/infer/src/absint/ProcCfg.ml index 29cb0c609..0bf5ca08b 100644 --- a/infer/src/absint/ProcCfg.ml +++ b/infer/src/absint/ProcCfg.ml @@ -74,9 +74,11 @@ module DefaultNode = struct end module InstrNode = struct - type t = Procdesc.Node.t * int + type instr_index = int [@@deriving compare] - type id = Procdesc.Node.id * int [@@deriving compare] + type t = Procdesc.Node.t * instr_index + + type id = Procdesc.Node.id * instr_index [@@deriving compare] let kind (t, _) = Procdesc.Node.get_kind t diff --git a/infer/src/absint/ProcCfg.mli b/infer/src/absint/ProcCfg.mli index bca572c29..99cb0d9b0 100644 --- a/infer/src/absint/ProcCfg.mli +++ b/infer/src/absint/ProcCfg.mli @@ -82,7 +82,13 @@ end module DefaultNode : Node with type t = Procdesc.Node.t and type id = Procdesc.Node.id -module InstrNode : Node with type t = Procdesc.Node.t * int and type id = Procdesc.Node.id * int +module InstrNode : sig + type instr_index + + include Node + with type t = Procdesc.Node.t * instr_index + and type id = Procdesc.Node.id * instr_index +end (** Forward CFG with no exceptional control-flow *) module Normal :