Module Cfg

module Cfg: sig .. end
Code to compute the control-flow graph of a function or file. This will fill in the preds and succs fields of Cil.stmt

This is required for several other extensions, such as Dataflow2.
Consult the Plugin Development Guide for additional details.


val computeFileCFG : Cil_types.file -> unit
Compute the CFG for an entire file, by calling cfgFun on each function.
val clearFileCFG : ?clear_id:bool -> Cil_types.file -> unit
clear the sid (except when clear_id is explicitly set to false), succs, and preds fields of each statement.
val cfgFun : Cil_types.fundec -> unit
Compute a control flow graph for fd. Stmts in fd have preds and succs filled in
val clearCFGinfo : ?clear_id:bool -> Cil_types.fundec -> unit
clear the sid, succs, and preds fields of each statment in a function
val printCfgChannel : Format.formatter -> Cil_types.fundec -> unit
print control flow graph (in dot form) for fundec to channel
val printCfgFilename : string -> Cil_types.fundec -> unit
Print control flow graph (in dot form) for fundec to file
val prepareCFG : ?keepSwitch:bool -> Cil_types.fundec -> unit
Prepare a function for CFG information computation by Cil.computeCFGInfo. This function converts all Break, Switch, Default and Continue Cil_types.stmtkinds and Cil_types.labels into Ifs and Gotos, giving the function body a very CFG-like character. This function modifies its argument in place.
val computeCFGInfo : Cil_types.fundec -> bool -> unit
Compute the CFG information for all statements in a fundec and return a list of the statements. The input fundec cannot have Break, Switch, Default, or Continue Cil_types.stmtkinds or Cil_types.labels. Use Cil.prepareCFG to transform them away. The second argument should be true if you wish a global statement number, false if you wish a local (per-function) statement numbering. The list of statements is set in the sallstmts field of a fundec.

NOTE: unless you want the simpler control-flow graph provided by prepareCFG, or you need the function's smaxstmtid and sallstmt fields filled in, we recommend you use Cfg.computeFileCFG instead of this function to compute control-flow information. Cfg.computeFileCFG is newer and will handle switch, break, and continue correctly.

val clear_sid_info_ref : (unit -> unit) Pervasives.ref