Skip to content

Commit

Permalink
Expose Bap_var.sort_of_typ (#1563)
Browse files Browse the repository at this point in the history
For convenience, we can convert a BIL type to a Core Theory sort.
  • Loading branch information
bmourad01 authored Dec 19, 2022
1 parent f21b437 commit ce84c26
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/bap/bap.mli
Original file line number Diff line number Diff line change
Expand Up @@ -2806,6 +2806,12 @@ module Std : sig
*)
val check : bil -> (unit,error) Result.t

(** [sort t] translates the type [t] into a Core Theory sort.
@since 2.6.0
*)
val sort : t -> unit Theory.Value.sort

(** BIL type errors.
Not all syntactically correct expressions make sense. A
Expand Down
2 changes: 2 additions & 0 deletions lib/bap_types/bap_helpers.ml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ module Type = struct
let check xs = match check xs with
| None -> Ok ()
| Some err -> Error err

let sort = Bap_var.sort_of_typ
end

(*
Expand Down
2 changes: 2 additions & 0 deletions lib/bap_types/bap_helpers.mli
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(** BIL high level functions. *)
open Core_kernel[@@warning "-D"]
open Bap_core_theory
open Bap_common
open Bap_bil
open Bap_visitor
Expand Down Expand Up @@ -36,6 +37,7 @@ module Type : sig
val check : stmt list -> (unit,Bap_type_error.t) Result.t
val infer : exp -> (typ, Bap_type_error.t) Result.t
val infer_exn : exp -> typ
val sort : typ -> unit Theory.Value.sort
end

module Eff : sig
Expand Down

0 comments on commit ce84c26

Please sign in to comment.