Skip to content

Commit 4fe5985

Browse files
committed
Make generic Spec domain and context lifter name configurable
1 parent 00c16c2 commit 4fe5985

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

src/lifters/specLifters.ml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ open GoblintCil
55
open Analyses
66
open GobConfig
77

8+
module type NameLifter =
9+
sig
10+
val lift_name: string -> string
11+
end
812

913
module type LatticeLifter =
1014
functor (L: Lattice.S) ->
@@ -15,7 +19,7 @@ module type LatticeLifter =
1519
val unlift: t -> L.t
1620
end
1721

18-
module DomainLifter (F: LatticeLifter) (S:Spec)
22+
module DomainLifter (N: NameLifter) (F: LatticeLifter) (S:Spec)
1923
: Spec with module G = S.G
2024
and module C = S.C
2125
=
@@ -30,7 +34,7 @@ struct
3034
let of_elt x = of_elt (D.unlift x)
3135
end
3236

33-
let name () = S.name () ^" hashconsed" (* TODO: configurable name *)
37+
let name () = N.lift_name (S.name ())
3438

3539
type marshal = S.marshal (* TODO: should hashcons table be in here to avoid relift altogether? *)
3640
let init = S.init
@@ -103,14 +107,19 @@ end
103107
(** Lifts a [Spec] so that the domain is [Hashcons]d *)
104108
module HashconsLifter (S: Spec) = (* keep functor eta-expanded to look up option when lifter is actually used *)
105109
struct
110+
module NameLifter =
111+
struct
112+
let lift_name x = x ^ " hashconsed"
113+
end
114+
106115
module HConsedArg =
107116
struct
108117
(* We do refine int values on narrow and meet {!IntDomain.IntDomTupleImpl}, which can lead to fixpoint issues if we assume x op x = x *)
109118
(* see https://github.com/goblint/analyzer/issues/1005 *)
110119
let assume_idempotent = GobConfig.get_string "ana.int.refinement" = "never"
111120
end
112121

113-
include DomainLifter (Lattice.HConsed (HConsedArg)) (S)
122+
include DomainLifter (NameLifter) (Lattice.HConsed (HConsedArg)) (S)
114123
end
115124

116125
module type PrintableLifter =
@@ -122,7 +131,7 @@ module type PrintableLifter =
122131
val unlift: t -> P.t
123132
end
124133

125-
module ContextLifter (F: PrintableLifter) (S:Spec)
134+
module ContextLifter (N: NameLifter) (F: PrintableLifter) (S:Spec)
126135
: Spec with module D = S.D
127136
and module G = S.G
128137
and module C = F (S.C)
@@ -134,7 +143,7 @@ struct
134143
module V = S.V
135144
module P = S.P
136145

137-
let name () = S.name () ^" context hashconsed" (* TODO: configurable name *)
146+
let name () = N.lift_name (S.name ())
138147

139148
type marshal = S.marshal (* TODO: should hashcons table be in here to avoid relift altogether? *)
140149
let init = S.init
@@ -204,10 +213,10 @@ struct
204213
end
205214

206215
(** Lifts a [Spec] so that the context is [Hashcons]d. *)
207-
module HashconsContextLifter = ContextLifter (Printable.HConsed)
216+
module HashconsContextLifter = ContextLifter (struct let lift_name s = s ^ " context hashconsed" end) (Printable.HConsed)
208217

209218
(** Lifts a [Spec] so that the context is [HashCached]. *)
210-
module HashCachedContextLifter = ContextLifter (Printable.HashCached)
219+
module HashCachedContextLifter = ContextLifter (struct let lift_name s = s ^ " context hashcached" end) (Printable.HashCached)
211220

212221
(* see option ana.opt.equal *)
213222
module OptEqual (S: Spec) = struct

0 commit comments

Comments
 (0)