Skip to content
Snippets Groups Projects
Commit 0c5d3963 authored by Andre Maroneze's avatar Andre Maroneze Committed by Thibault Martin
Browse files

[Kernel] Ast_info: add function get_statics (previously at Kernel_function)

parent ad600b48
No related branches found
No related tags found
No related merge requests found
...@@ -54,17 +54,7 @@ let get_locals f = match f.fundec with ...@@ -54,17 +54,7 @@ let get_locals f = match f.fundec with
let get_statics f = match f.fundec with let get_statics f = match f.fundec with
| Definition (d, _) -> | Definition (d, _) ->
let statics = ref [] in Ast_info.Function.get_statics d
let local_statics_visitor =
object
inherit Cil.nopCilVisitor
method! vblock b =
statics := !statics @ b.bstatics;
Cil.DoChildren
end
in
ignore (Cil.visitCilBlock local_statics_visitor d.sbody);
!statics
| Declaration (_, _, _, _) -> [] | Declaration (_, _, _, _) -> []
let () = Globals.get_statics := get_statics let () = Globals.get_statics := get_statics
......
...@@ -364,6 +364,22 @@ module Function = struct ...@@ -364,6 +364,22 @@ module Function = struct
let get_name f = (get_vi f).vname let get_name f = (get_vi f).vname
let get_id f = (get_vi f).vid let get_id f = (get_vi f).vid
let get_statics fundec =
let statics = ref [] in
let local_statics_visitor =
object
inherit Cil.nopCilVisitor
method! vblock b =
statics := !statics @ b.bstatics;
Cil.DoChildren
method! vinst _ = Cil.SkipChildren
method! vvdec _ = Cil.SkipChildren
method! vexpr _ = Cil.SkipChildren
end
in
ignore (Cil.visitCilBlock local_statics_visitor fundec.sbody);
!statics
end end
exception FoundBlock of block exception FoundBlock of block
......
...@@ -230,6 +230,10 @@ module Function: sig ...@@ -230,6 +230,10 @@ module Function: sig
val get_vi: cil_function -> varinfo val get_vi: cil_function -> varinfo
val get_name: cil_function -> string val get_name: cil_function -> string
val get_id: cil_function -> int val get_id: cil_function -> int
val get_statics: fundec -> varinfo list
(** @since Frama-C+dev *)
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