Skip to content

Commit 8f6af1d

Browse files
[clang-format][NFC] Put all state change into the for statement
Differential Revision: https://reviews.llvm.org/D116563
1 parent 1da96f7 commit 8f6af1d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

clang/lib/Format/UnwrappedLineFormatter.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,8 @@ unsigned UnwrappedLineFormatter::format(
11621162
bool FirstLine = true;
11631163
for (const AnnotatedLine *Line =
11641164
Joiner.getNextMergedLine(DryRun, IndentTracker);
1165-
Line; Line = NextLine, FirstLine = false) {
1165+
Line; PrevPrevLine = PreviousLine, PreviousLine = Line, Line = NextLine,
1166+
FirstLine = false) {
11661167
const AnnotatedLine &TheLine = *Line;
11671168
unsigned Indent = IndentTracker.getIndent();
11681169

@@ -1252,8 +1253,6 @@ unsigned UnwrappedLineFormatter::format(
12521253
}
12531254
if (!DryRun)
12541255
markFinalized(TheLine.First);
1255-
PrevPrevLine = PreviousLine;
1256-
PreviousLine = &TheLine;
12571256
}
12581257
PenaltyCache[CacheKey] = Penalty;
12591258
return Penalty;

0 commit comments

Comments
 (0)