Skip to content

Commit

Permalink
Deduplicate Null declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Nov 29, 2023
1 parent 44705f4 commit 80c2694
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
10 changes: 8 additions & 2 deletions src/cdomains/arrayDomain.ml
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@ sig
val smart_leq: (Cil.exp -> BI.t option) -> (Cil.exp -> BI.t option) -> t -> t -> bool
end

module type LatticeWithNull =
module type Null =
sig
include LatticeWithSmartOps
type t
type retnull = Null | NotNull | Maybe

val null: unit -> t
Expand All @@ -120,6 +120,12 @@ sig
val not_zero_of_ikind: Cil.ikind -> t
end

module type LatticeWithNull =
sig
include LatticeWithSmartOps
include Null with type t := t
end

module Trivial (Val: LatticeWithInvalidate) (Idx: Lattice.S): S with type value = Val.t and type idx = Idx.t =
struct
include Val
Expand Down
10 changes: 8 additions & 2 deletions src/cdomains/arrayDomain.mli
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ sig
val smart_leq: (Cil.exp -> BigIntOps.t option) -> (Cil.exp -> BigIntOps.t option) -> t -> t -> bool
end

module type LatticeWithNull =
module type Null =
sig
include LatticeWithSmartOps
type t
type retnull = Null | NotNull | Maybe

val null: unit -> t
Expand All @@ -136,6 +136,12 @@ sig
val not_zero_of_ikind: Cil.ikind -> t
end

module type LatticeWithNull =
sig
include LatticeWithSmartOps
include Null with type t := t
end

module Trivial (Val: LatticeWithInvalidate) (Idx: Lattice.S): S with type value = Val.t and type idx = Idx.t
(** This functor creates a trivial single cell representation of an array. The
* indexing type is taken as a parameter to satisfy the type system, it is not
Expand Down
8 changes: 1 addition & 7 deletions src/cdomains/valueDomain.ml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,7 @@ sig
val is_top_value: t -> typ -> bool
val zero_init_value: ?varAttr:attributes -> typ -> t

type retnull = Null | NotNull | Maybe
val null: unit -> t
val is_null: t -> retnull

val get_ikind: t -> Cil.ikind option
val zero_of_ikind: Cil.ikind -> t
val not_zero_of_ikind: Cil.ikind -> t
include ArrayDomain.Null with type t := t

val project: VDQ.t -> int_precision option-> ( attributes * attributes ) option -> t -> t
val mark_jmpbufs_as_copied: t -> t
Expand Down

0 comments on commit 80c2694

Please sign in to comment.