From 81344f016e3aa28b18618672e904c0a5dc730464 Mon Sep 17 00:00:00 2001 From: Peter O'Hearn Date: Sun, 9 Oct 2016 14:15:51 -0700 Subject: [PATCH] [refactor] moving StringPPSet from ThreadSafety to Utils Reviewed By: jberdine Differential Revision: D3987229 fbshipit-source-id: 9854002 --- infer/src/base/PrettyPrintable.ml | 2 -- infer/src/base/PrettyPrintable.mli | 2 -- infer/src/base/Utils.ml | 6 ++++++ infer/src/base/Utils.mli | 3 +++ infer/src/checkers/ThreadSafety.ml | 8 +------- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/infer/src/base/PrettyPrintable.ml b/infer/src/base/PrettyPrintable.ml index b31c70221..c36f2d1f3 100644 --- a/infer/src/base/PrettyPrintable.ml +++ b/infer/src/base/PrettyPrintable.ml @@ -7,8 +7,6 @@ * of patent rights can be found in the PATENTS file in the same directory. *) -open! Utils - module F = Format (** Wrappers for making pretty-printable modules *) diff --git a/infer/src/base/PrettyPrintable.mli b/infer/src/base/PrettyPrintable.mli index 72829468e..4216607eb 100644 --- a/infer/src/base/PrettyPrintable.mli +++ b/infer/src/base/PrettyPrintable.mli @@ -7,8 +7,6 @@ * of patent rights can be found in the PATENTS file in the same directory. *) -open! Utils - module F = Format (** Wrappers for making pretty-printable modules *) diff --git a/infer/src/base/Utils.ml b/infer/src/base/Utils.ml index b8946d2ca..365db7a5b 100644 --- a/infer/src/base/Utils.ml +++ b/infer/src/base/Utils.ml @@ -107,6 +107,12 @@ let string_set_of_list list = let string_list_intersection a b = StringSet.inter (string_set_of_list a) (string_set_of_list b) +module StringPPSet = PrettyPrintable.MakePPSet(struct + type t = string + let compare = string_compare + let pp_element fmt s = F.fprintf fmt "%s" s + end) + (** Maps from integers *) module IntMap = Map.Make (struct type t = int diff --git a/infer/src/base/Utils.mli b/infer/src/base/Utils.mli index f1e30711b..db814585d 100644 --- a/infer/src/base/Utils.mli +++ b/infer/src/base/Utils.mli @@ -89,6 +89,9 @@ module IntSet : Set.S with type elt = int (** Set of strings *) module StringSet : Set.S with type elt = string +(** Pretty Printable Set of strings *) +module StringPPSet : PrettyPrintable.PPSet with type elt = string + (** Pretty print a set of strings *) val pp_stringset : Format.formatter -> StringSet.t -> unit diff --git a/infer/src/checkers/ThreadSafety.ml b/infer/src/checkers/ThreadSafety.ml index aa7c8741b..9d45c9227 100644 --- a/infer/src/checkers/ThreadSafety.ml +++ b/infer/src/checkers/ThreadSafety.ml @@ -17,19 +17,13 @@ open! Utils module F = Format module L = Logging -module PPString = PrettyPrintable.MakePPSet(struct - type t = string - let compare = string_compare - let pp_element fmt s = F.fprintf fmt "%s" s - end) - module PPrawpath = PrettyPrintable.MakePPSet(struct type t = AccessPath.raw let compare = AccessPath.raw_compare let pp_element = AccessPath.pp_raw end) -module LocksDomain = AbstractDomain.FiniteSet(PPString) +module LocksDomain = AbstractDomain.FiniteSet(StringPPSet) module PathDomain = AbstractDomain.FiniteSet(PPrawpath)