Module IR.Exp
type closure={name : Procname.t;captured_vars : (t * Pvar.t * Typ.t * Pvar.capture_mode) list;}and sizeof_data={typ : Typ.t;nbytes : int option;dynamic_length : t option;subtype : Subtype.t;}This records information about a
sizeof(typ)expression.nbytesrepresents the result of the evaluation ofsizeof(typ)if it is statically known.If
typis of the formTarray elt (Some static_length), thendynamic_lengthis the number of elements of typeeltin the array. Thedynamic_length, tracked by symbolic execution, may differ from thestatic_lengthobtained from the type definition, e.g. when an array is over-allocated.If
typis a struct type, thedynamic_lengthis that of the final extensible array, if any.
and t=|Var of Ident.tPure variable: it is not an lvalue
|UnOp of Unop.t * t * Typ.t optionUnary operator with type of the result if known
|BinOp of Binop.t * t * tBinary operator
|Exn of tException
|Closure of closureAnonymous function
|Const of Const.tConstants
|Cast of Typ.t * tType cast
|Lvar of Pvar.tThe address of a program variable
|Lfield of t * Fieldname.t * Typ.tA field offset, the type is the surrounding struct type
|Lindex of t * tAn array index offset:
exp1[exp2]|Sizeof of sizeof_dataProgram expressions.
val compare_closure : closure -> closure -> intval compare_sizeof_data : sizeof_data -> sizeof_data -> intval compare : t -> t -> int
module Set : IStdlib.IStd.Caml.Set.S with type Set.elt = tSet of expressions.
module Map : IStdlib.IStd.Caml.Map.S with type Map.key = tMap with expression keys.
module Hash : IStdlib.IStd.Caml.Hashtbl.S with type Hash.key = tHashtable with expression keys.
val is_null_literal : t -> boolval is_this : t -> boolreturn true if
expis the special this/self expression
Utility Functions for Expressions
val texp_to_typ : Typ.t option -> t -> Typ.tTurn an expression representing a type into the type it represents If not a sizeof, return the default type if given, otherwise raise an exception
val get_undefined : bool -> tGet an expression "undefined", the boolean indicates whether the undefined value goest into the footprint
val pointer_arith : t -> boolChecks whether an expression denotes a location using pointer arithmetic. Currently, catches array - indexing expressions such as a
ionly.
val has_local_addr : t -> boolreturns true if the expression operates on address of local variable
val zero : tInteger constant 0
val null : tNull constant
val one : tInteger constant 1
val minus_one : tInteger constant -1
val float : float -> tCreate float constant
val bool : bool -> tCreate integer constant corresponding to the boolean value
val free_vars : t -> Ident.t IStdlib.IStd.Sequence.tall the idents appearing in the expression
val gen_free_vars : t -> (unit, Ident.t) IStdlib.IStd.Sequence.Generator.tval ident_mem : t -> Ident.t -> booltrue if the identifier appears in the expression
val program_vars : t -> Pvar.t IStdlib.IStd.Sequence.tall the program variables appearing in the expression
val rename_pvars : f:(string -> string) -> t -> tRename all Pvars according to the function
f. WARNING: You want to rename pvars before you combine expressions from different symbolic states, which you RARELY want to.
val fold_captured : f:('a -> t -> 'a) -> t -> 'a -> 'aFold over the expressions captured by this expression.
val pp_diff : ?print_types:bool -> IStdlib.Pp.env -> F.formatter -> t -> unitval pp : F.formatter -> t -> unitval pp_closure : F.formatter -> closure -> unitval to_string : t -> stringval d_exp : t -> unitdump an expression.
val pp_texp : IStdlib.Pp.env -> F.formatter -> t -> unitPretty print a type.
val pp_texp_full : IStdlib.Pp.env -> F.formatter -> t -> unitPretty print a type with all the details.
val d_texp_full : t -> unitDump a type expression with all the details.
val d_list : t list -> unitDump a list of expressions.