package frama-c
Install
dune-project
Dependency
Authors
-
MMichele Alberti
-
TThibaud Antignac
-
GGergö Barany
-
PPatrick Baudin
-
NNicolas Bellec
-
TThibaut Benjamin
-
AAllan Blanchard
-
LLionel Blatter
-
FFrançois Bobot
-
RRichard Bonichon
-
VVincent Botbol
-
QQuentin Bouillaguet
-
DDavid Bühler
-
ZZakaria Chihani
-
SSylvain Chiron
-
LLoïc Correnson
-
JJulien Crétin
-
PPascal Cuoq
-
ZZaynah Dargaye
-
BBasile Desloges
-
JJean-Christophe Filliâtre
-
PPhilippe Herrmann
-
MMaxime Jacquemin
-
BBenjamin Jorge
-
FFlorent Kirchner
-
AAlexander Kogtenkov
-
RRemi Lazarini
-
TTristan Le Gall
-
KKilyan Le Gallic
-
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
-
CCécile Ruet-Cros
-
JJulien Signoles
-
NNicolas Stouls
-
KKostyantyn Vorobyov
-
BBoris Yakobowski
Maintainers
Sources
sha256=a94384f00d53791cbb4b4d83ab41607bc71962d42461f02d71116c4ff6dca567
doc/frama-c.kernel/Frama_c_kernel/File/index.html
Module Frama_c_kernel.File
Frama-c preprocessing and Cil AST initialization.
Whether a given preprocessor supports gcc options used in some configurations.
type file = | NeedCPP of Filepath.t * string * string list * cpp_opt_kind(*File which needs preprocessing. NeedCPP(filepath, cmd, extra, workdir, cpp_opt_kind):
- filepath: source file to be preprocessed;
- cmd: preprocessing command, before replacement of '%'-arguments;
- extra: list of extra arguments (e.g. from a JCDB);
- cpp_opt_kind: whether the preprocessor supports GNU options such as -I/-D.
| NoCPP of Filepath.t(*Already preprocessed file
*).i| External of Filepath.t * string(*file that can be translated into a Cil AST through an external function, together with the recognized suffix.
*)
File type, according to how it will be preprocessed. Note: string is used here instead of Filepath, to preserve names given on the command line, without normalization.
include Datatype.S with type t = file
include Datatype.S_no_copy with type t = file
val 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.
val new_file_type : string -> (string -> Cil_types.file * Cabs.file) -> unitnew_file_type suffix func funcname registers a new type of files (with corresponding suffix) as recognized by Frama-C through func.
list_available_machdeps () gives the list of the names of available machdeps in Frama-C's share path
val register_code_transformation_category :
string ->
code_transformation_categoryAdds a new category of code transformation
val add_code_transformation_before_cleanup :
?deps:(module Parameter_sig.S) list ->
?before:code_transformation_category list ->
?after:code_transformation_category list ->
code_transformation_category ->
(Cil_types.file -> unit) ->
unitadd_code_transformation_before_cleanup name hook adds an hook in the corresponding category that will be called during the normalization of a linked file, before clean up and removal of temps and unused declarations. If this transformation involves changing statements of a function f, f must be flagged with File.must_recompute_cfg. The optional before (resp after) categories indicates that current transformation must be executed before (resp after) the corresponding ones, if they exist. In case of dependencies cycle, an arbitrary order will be chosen for the transformations involved in the cycle. The optional deps argument gives the list of options whose change (e.g. after a -then) will trigger the transformation over the already computed AST. If several transformations are triggered by the same option, their relative order is preserved.
At this level, globals and ACSL annotations have not been registered.
val add_code_transformation_after_cleanup :
?deps:(module Parameter_sig.S) list ->
?before:code_transformation_category list ->
?after:code_transformation_category list ->
code_transformation_category ->
(Cil_types.file -> unit) ->
unitSame as above, but the hook is applied after clean up. At this level, globals and ACSL annotations have been registered. If the hook adds some new globals or annotations, it must take care of adding them in the appropriate tables. Note that it is the responsibility of the hook to use Ast.mark_as_changed or Ast.mark_as_grown whenever it is the case.
val constfold : code_transformation_categorycategory for syntactic constfolding (done after cleanup)
val must_recompute_cfg : Cil_types.fundec -> unitmust_recompute_cfg f must be called by code transformation hooks when they modify statements in function f. This will trigger a recomputation of the cfg of f after the transformation.
val get_name : t -> stringFile name (not normalized).
val pre_register : t -> unitRegister some file as source file before command-line files
val get_all : unit -> t listReturn the list of toplevel files.
val from_filename : ?cpp:string -> Filepath.t -> tBuild a file from its name. The optional argument is the preprocessor command. Default is !get_preprocessor_command ().
Adds the global name to the list of globals to be kept by Rmtmps, even if unused, overriding any command-line options. Must be called before Rmtmps is run.
Initializers
Initialize the AST of the current project according to the current filename list.
val init_from_c_files : t list -> unitInitialize the cil file representation of the current project. Should be called at most once per project.
val init_project_from_cil_file : Project.t -> Cil_types.file -> unitInitialize the cil file representation with the given file for the given project from the current one. Should be called at most once per project.
val init_project_from_visitor :
?reorder:bool ->
Project.t ->
Visitor.frama_c_visitor ->
unitinit_project_from_visitor prj vis initialize the cil file representation of prj. prj must be essentially empty: it can have some options set, but not an existing cil file; proj is filled using vis, which must be a copy visitor that puts its results in prj. if reorder is true (default is false) the new AST in prj will be reordered.
val create_project_from_visitor :
?reorder:bool ->
?last:bool ->
string ->
(Project.t -> Visitor.frama_c_visitor) ->
Project.tReturn a new project with a new cil file representation by visiting the file of the current project. If reorder is true, the globals in the AST of the new project are reordered (default is false). If last is true (by default), remember than the returned project is the last created one. The visitor is responsible to avoid sharing between old file and new file (i.e. it should use Visitor_behavior.copy at some point).
val create_rebuilt_project_from_visitor :
?reorder:bool ->
?last:bool ->
?preprocess:bool ->
string ->
(Project.t -> Visitor.frama_c_visitor) ->
Project.tLike create_project_from_visitor, but the new generated cil file is generated into a temp .i or .c file according to preprocess, then re-built by Frama-C in the returned project. For instance, use this function if the new cil file contains a constructor Cil_types.global.GText as global.
Note that the generation of a preprocessed C file may fail in some cases (e.g. if it includes headers already included). Thus the generated file is NOT preprocessed by default.
val prepare_cil_file : Cil_types.file -> unitval files_pre_register_state : State.tInitialize the cil file representation with the file given on the command line. Should be called at most once per project.
reorder globals so that all uses of an identifier are preceded by its declaration. This may introduce new declarations in the AST.
val reorder_custom_ast : Cil_types.file -> unitPretty printing
val pretty_machdep :
?fmt:Format.formatter ->
?machdep:Machdep.mach ->
unit ->
unitPrints the associated machdep, or the current one in current project by default. Default output formatter is Log.print_on_output.
val pretty_ast : ?prj:Project.t -> ?fmt:Format.formatter -> unit -> unitPrint the project CIL file on the given Formatter. The default project is the current one. The default formatter is Kernel.CodeOutput.get_fmt ().