Frama-C:
Plug-ins:
Libraries:

Frama-C API - Visitor_behavior

Operations on visitor behaviors.

  • since 20.0-Calcium.
type t

How the visitor should behave in front of mutable fields: in place modification or copy of the structure. This type is abstract. Use one of the two values below in your classes.

val inplace : unit -> t

In-place modification. Behavior of the original cil visitor.

val copy : Project.t -> t

Makes fresh copies of the mutable structures.

  • preserves sharing for varinfo.
  • makes fresh copy of varinfo only for declarations. Variables that are only used in the visited AST are thus still shared with the original AST. This allows for instance to copy a function with its formals and local variables, and to keep the references to other globals in the function's body.
val refresh : Project.t -> t

Makes fresh copies of the mutable structures and provides fresh id for the structures that have ids. Note that as for copy, only varinfo that are declared in the scope of the visit will be copied and provided with a new id.

val is_fresh : t -> bool

true iff the behavior provides fresh id for copied structs with id. Always false for an inplace visitor.

val is_copy : t -> bool

true iff the behavior is a copy behavior.

val get_project : t -> Project.t option
module Reset : sig ... end

Reset operations on behaviors, allows to reset the tables associated to a given kind of AST elements. If you use fresh instances of visitor for each round of transformation, you should not need this module. In place modifications do not need this at all.

module type Get = sig ... end
module Get : Get

Get operations on behaviors, allows to get the representative of an AST element in the current state of the visitor.

module Get_orig : Get

Get operations on behaviors, allows to get the original representative of an element of the new AST in the curent state of the visitor.

module Memo : Get

Memo operations on behaviors, allows to get a binding in the new project for the given AST element, creating one if it does not already exists.

module type Set = sig ... end
module Set : Set

Set operations on behaviors, allows to change the representative of a given AST element in the current state of the visitor. Use with care (i.e. makes sure that the old one is not referenced anywhere in the AST, or sharing will be lost).

module Set_orig : Set

Set operations on behaviors related to original representatives, allows to change the reference of an element of the new AST in the current state of the visitor. Use with care.

module type Unset = sig ... end
module Unset : Unset

Operations to remove the entry associated to a given AST element in the current state of the visitor. Use with care (i.e. make sure that you will never visit again this element in the same visiting context).

module Unset_orig : Unset

Operations to remove the entry associated to a given element of the new AST in the current state of the visitor. Use with care.

module Iter : sig ... end

Iter operations on the table of a given type of AST elements.

module Fold : sig ... end

Fold operations on table of a given type of AST elements.