Skip to content

Commit 937aa1d

Browse files
committed
Preserve for loop expression location after doDecl call
Restore currentLoc and currentExpLoc after the doDecl call in the FOR statement handler to prevent the increment expression from inheriting the initialization location.
1 parent 7797529 commit 937aa1d

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/frontc/cabs2cil.ml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6864,6 +6864,8 @@ and doStatement (s : A.statement) : chunk =
68646864
FC_EXP e1 -> doExp false e1 ADrop
68656865
| FC_DECL d1 -> (doDecl false false d1, zero, voidType)
68666866
in
6867+
currentLoc := loc';
6868+
currentExpLoc := SynthetizeLoc.doLoc eloc';
68676869
(* First instruction (assignment) in for loop initializer has non-synthetic statement location before for loop.
68686870
Its expression location inside for loop parentheses is synthetic.
68696871
All other instructions are fully synthetic. *)

0 commit comments

Comments
 (0)