@@ -767,8 +767,9 @@ and stmtkind =
767767 | Instr of instr list (* * A group of instructions that do not
768768 contain control flow. Control
769769 implicitly falls through. *)
770- | Return of exp option * location (* * The return statement. This is a
771- leaf in the CFG. *)
770+ | Return of exp option * location * location (* * The return statement. This is a
771+ leaf in the CFG.
772+ Second location is just for expression. *)
772773
773774 | Goto of stmt ref * location (* * A goto statement. Appears from
774775 actual goto's in the code. *)
@@ -1145,7 +1146,7 @@ let rec get_stmtLoc (statement : stmtkind) =
11451146 match statement with
11461147 Instr ([] ) -> lu
11471148 | Instr (hd ::tl ) -> get_instrLoc(hd)
1148- | Return (_ , loc ) -> loc
1149+ | Return (_ , loc , _ ) -> loc
11491150 | Goto (_ , loc ) -> loc
11501151 | ComputedGoto (_ , loc ) -> loc
11511152 | Break (loc ) -> loc
@@ -3861,11 +3862,11 @@ class defaultCilPrinterClass : cilPrinter = object (self)
38613862 ++ self#pBlock () thenBlock)
38623863
38633864 method private pStmtKind (next : stmt ) () = function
3864- Return (None, l ) ->
3865+ Return (None, l , el ) ->
38653866 self#pLineDirective l
38663867 ++ text " return;"
38673868
3868- | Return (Some e , l ) ->
3869+ | Return (Some e , l , el ) ->
38693870 self#pLineDirective l
38703871 ++ text " return ("
38713872 ++ self#pExp () e
@@ -5363,13 +5364,13 @@ and childrenStmt (toPrepend: instr list ref) : cilVisitor -> stmt -> stmt =
53635364 (* Just change the statement kind *)
53645365 let skind' =
53655366 match s.skind with
5366- Break _ | Continue _ | Goto _ | Return (None, _ ) -> s.skind
5367+ Break _ | Continue _ | Goto _ | Return (None, _ , _ ) -> s.skind
53675368 | ComputedGoto (e , l ) ->
53685369 let e' = fExp e in
53695370 if e' != e then ComputedGoto (e', l) else s.skind
5370- | Return (Some e , l ) ->
5371+ | Return (Some e , l , el ) ->
53715372 let e' = fExp e in
5372- if e' != e then Return (Some e', l) else s.skind
5373+ if e' != e then Return (Some e', l, el ) else s.skind
53735374 | Loop (b , l , el , s1 , s2 ) ->
53745375 let b' = fBlock b in
53755376 if b' != b then Loop (b', l, el, s1, s2) else s.skind
0 commit comments