diff --git a/infer/src/IR/AccessPath.ml b/infer/src/IR/AccessPath.ml index 098b43b78..4c0d5f0ca 100644 --- a/infer/src/IR/AccessPath.ml +++ b/infer/src/IR/AccessPath.ml @@ -25,8 +25,6 @@ module Raw = struct let equal_access = [%compare.equal: access] - let equal_access_list = [%compare.equal: access list] - let may_pp_typ fmt typ = if Config.debug_level_analysis >= 3 then F.fprintf fmt ":%a" (Typ.pp Pp.text) typ diff --git a/infer/src/IR/AccessPath.mli b/infer/src/IR/AccessPath.mli index 51b4affc4..a82f01df0 100644 --- a/infer/src/IR/AccessPath.mli +++ b/infer/src/IR/AccessPath.mli @@ -74,8 +74,6 @@ val equal : t -> t -> bool val equal_base : base -> base -> bool -val equal_access_list : access list -> access list -> bool - val pp : Format.formatter -> t -> unit val pp_base : Format.formatter -> base -> unit diff --git a/infer/src/concurrency/starvationDomain.ml b/infer/src/concurrency/starvationDomain.ml index 0f21cc99f..deffffe8f 100644 --- a/infer/src/concurrency/starvationDomain.ml +++ b/infer/src/concurrency/starvationDomain.ml @@ -15,31 +15,29 @@ module Lock = struct (* TODO (T37174859): change to [HilExp.t] *) type t = AccessPath.t + type var = Var.t + + let compare_var = Var.compare_modulo_this + (* compare type, base variable modulo this and access list *) - let compare (((base, typ), aclist) as lock) (((base', typ'), aclist') as lock') = + let compare lock lock' = if phys_equal lock lock' then 0 - else - let res = Typ.compare typ typ' in - if not (Int.equal res 0) then res - else - let res = Var.compare_modulo_this base base' in - if not (Int.equal res 0) then res - else List.compare AccessPath.compare_access aclist aclist' + else [%compare: (var * Typ.t) * AccessPath.access list] lock lock' - let equal lock lock' = Int.equal 0 (compare lock lock') + let equal = [%compare.equal: t] let equal_modulo_base (((root, typ), aclist) as l) (((root', typ'), aclist') as l') = - if phys_equal l l' then true - else - match (root, root') with - | Var.LogicalVar _, Var.LogicalVar _ -> - (* only class objects are supposed to appear as idents *) - equal l l' - | Var.ProgramVar _, Var.ProgramVar _ -> - Typ.equal typ typ' && AccessPath.equal_access_list aclist aclist' - | _, _ -> - false + phys_equal l l' + || + match (root, root') with + | Var.LogicalVar _, Var.LogicalVar _ -> + (* only class objects are supposed to appear as idents *) + equal l l' + | Var.ProgramVar _, Var.ProgramVar _ -> + [%compare.equal: Typ.t * AccessPath.access list] (typ, aclist) (typ', aclist') + | _, _ -> + false let pp = AccessPath.pp