Frama-C API - frama_c_visitor
Class type for a database-aware visitor. This is done by defining auxiliary methods that can be redefined in inherited classes, while the corresponding ones from Cil.cilVisitor
must retain their values as defined here. Otherwise, annotations may not be visited properly. The replaced functions are
vstmt
(usevstmt_aux
instead)vglob
(usevglob_aux
instead)
A few hints on how to use correctly this visitor
- when initializing a new project with it (see
File.init_project_from_visitor
), use a visitor with copy behavior
SkipChildren
andChangeTo
must be used with extreme care in a visitor with copy behavior, or some nodes may be shared between the original and the copy.
- Do not erase a statement during the visit, as there might be annotations attached to it. Change it to Skip instead, the
generic_frama_c_visitor
will know what to do.
- Be careful if you change the
vid
orsid
: this must be done before anything has been attached to the corresponding variable or statement in the new project, which means -- for statements, invstmt
, for the current statement only -- for variables, at their declaration point.
inherit Frama_c_kernel.Cil.cilVisitor
method frama_c_plain_copy : frama_c_visitor
same as plain_copy_visitor but for frama-c specific methods
method vstmt_aux : Frama_c_kernel.Cil_types.stmt -> Frama_c_kernel.Cil_types.stmt Frama_c_kernel.Cil.visitAction
Replacement of vstmt.
method vglob_aux : Frama_c_kernel.Cil_types.global -> Frama_c_kernel.Cil_types.global list Frama_c_kernel.Cil.visitAction
Replacement of vglob.
method current_kf : Frama_c_kernel.Cil_types.kernel_function option
link to the kernel function currently being visited. NB: for copy visitors, the link is to the original kf (anyway, the new kf is created only after the visit is over).
method set_current_kf : Frama_c_kernel.Cil_types.kernel_function -> unit
Internal use only.