Class type Cil.cilVisitor

class type cilVisitor = object .. end

A visitor interface for traversing CIL trees. Create instantiations of this type by specializing the class Cil.nopCilVisitor. Each of the specialized visiting functions can also call the queueInstr to specify that some instructions should be inserted before the current statement. Use syntax like self#queueInstr to call a method associated with the current object.

Important Note for Frama-C Users: Unless you really know what you are doing, you should probably inherit from the Visitor.generic_frama_c_visitor instead of Cil.genericCilVisitor or Cil.nopCilVisitor


method behavior : Visitor_behavior.t

the kind of behavior expected for the behavior.

method project : Project.t option

Project the visitor operates on. Non-nil for copy visitor.

method plain_copy_visitor : cilVisitor

a visitor who only does copies of the nodes according to behavior

method vfile : Cil_types.file -> Cil_types.file visitAction

visit a whole file.

method vvdec : Cil_types.varinfo -> Cil_types.varinfo visitAction

Invoked for each variable declaration. The children to be traversed are those corresponding to the type and attributes of the variable. Note that variable declarations are GVar, GVarDecl, GFun and GFunDecl globals, the formals of functions prototypes, and the formals and locals of function definitions. This means that the list of formals of a function may be traversed multiple times if there exists both a declaration and a definition, or multiple declarations.

method vvrbl : Cil_types.varinfo -> Cil_types.varinfo visitAction

Invoked on each variable use. Here only the SkipChildren and ChangeTo actions make sense since there are no subtrees. Note that the type and attributes of the variable are not traversed for a variable use.

method vexpr : Cil_types.exp -> Cil_types.exp visitAction

Invoked on each expression occurrence. The subtrees are the subexpressions, the types (for a Cast or SizeOf expression) or the variable use.

method vlval : Cil_types.lval -> Cil_types.lval visitAction

Invoked on each lvalue occurrence

method voffs : Cil_types.offset -> Cil_types.offset visitAction

Invoked on each offset occurrence that is *not* as part of an initializer list specification, i.e. in an lval or recursively inside an offset.

method vinitoffs : Cil_types.offset -> Cil_types.offset visitAction

Invoked on each offset appearing in the list of a CompoundInit initializer.

method vinst : Cil_types.instr -> Cil_types.instr list visitAction

Invoked on each instruction occurrence. The ChangeTo action can replace this instruction with a list of instructions

method vstmt : Cil_types.stmt -> Cil_types.stmt visitAction

Control-flow statement. The default DoChildren action does not create a new statement when the components change. Instead it updates the contents of the original statement. This is done to preserve the sharing with Goto and Case statements that point to the original statement. If you use the ChangeTo action then you should take care of preserving that sharing yourself.

method vblock : Cil_types.block -> Cil_types.block visitAction

Block.

method vfunc : Cil_types.fundec -> Cil_types.fundec visitAction

Function definition. Replaced in place.

method vglob : Cil_types.global -> Cil_types.global list visitAction

Global (vars, types, etc.)

method vinit : Cil_types.varinfo ->
Cil_types.offset -> Cil_types.init -> Cil_types.init visitAction

Initializers. Pass the global where this occurs, and the offset

method vlocal_init : Cil_types.varinfo ->
Cil_types.local_init -> Cil_types.local_init visitAction

local initializer. pass the variable under initialization.

method vtype : Cil_types.typ -> Cil_types.typ visitAction

Use of some type. For typedef, struct, union and enum, the visit is done once at the global defining the type. Thus, children of TComp, TEnum and TNamed are not visited again.

method vcompinfo : Cil_types.compinfo -> Cil_types.compinfo visitAction

declaration of a struct/union

method venuminfo : Cil_types.enuminfo -> Cil_types.enuminfo visitAction

declaration of an enumeration

method vfieldinfo : Cil_types.fieldinfo -> Cil_types.fieldinfo visitAction

visit the declaration of a field of a structure or union

method venumitem : Cil_types.enumitem -> Cil_types.enumitem visitAction

visit the declaration of an enumeration item

method vattr : Cil_types.attribute -> Cil_types.attribute list visitAction

Attribute. Each attribute can be replaced by a list

method vattrparam : Cil_types.attrparam -> Cil_types.attrparam visitAction

Attribute parameters.

method queueInstr : Cil_types.instr list -> unit

Add here instructions while visiting to queue them to precede the current statement being processed. Use this method only when you are visiting an expression that is inside a function body, or a statement, because otherwise there will no place for the visitor to place your instructions.

method unqueueInstr : unit -> Cil_types.instr list

Gets the queue of instructions and resets the queue. This is done automatically for you when you visit statements.

method current_stmt : Cil_types.stmt option

link to the current statement being visited.

NB: for copy visitor, the stmt is the original one (use get_stmt to obtain the corresponding copy)

method current_kinstr : Cil_types.kinstr

Kstmt stmt when visiting statement stmt, Kglobal when called outside of a statement.

method push_stmt : Cil_types.stmt -> unit
method pop_stmt : Cil_types.stmt -> unit
method current_func : Cil_types.fundec option

link to the current function being visited.

NB: for copy visitors, the fundec is the original one.

method set_current_func : Cil_types.fundec -> unit
method reset_current_func : unit -> unit
method vlogic_type : Cil_types.logic_type -> Cil_types.logic_type visitAction
method vmodel_info : Cil_types.model_info -> Cil_types.model_info visitAction
method videntified_term : Cil_types.identified_term -> Cil_types.identified_term visitAction
method vterm : Cil_types.term -> Cil_types.term visitAction
method vterm_node : Cil_types.term_node -> Cil_types.term_node visitAction
method vterm_lval : Cil_types.term_lval -> Cil_types.term_lval visitAction
method vterm_lhost : Cil_types.term_lhost -> Cil_types.term_lhost visitAction
method vterm_offset : Cil_types.term_offset -> Cil_types.term_offset visitAction
method vlogic_label : Cil_types.logic_label -> Cil_types.logic_label visitAction
method vlogic_info_decl : Cil_types.logic_info -> Cil_types.logic_info visitAction
method vlogic_info_use : Cil_types.logic_info -> Cil_types.logic_info visitAction
method vlogic_type_info_decl : Cil_types.logic_type_info -> Cil_types.logic_type_info visitAction
method vlogic_type_info_use : Cil_types.logic_type_info -> Cil_types.logic_type_info visitAction
method vlogic_type_def : Cil_types.logic_type_def -> Cil_types.logic_type_def visitAction
method vlogic_ctor_info_decl : Cil_types.logic_ctor_info -> Cil_types.logic_ctor_info visitAction
method vlogic_ctor_info_use : Cil_types.logic_ctor_info -> Cil_types.logic_ctor_info visitAction
method vlogic_var_decl : Cil_types.logic_var -> Cil_types.logic_var visitAction
method vlogic_var_use : Cil_types.logic_var -> Cil_types.logic_var visitAction
method vquantifiers : Cil_types.quantifiers -> Cil_types.quantifiers visitAction
method videntified_predicate : Cil_types.identified_predicate ->
Cil_types.identified_predicate visitAction
method vpredicate_node : Cil_types.predicate_node -> Cil_types.predicate_node visitAction
method vpredicate : Cil_types.predicate -> Cil_types.predicate visitAction
method vbehavior : Cil_types.funbehavior -> Cil_types.funbehavior visitAction
method vspec : Cil_types.funspec -> Cil_types.funspec visitAction
method vassigns : Cil_types.assigns -> Cil_types.assigns visitAction
method vfrees : Cil_types.identified_term list ->
Cil_types.identified_term list visitAction
method vallocates : Cil_types.identified_term list ->
Cil_types.identified_term list visitAction
method vallocation : Cil_types.allocation -> Cil_types.allocation visitAction
method vloop_pragma : Cil_types.loop_pragma -> Cil_types.loop_pragma visitAction
method vslice_pragma : Cil_types.slice_pragma -> Cil_types.slice_pragma visitAction
method vimpact_pragma : Cil_types.impact_pragma -> Cil_types.impact_pragma visitAction
method vdeps : Cil_types.deps -> Cil_types.deps visitAction
method vfrom : Cil_types.from -> Cil_types.from visitAction
method vcode_annot : Cil_types.code_annotation -> Cil_types.code_annotation visitAction
method vannotation : Cil_types.global_annotation -> Cil_types.global_annotation visitAction
method fill_global_tables : unit

fill the global environment tables at the end of a full copy in a new project.

method get_filling_actions : (unit -> unit) Stdlib.Queue.t

get the queue of actions to be performed at the end of a full copy.