Skip to content
Snippets Groups Projects
Commit b2f1c397 authored by Thibault Martin's avatar Thibault Martin Committed by Virgile Prevosto
Browse files

Retrait du paramètre optionel pour getRetVar

parent 16ef5e5e
No related branches found
No related tags found
No related merge requests found
...@@ -197,7 +197,7 @@ let oneret ?(callback: callback option) (f: fundec) : unit = ...@@ -197,7 +197,7 @@ let oneret ?(callback: callback option) (f: fundec) : unit =
let lastloc = ref Cil_datatype.Location.unknown in let lastloc = ref Cil_datatype.Location.unknown in
let getRetVar = let getRetVar =
let retVar : varinfo option ref = ref None in let retVar : varinfo option ref = ref None in
fun ?(loc=Cil_datatype.Location.unknown) ()-> fun loc ->
match !retVar with match !retVar with
Some rv -> rv Some rv -> rv
| None -> begin | None -> begin
...@@ -212,7 +212,7 @@ let oneret ?(callback: callback option) (f: fundec) : unit = ...@@ -212,7 +212,7 @@ let oneret ?(callback: callback option) (f: fundec) : unit =
inherit Cil.nopCilVisitor inherit Cil.nopCilVisitor
method! vterm_lhost = function method! vterm_lhost = function
| TResult _ -> | TResult _ ->
let v = getRetVar () in let v = getRetVar Cil_datatype.Location.unknown in
ChangeTo (TVar (cvar_to_lvar v)) ChangeTo (TVar (cvar_to_lvar v))
| TMem _ | TVar _ -> DoChildren | TMem _ | TVar _ -> DoChildren
end end
...@@ -268,7 +268,7 @@ let oneret ?(callback: callback option) (f: fundec) : unit = ...@@ -268,7 +268,7 @@ let oneret ?(callback: callback option) (f: fundec) : unit =
(* Must create a statement *) (* Must create a statement *)
let rv = let rv =
if hasRet then if hasRet then
Some (new_exp ~loc (Lval(Var (getRetVar ()), NoOffset))) Some (new_exp ~loc (Lval(Var (getRetVar loc), NoOffset)))
else None else None
in in
mkStmt (Return (rv, loc)) mkStmt (Return (rv, loc))
...@@ -339,7 +339,7 @@ let oneret ?(callback: callback option) (f: fundec) : unit = ...@@ -339,7 +339,7 @@ let oneret ?(callback: callback option) (f: fundec) : unit =
* an instruction that sets the return value (if any). *) * an instruction that sets the return value (if any). *)
s.skind <- begin s.skind <- begin
match retval with match retval with
Some rval -> Instr (Set((Var (getRetVar ~loc ()), NoOffset), rval, loc)) Some rval -> Instr (Set((Var (getRetVar loc), NoOffset), rval, loc))
| None -> Instr (Skip loc) | None -> Instr (Skip loc)
end; end;
let returns_assert = ref ptrue in let returns_assert = ref ptrue in
...@@ -348,7 +348,7 @@ let oneret ?(callback: callback option) (f: fundec) : unit = ...@@ -348,7 +348,7 @@ let oneret ?(callback: callback option) (f: fundec) : unit =
returns_stack; returns_stack;
(match retval with (match retval with
| Some _ -> | Some _ ->
let lvar = Cil.cvar_to_lvar (getRetVar()) in let lvar = Cil.cvar_to_lvar (getRetVar loc) in
Stack.iter Stack.iter
(fun (_,_,ca) -> adjust_assigns_clause loc lvar ca.annot_content) (fun (_,_,ca) -> adjust_assigns_clause loc lvar ca.annot_content)
returns_stack returns_stack
......
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