Module IR__Procdesc

Per-procedure CFG

module NodeKey : sig ... end
module Node : sig ... end

node of the control flow graph

module IdMap : IStdlib.PrettyPrintable.PPMap with type PPMap.key = Node.id

Map with node id keys.

module NodeHash : IStdlib.IStd.Caml.Hashtbl.S with type NodeHash.key = Node.t

Hash table with nodes as keys.

module NodeMap : IStdlib.IStd.Caml.Map.S with type NodeMap.key = Node.t

Map over nodes.

module NodeSet : IStdlib.IStd.Caml.Set.S with type NodeSet.elt = Node.t

Set of nodes.

type t

proc description

val append_locals : t -> IR.ProcAttributes.var_data list -> unit

append a list of new local variables to the existing list of local variables

val compute_distance_to_exit_node : t -> unit

Compute the distance of each node to the exit node, if not computed already

val create_node : t -> IBase.Location.t -> Node.nodekind -> IR.Sil.instr list -> Node.t

Create a new cfg node with the given location, kind, list of instructions, and add it to the procdesc.

val create_node_from_not_reversed : t -> IBase.Location.t -> Node.nodekind -> IR.Instrs.not_reversed_t -> Node.t
val fold_instrs : t -> init:'accum -> f:('accum -> Node.t -> IR.Sil.instr -> 'accum) -> 'accum

fold over all nodes and their instructions

val find_map_instrs : t -> f:(IR.Sil.instr -> 'a option) -> 'a option
val from_proc_attributes : IR.ProcAttributes.t -> t

Use Cfg.create_proc_desc if you are adding a proc desc to a cfg

val get_access : t -> IR.ProcAttributes.access

Return the visibility attribute

val get_attributes : t -> IR.ProcAttributes.t

Get the attributes of the procedure.

val set_attributes : t -> IR.ProcAttributes.t -> unit
val get_captured : t -> IR.CapturedVar.t list

Return name and type of block's captured variables

val get_exit_node : t -> Node.t
val get_formals : t -> (IR.Mangled.t * IR.Typ.t) list

Return name and type of formal parameters

val get_pvar_formals : t -> (IR.Pvar.t * IR.Typ.t) list

Return pvar and type of formal parameters

val get_loc : t -> IBase.Location.t

Return loc information for the procedure

val get_locals : t -> IR.ProcAttributes.var_data list

Return name and type and attributes of local variables

val get_nodes : t -> Node.t list
val get_proc_name : t -> IR.Procname.t
val get_ret_type : t -> IR.Typ.t

Return the return type of the procedure and type string

val has_added_return_param : t -> bool
val is_ret_type_pod : t -> bool
val get_ret_var : t -> IR.Pvar.t
val get_ret_param_var : t -> IR.Pvar.t
val get_start_node : t -> Node.t
val get_static_callees : t -> IR.Procname.t list

get a list of unique static callees excluding self

val is_defined : t -> bool

Return true iff the procedure is defined, and not just declared

val is_java_synchronized : t -> bool

Return true if the procedure signature has the Java synchronized keyword

val is_objc_arc_on : t -> bool

Return true iff the ObjC procedure is compiled with ARC

val iter_instrs : (Node.t -> IR.Sil.instr -> unit) -> t -> unit

iterate over all nodes and their instructions

val replace_instrs : t -> f:(Node.t -> IR.Sil.instr -> IR.Sil.instr) -> bool

Map and replace the instructions to be executed. Returns true if at least one substitution occured.

val replace_instrs_using_context : t -> f:(Node.t -> 'a -> IR.Sil.instr -> IR.Sil.instr) -> update_context:('a -> IR.Sil.instr -> 'a) -> context_at_node:(Node.t -> 'a) -> bool

Map and replace the instructions to be executed using a context that we built with previous instructions in the node. Returns true if at least one substitution occured.

val replace_instrs_by_using_context : t -> f:(Node.t -> 'a -> IR.Sil.instr -> IR.Sil.instr array) -> update_context:('a -> IR.Sil.instr -> 'a) -> context_at_node:(Node.t -> 'a) -> bool

Like replace_instrs_using_context, but slower, and each instruction may be replaced by 0, 1, or more instructions.

val iter_nodes : (Node.t -> unit) -> t -> unit

iterate over all the nodes of a procedure

val fold_nodes : t -> init:'accum -> f:('accum -> Node.t -> 'accum) -> 'accum

fold over all the nodes of a procedure

val fold_slope_range : Node.t -> Node.t -> init:'accum -> f:('accum -> Node.t -> 'accum) -> 'accum

fold between two nodes or until we reach a branching structure

val set_succs : Node.t -> normal:Node.t list option -> exn:Node.t list option -> unit

Set the successor nodes and exception nodes, if given, and update predecessor links

val node_set_succs : t -> Node.t -> normal:Node.t list -> exn:Node.t list -> unit

Set the successor nodes and exception nodes, and update predecessor links

val set_exit_node : t -> Node.t -> unit

Set the exit node of the procedure

val set_start_node : t -> Node.t -> unit
val get_wto : t -> Node.t IR.WeakTopologicalOrder.Partition.t
val is_loop_head : t -> Node.t -> bool
val pp_signature : Stdlib.Format.formatter -> t -> unit
val pp_local : Stdlib.Format.formatter -> IR.ProcAttributes.var_data -> unit
val is_specialized : t -> bool
val is_captured_pvar : t -> IR.Pvar.t -> bool

true if pvar is a captured variable of a cpp lambda or obcj block

val is_captured_var : t -> IR.Var.t -> bool

true if var is a captured variable of a cpp lambda or obcj block

val has_modify_in_block_attr : t -> IR.Pvar.t -> bool
val shallow_copy_code_from_pdesc : orig_pdesc:t -> dest_pdesc:t -> unit
module SQLite : IBase.SqliteUtils.Data with type t = t option

per-procedure CFGs are stored in the SQLite "procedures" table as NULL if the procedure has no CFG

val load : IR.Procname.t -> t option