package frama-c
Install
dune-project
Dependency
Authors
-
MMichele Alberti
-
TThibaud Antignac
-
GGergö Barany
-
PPatrick Baudin
-
TThibaut Benjamin
-
AAllan Blanchard
-
LLionel Blatter
-
FFrançois Bobot
-
RRichard Bonichon
-
QQuentin Bouillaguet
-
DDavid Bühler
-
ZZakaria Chihani
-
LLoïc Correnson
-
JJulien Crétin
-
PPascal Cuoq
-
ZZaynah Dargaye
-
BBasile Desloges
-
JJean-Christophe Filliâtre
-
PPhilippe Herrmann
-
MMaxime Jacquemin
-
FFlorent Kirchner
-
AAlexander Kogtenkov
-
TTristan Le Gall
-
JJean-Christophe Léchenet
-
MMatthieu Lemerre
-
DDara Ly
-
DDavid Maison
-
CClaude Marché
-
AAndré Maroneze
-
TThibault Martin
-
FFonenantsoa Maurica
-
MMelody Méaulle
-
BBenjamin Monate
-
YYannick Moy
-
PPierre Nigron
-
AAnne Pacalet
-
VValentin Perrelle
-
GGuillaume Petiot
-
DDario Pinto
-
VVirgile Prevosto
-
AArmand Puccetti
-
FFélix Ridoux
-
VVirgile Robles
-
JJan Rochel
-
MMuriel Roger
-
JJulien Signoles
-
NNicolas Stouls
-
KKostyantyn Vorobyov
-
BBoris Yakobowski
Maintainers
Sources
sha256=0c80dae8074fcb3f6a33d7a41faf9939a2a336478a8d2c79e20e2d7bab953735
doc/frama-c.kernel/Frama_c_kernel/Kernel_function/index.html
Module Frama_c_kernel.Kernel_function
Operations to get info from a kernel function. This module does not give access to information about the set of all the registered kernel functions (like iterators over kernel functions). This kind of operations is stored in module Globals.Functions.
Kernel functions are comparable and hashable
include Datatype.S_with_collections
with type t = Cil_types.kernel_function
and module Set = Cil_datatype.Kf.Set
and module Map = Cil_datatype.Kf.Map
and module Hashtbl = Cil_datatype.Kf.Hashtbl
include Datatype.S with type t = Cil_types.kernel_function
include Datatype.S_no_copy with type t = Cil_types.kernel_function
include Datatype.Ty with type t = Cil_types.kernel_function
type t = Cil_types.kernel_functionval packed_descr : Structural_descr.packPacked version of the descriptor.
val reprs : t listList of representants of the descriptor.
val hash : t -> intHash function: same spec than Hashtbl.hash.
val pretty : Format.formatter -> t -> unitPretty print each value in an user-friendly way.
val mem_project : (Project_skeleton.t -> bool) -> t -> boolmem_project f x must return true iff there is a value p of type Project.t in x such that f p returns true.
module Set = Cil_datatype.Kf.Setmodule Map = Cil_datatype.Kf.Mapmodule Hashtbl = Cil_datatype.Kf.Hashtblval id : t -> intval auxiliary_kf_stmt_state : State.tSearching
val find_first_stmt : t -> Cil_types.stmtFind the first statement in a kernel function.
val find_return : t -> Cil_types.stmtFind the return statement of a kernel function.
val find_label : t -> string -> Cil_types.stmt refFind a given label in a kernel function.
val find_all_labels : t -> Datatype.String.Set.treturns all labels present in a given function.
removes any information related to statements in kernel functions. (i.e. the table used by the function below).
- Must be called when the Ast has silently changed (e.g. with an in-place visitor) before calling one of the functions below
- Use with caution, as it is very expensive to re-populate the table.
val find_defining_kf : Cil_types.varinfo -> t optionFinds the kernel function defining the given varinfo as a local or a formal. Returns None if no such function exists.
val find_from_sid : int -> Cil_types.stmt * tval find_englobing_kf : Cil_types.stmt -> tval find_enclosing_block : Cil_types.stmt -> Cil_types.blockval find_all_enclosing_blocks : Cil_types.stmt -> Cil_types.block listsame as above, but returns all enclosing blocks, starting with the innermost one.
val blocks_closed_by_edge :
Cil_types.stmt ->
Cil_types.stmt ->
Cil_types.block listblocks_closed_by_edge s1 s2 returns the (possibly empty) list of blocks that are closed when going from s1 to s2.
val blocks_opened_by_edge :
Cil_types.stmt ->
Cil_types.stmt ->
Cil_types.block listblocks_opened_by_edge s1 s2 returns the (possibly empty) list of blocks that are opened when going from s1 to s2.
val common_block : Cil_types.stmt -> Cil_types.stmt -> Cil_types.blockcommon_block s1 s2 returns the innermost block that contains both s1 and s2, provided the statements belong to the same function. raises a fatal error if this is not the case.
val stmt_in_loop : t -> Cil_types.stmt -> boolstmt_in_loop kf stmt is true iff stmt strictly occurs in a loop of kf.
val find_enclosing_loop : t -> Cil_types.stmt -> Cil_types.stmtfind_enclosing_loop kf stmt returns the statement corresponding to the innermost loop containing stmt in kf. If stmt itself is a loop, returns stmt
val find_syntactic_callsites : t -> (t * Cil_types.stmt) listcallsites f collect the statements where f is called. Same complexity as find_from_sid.
val local_definition : t -> Cil_types.varinfo -> Cil_types.stmtlocal_definition f v returns the statement initializing the (defined) local variable v of f.
val var_is_in_scope : Cil_types.stmt -> Cil_types.varinfo -> boolvar_is_in_scope kf stmt vi returns true iff the local variable vi is syntactically visible from statement stmt in function kf. Note that on the contrary to Globals.Syntactic_search.find_in_scope, the variable is searched according to its vid, not its vorig_name.
val find_enclosing_stmt_in_block :
Cil_types.block ->
Cil_types.stmt ->
Cil_types.stmtfind_enclosing_stmt_in_block b s returns the statements s' inside b.bstmts that contains s. It might be s itself, but also an inner block (recursively) containing s.
val is_between :
Cil_types.block ->
Cil_types.stmt ->
Cil_types.stmt ->
Cil_types.stmt ->
boolis_between b s1 s2 s3 returns true if the statement s2 appears strictly between s1 and s3 inside the b.bstmts list. All three statements must actually occur in b.bstmts, either directly or indirectly (see Kernel_function.find_enclosing_stmt_in_block).
Checkers
val is_definition : t -> boolval is_in_libc : t -> boolval is_not_called : t -> boolval is_entry_point : t -> boolval is_main : t -> boolval returns_void : t -> boolval is_first_stmt : t -> Cil_types.stmt -> boolval is_return_stmt : t -> Cil_types.stmt -> boolGetters
val dummy : unit -> tval get_vi : t -> Cil_types.varinfoval get_id : t -> intval get_name : t -> stringval get_type : t -> Cil_types.typBe careful! The return type, as normalized by Cabs2Cil does not have any qualifier at first level (e.g no ghost).
val get_return_type : t -> Cil_types.typBe careful! The return type, as normalized by Cabs2Cil does not have any qualifier at first level (e.g no ghost).
val get_location : t -> Cil_types.locationval get_global : t -> Cil_types.globalFor functions with a declaration and a definition, returns the definition.
val get_formals : t -> Cil_types.varinfo listval get_locals : t -> Cil_types.varinfo listval get_statics : t -> Cil_types.varinfo listReturns the list of static variables declared inside the function.
val get_definition : t -> Cil_types.fundecval has_definition : t -> boolval is_ghost : t -> boolMembership of variables
val is_formal : Cil_types.varinfo -> t -> boolval get_formal_position : Cil_types.varinfo -> t -> intget_formal_position v kf is the position of v as parameter of kf.
val is_local : Cil_types.varinfo -> t -> boolval is_formal_or_local : Cil_types.varinfo -> t -> boolval get_called : Cil_types.exp -> t optionReturns the static call to function expr, if any. None means a dynamic call through function pointer.
Collections
module Make_Table
(Data : Datatype.S)
(_ : State_builder.Info_with_size) :
State_builder.Hashtbl with type key = t and type data = Data.tHashtable indexed by kernel functions and dealing with project.
module Hptset :
Hptset.S
with type elt = Cil_types.kernel_function
and type 'a map = 'a Hptmap.Shape(Cil_datatype.Kf).tSet of kernel functions.
Setters
Use carefully the following functions.
val register_stmt : t -> Cil_types.stmt -> Cil_types.block list -> unitRegister a new statement in a kernel function, with the list of blocks that contain the statement (innermost first).
val self : State.t