Module IR.PredSymb

The Smallfoot Intermediate Language: Predicate Symbols

Programs and Types

type mem_kind =
  1. | Mmalloc
    (*

    memory allocated with malloc

    *)
  2. | Mnew
    (*

    memory allocated with new

    *)
  3. | Mnew_array
    (*

    memory allocated with new

    *)
  4. | Mobjc
    (*

    memory allocated with objective-c alloc

    *)
val compare_mem_kind : mem_kind -> mem_kind -> int
type resource =
  1. | Rmemory of mem_kind
  2. | Rfile
  3. | Rignore
  4. | Rlock

resource that can be allocated

val compare_resource : resource -> resource -> int
type res_act_kind =
  1. | Racquire
  2. | Rrelease

kind of resource action

val compare_res_act_kind : res_act_kind -> res_act_kind -> int
val equal_res_act_kind : res_act_kind -> res_act_kind -> bool
type dangling_kind =
  1. | DAuninit
    (*

    pointer is dangling because it is uninitialized

    *)
  2. | DAaddr_stack_var
    (*

    pointer is dangling because it is the address of a stack variable which went out of scope

    *)
  3. | DAminusone
    (*

    pointer is -1

    *)

kind of dangling pointers

type path_pos = Procname.t * int

position in a path: proc name, node id

val compare_path_pos : path_pos -> path_pos -> int
val equal_path_pos : path_pos -> path_pos -> bool
type res_action = {
  1. ra_kind : res_act_kind;
    (*

    kind of action

    *)
  2. ra_res : resource;
    (*

    kind of resource

    *)
  3. ra_pname : Procname.t;
    (*

    name of the procedure used to acquire/release the resource

    *)
  4. ra_loc : IBase.Location.t;
    (*

    location of the acquire/release

    *)
  5. ra_vpath : DecompiledExp.vpath;
    (*

    vpath of the resource value

    *)
}

acquire/release action on a resource

type t =
  1. | Aresource of res_action
    (*

    resource acquire/release

    *)
  2. | Aautorelease
  3. | Adangling of dangling_kind
    (*

    dangling pointer

    *)
  4. | Aundef of Procname.t * Annot.Item.t * IBase.Location.t * path_pos
  5. | Alocked
  6. | Aunlocked
  7. | Adiv0 of path_pos
    (*

    value appeared in second argument of division at given path position

    *)
  8. | Aobjc_null
    (*

    attributed exp is null due to a call to a method with given path as null receiver

    *)
  9. | Aretval of Procname.t * Annot.Item.t
    (*

    value was returned from a call to the given procedure, plus the annots of the return value

    *)
  10. | Aobserver
    (*

    denotes an object registered as an observers to a notification center

    *)
  11. | Aunsubscribed_observer
    (*

    denotes an object unsubscribed from observers of a notification center

    *)
  12. | Awont_leak
    (*

    value do not participate in memory leak analysis

    *)

Attributes are nary function symbols that are applied to expression arguments in Apred and Anpred atomic formulas. Many operations don't make much sense for nullary predicates, and are generally treated as no-ops. The first argument is treated specially, as the "anchor" of the predicate application. For example, adding or removing an attribute uses the anchor to identify the atom to operate on. Also, abstraction and normalization operations treat the anchor specially and maintain more information on it than other arguments. Therefore when attaching an attribute to an expression, that expression should be the first argument, optionally followed by additional related expressions.

include Ppx_compare_lib.Comparable.S with type t := t
val compare : t Base__Ppx_compare_lib.compare
val equal : t -> t -> bool
val mem_alloc_pname : mem_kind -> Procname.t

name of the allocation function for the given memory kind

val mem_dealloc_pname : mem_kind -> Procname.t

name of the deallocation function for the given memory kind

type category =
  1. | ACresource
  2. | ACautorelease
  3. | AClock
  4. | ACdiv0
  5. | ACobjc_null
  6. | ACundef
  7. | ACretval
  8. | ACobserver
  9. | ACwontleak

Categories of attributes

val compare_category : category -> category -> int
val equal_category : category -> category -> bool
val to_category : t -> category

Return the category to which the attribute belongs.

val is_undef : t -> bool
val to_string : IStdlib.Pp.env -> t -> string

convert the attribute to a string

val d_attribute : t -> unit

Dump an attribute.