Skip to content
Snippets Groups Projects
Commit beaaea1f authored by Valentin Perrelle's avatar Valentin Perrelle Committed by David Bühler
Browse files

[Dive] Synchronize with Frama-C master

parent 8b4694bb
No related branches found
No related tags found
No related merge requests found
...@@ -84,37 +84,34 @@ module Variable = Data.Collection (struct ...@@ -84,37 +84,34 @@ module Variable = Data.Collection (struct
let of_json json = let of_json json =
let open Yojson.Basic.Util in let open Yojson.Basic.Util in
try let funname =
let funname = try Some (json |> member "fun" |> to_string)
try Some (json |> member "fun" |> to_string) with Not_found -> None
with Not_found -> None and varname = json |> member "var" |> to_string in
and varname = json |> member "var" |> to_string in match funname with
match funname with | Some name ->
| Some name -> let kf =
let kf = try
try Globals.Functions.find_by_name name
Globals.Functions.find_by_name name with Not_found ->
with Not_found -> Data.failure "no function '%s'" name
Data.failure json "no function '%s'" name in
in let vi =
let vi = try Globals.Vars.find_from_astinfo varname (Cil_types.VLocal kf)
try Globals.Vars.find_from_astinfo varname (Cil_types.VLocal kf) with Not_found ->
with Not_found -> try Globals.Vars.find_from_astinfo varname (Cil_types.VFormal kf)
try Globals.Vars.find_from_astinfo varname (Cil_types.VFormal kf) with Not_found ->
with Not_found -> Data.failure "no variable '%s' in function '%s'"
Data.failure json "no variable '%s' in function '%s'" varname name
varname name in
in vi
vi | None ->
match
Globals.Syntactic_search.find_in_scope varname Cil_types.Program
with
| Some vi -> vi
| None -> | None ->
match Data.failure "no global variable '%s'" varname
Globals.Syntactic_search.find_in_scope varname Cil_types.Program
with
| Some vi -> vi
| None ->
Data.failure json "no global variable '%s'" varname
with Not_found | Failure _ ->
Data.failure json "Invalid source format"
end) end)
module Function = Data.Collection (struct module Function = Data.Collection (struct
...@@ -133,7 +130,7 @@ module Function = Data.Collection (struct ...@@ -133,7 +130,7 @@ module Function = Data.Collection (struct
try try
Globals.Functions.find_by_name name Globals.Functions.find_by_name name
with Not_found -> with Not_found ->
Data.failure json "no function '%s'" name Data.failure "no function '%s'" name
end) end)
module Node = Data.Collection (struct module Node = Data.Collection (struct
...@@ -152,7 +149,7 @@ module Node = Data.Collection (struct ...@@ -152,7 +149,7 @@ module Node = Data.Collection (struct
try try
Build.find_node (get_graph ()) node_key Build.find_node (get_graph ()) node_key
with Not_found -> with Not_found ->
Data.failure json "no node '%d' in the current graph" node_key Data.failure "no node '%d' in the current graph" node_key
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