Module Procdesc.Node

node of the control flow graph

type t

type of nodes

include Ppx_compare_lib.Comparable.S with type t := t
val compare : t Base__Ppx_compare_lib.compare
include Ppx_hash_lib.Hashable.S with type t := t
val hash_fold_t : t Base__Ppx_hash_lib.hash_fold
val hash : t -> Base__Ppx_hash_lib.Std.Hash.hash_value
type id = private int

node id

val compare_id : id -> id -> int
val equal_id : id -> id -> bool
val hash_fold_id : Ppx_hash_lib.Std.Hash.state -> id -> Ppx_hash_lib.Std.Hash.state
val hash_id : id -> Ppx_hash_lib.Std.Hash.hash_value
type destruction_kind =
  1. | DestrBreakStmt
  2. | DestrContinueStmt
  3. | DestrFields
  4. | DestrReturnStmt
  5. | DestrScope
  6. | DestrTemporariesCleanup
  7. | DestrVirtualBase
type stmt_nodekind =
  1. | AssertionFailure
  2. | AtomicCompareExchangeBranch
  3. | AtomicExpr
  4. | BetweenJoinAndExit
  5. | BinaryConditionalStmtInit
  6. | BinaryOperatorStmt of string
  7. | Call of string
  8. | CallObjCNew
  9. | CaseStmt
  10. | ClassCastException
  11. | CompoundStmt
  12. | ConditionalStmtBranch
  13. | ConstructorInit
  14. | CXXDynamicCast
  15. | CXXNewExpr
  16. | CXXStdInitializerListExpr
  17. | CXXTemporaryMarkerSet
  18. | CXXTry
  19. | CXXTypeidExpr
  20. | DeclStmt
  21. | DefineBody
  22. | Destruction of destruction_kind
  23. | Erlang
  24. | ErlangCaseClause
  25. | ErlangExpression
  26. | ExceptionHandler
  27. | ExceptionsSink
  28. | ExprWithCleanups
  29. | FinallyBranch
  30. | GCCAsmStmt
  31. | GenericSelectionExpr
  32. | IfStmtBranch
  33. | InitializeDynamicArrayLength
  34. | InitListExp
  35. | LoopBody
  36. | LoopIterIncr
  37. | LoopIterInit
  38. | MessageCall of string
  39. | MethodBody
  40. | MonitorEnter
  41. | MonitorExit
  42. | ObjCCPPThrow
  43. | ObjCIndirectCopyRestoreExpr
  44. | OutOfBound
  45. | ReturnStmt
  46. | Scope of string
  47. | Skip
  48. | SwitchStmt
  49. | ThisNotNull
  50. | Throw
  51. | ThrowNPE
  52. | UnaryOperator

kind of statement node

type prune_node_kind =
  1. | PruneNodeKind_ExceptionHandler
  2. | PruneNodeKind_FalseBranch
  3. | PruneNodeKind_InBound
  4. | PruneNodeKind_IsInstance
  5. | PruneNodeKind_MethodBody
  6. | PruneNodeKind_NotNull
  7. | PruneNodeKind_TrueBranch
type nodekind =
  1. | Start_node
  2. | Exit_node
  3. | Stmt_node of stmt_nodekind
  4. | Join_node
  5. | Prune_node of bool * Sil.if_kind * prune_node_kind
    (*

    (true/false branch, if_kind, comment)

    *)
  6. | Skip_node of string

kind of cfg node

val compare_nodekind : nodekind -> nodekind -> int
val equal_nodekind : nodekind -> nodekind -> bool
val exn_handler_kind : nodekind

kind of Stmt_node for an exception handler.

val exn_sink_kind : nodekind

kind of Stmt_node for an exceptions sink.

val throw_kind : nodekind

kind of Stmt_node for a throw instruction.

val append_instrs : t -> Sil.instr list -> unit

Append the instructions to the list of instructions to execute

val prepend_instrs : t -> Sil.instr list -> unit

Prepend the instructions to the list of instructions to execute

val d_instrs : highlight:Sil.instr option -> t -> unit

Dump instructions for the node, highlighting the given subinstruction if present

val dummy : Procname.t -> t

Create a dummy node

val equal : t -> t -> bool

Check if two nodes are equal

val get_description : IStdlib.Pp.env -> t -> string

Return a description of the node

val get_distance_to_exit : t -> int option

Get the distance to the exit node, if it has been computed

val get_exn : t -> t list

Get the exception nodes from the current node

val get_id : t -> id

Get the unique id of the node

val get_instrs : t -> Instrs.not_reversed_t

Get the instructions to be executed

val get_kind : t -> nodekind

Get the kind of the current node

val get_last_loc : t -> IBase.Location.t

Get the source location of the last instruction in the node

val find_in_node_or_preds : t -> f:(t -> Sil.instr -> 'a option) -> 'a option

Find in the given node or its predecessors

val get_loc : t -> IBase.Location.t

Get the source location of the node

val get_preds : t -> t list

Get the predecessor nodes of the current node

val get_siblings : t -> t IStdlib.IStd.Sequence.t

Get siblings of the current node

val get_proc_name : t -> Procname.t

Get the name of the procedure the node belongs to

val get_succs : t -> t list

Get the successor nodes of the current node

val get_wto_index : t -> int
val set_code_block_exit : t -> code_block_exit:t -> unit

Set an exit node corresponding to a start node of a code block. Using this, when there is a code block, frontend can keep the correspondence between start/exit nodes of a code block.

val is_dangling : t -> bool

Returns true if the node is dangling, i.e. no successors and predecessors

val pp : Stdlib.Format.formatter -> t -> unit

Pretty print the node

val pp_id : Stdlib.Format.formatter -> id -> unit

Pretty print a node id

val pp_stmt : Stdlib.Format.formatter -> stmt_nodekind -> unit
val pp_with_instrs : ?print_types:bool -> Stdlib.Format.formatter -> t -> unit

Pretty print the node with instructions

val compute_key : t -> NodeKey.t