From a3f4bb01f4ebb1061f2c28832a1ce646cff55725 Mon Sep 17 00:00:00 2001 From: Nikos Gorogiannis Date: Mon, 17 Dec 2018 10:18:36 -0800 Subject: [PATCH] [starvation] fix type bug occurring in class references Reviewed By: jeremydubreil Differential Revision: D13466456 fbshipit-source-id: 0b312d9c3 --- infer/src/IR/Typ.ml | 2 -- infer/src/IR/Typ.mli | 3 --- infer/src/concurrency/starvationDomain.ml | 8 +++++++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/infer/src/IR/Typ.ml b/infer/src/IR/Typ.ml index 96ccdc5e2..8056fa386 100644 --- a/infer/src/IR/Typ.ml +++ b/infer/src/IR/Typ.ml @@ -509,8 +509,6 @@ let d_list (tl : t list) = let name typ = match typ.desc with Tstruct name -> Some name | _ -> None -let inner_name typ = match typ.desc with Tptr ({desc= Tstruct name}, _) -> Some name | _ -> None - let unsome s = function | Some default_typ -> default_typ diff --git a/infer/src/IR/Typ.mli b/infer/src/IR/Typ.mli index 05412c690..3f9ee358c 100644 --- a/infer/src/IR/Typ.mli +++ b/infer/src/IR/Typ.mli @@ -267,9 +267,6 @@ val d_list : t list -> unit val name : t -> Name.t option (** The name of a type *) -val inner_name : t -> Name.t option -(** Name of the type of a Tstruct pointed to by a Tptr *) - val strip_ptr : t -> t (** turn a *T into a T. fails if [t] is not a pointer type *) diff --git a/infer/src/concurrency/starvationDomain.ml b/infer/src/concurrency/starvationDomain.ml index 31eb8a4e4..801221782 100644 --- a/infer/src/concurrency/starvationDomain.ml +++ b/infer/src/concurrency/starvationDomain.ml @@ -42,7 +42,13 @@ module Lock = struct let pp = AccessPath.pp - let owner_class ((_, typ), _) = Typ.inner_name typ + let owner_class ((_, {Typ.desc}), _) = + match desc with + | Typ.Tstruct name | Typ.Tptr ({desc= Tstruct name}, _) -> + Some name + | _ -> + None + let pp_human fmt lock = let pp_owner fmt lock =