Skip to content
Snippets Groups Projects
Commit 3994d21b authored by Basile Desloges's avatar Basile Desloges Committed by Julien Signoles
Browse files

[eacsl] Add a function to allow visiting global_annotation in E_acsl_visitor

parent 22532fbe
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,7 @@ let case_globals ...@@ -31,6 +31,7 @@ let case_globals
?(var_fun_decl = fun _ -> default ()) ?(var_fun_decl = fun _ -> default ())
?(var_init = fun _ -> default ()) ?(var_init = fun _ -> default ())
?(var_def = fun _ _ -> default ()) ?(var_def = fun _ _ -> default ())
?(glob_annot = fun _ -> default ())
~fun_def ~fun_def
= function = function
(* library functions and built-ins *) (* library functions and built-ins *)
...@@ -65,6 +66,10 @@ let case_globals ...@@ -65,6 +66,10 @@ let case_globals
| GFun(fundec, _) -> | GFun(fundec, _) ->
fun_def fundec fun_def fundec
(* global annotation *)
| GAnnot (ga, _) ->
glob_annot ga
(* other globals: nothing to do *) (* other globals: nothing to do *)
| GType _ | GType _
| GCompTag _ | GCompTag _
...@@ -74,7 +79,6 @@ let case_globals ...@@ -74,7 +79,6 @@ let case_globals
| GAsm _ | GAsm _
| GPragma _ | GPragma _
| GText _ | GText _
| GAnnot _ (* do never read annotation from sources *)
-> ->
default () default ()
...@@ -106,6 +110,9 @@ class visitor ...@@ -106,6 +110,9 @@ class visitor
method var_def : varinfo -> init -> global list Cil.visitAction = method var_def : varinfo -> init -> global list Cil.visitAction =
fun _ _ -> self#default () fun _ _ -> self#default ()
method glob_annot: global_annotation -> global list Cil.visitAction =
fun _ -> self#default ()
method fun_def ({svar = vi}) = method fun_def ({svar = vi}) =
let kf = try Globals.Functions.get vi with Not_found -> assert false in let kf = try Globals.Functions.get vi with Not_found -> assert false in
if Functions.check kf then Cil.DoChildren else Cil.SkipChildren if Functions.check kf then Cil.DoChildren else Cil.SkipChildren
...@@ -120,5 +127,6 @@ class visitor ...@@ -120,5 +127,6 @@ class visitor
~var_fun_decl:self#var_fun_decl ~var_fun_decl:self#var_fun_decl
~var_init:self#var_init ~var_init:self#var_init
~var_def:self#var_def ~var_def:self#var_def
~glob_annot:self#glob_annot
~fun_def:self#fun_def ~fun_def:self#fun_def
end end
...@@ -31,6 +31,7 @@ val case_globals : ...@@ -31,6 +31,7 @@ val case_globals :
?var_fun_decl:(varinfo -> 'a) -> ?var_fun_decl:(varinfo -> 'a) ->
?var_init:(varinfo -> 'a) -> ?var_init:(varinfo -> 'a) ->
?var_def:(varinfo -> init -> 'a) -> ?var_def:(varinfo -> init -> 'a) ->
?glob_annot:(global_annotation -> 'a) ->
fun_def:(fundec -> 'a) -> fun_def:(fundec -> 'a) ->
global -> 'a global -> 'a
(** Function to descend into the root of the ast according to the various cases (** Function to descend into the root of the ast according to the various cases
...@@ -47,6 +48,7 @@ val case_globals : ...@@ -47,6 +48,7 @@ val case_globals :
value value
- [var_def] is the case for variable definitions with an initialization - [var_def] is the case for variable definitions with an initialization
value value
- [glob_annot] is the case for global annotations
- [fun_def] is the case for function definition. *) - [fun_def] is the case for function definition. *)
(** Visitor for managing the root of the AST, on the globals level, with the (** Visitor for managing the root of the AST, on the globals level, with the
...@@ -64,5 +66,6 @@ class visitor : ...@@ -64,5 +66,6 @@ class visitor :
method var_fun_decl: varinfo -> global list Cil.visitAction method var_fun_decl: varinfo -> global list Cil.visitAction
method var_init: varinfo -> global list Cil.visitAction method var_init: varinfo -> global list Cil.visitAction
method var_def: varinfo -> init -> global list Cil.visitAction method var_def: varinfo -> init -> global list Cil.visitAction
method glob_annot: global_annotation -> global list Cil.visitAction
method fun_def: fundec -> global list Cil.visitAction method fun_def: fundec -> global list Cil.visitAction
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment