[clang] 8f6af1d - [clang-format][NFC] Put all state change into the for statement
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 5 03:32:24 PST 2022
Author: Björn Schäpers
Date: 2022-01-05T12:31:36+01:00
New Revision: 8f6af1d4688904fda730d0fea78d2df11252bf40
URL: https://github.com/llvm/llvm-project/commit/8f6af1d4688904fda730d0fea78d2df11252bf40
DIFF: https://github.com/llvm/llvm-project/commit/8f6af1d4688904fda730d0fea78d2df11252bf40.diff
LOG: [clang-format][NFC] Put all state change into the for statement
Differential Revision: https://reviews.llvm.org/D116563
Added:
Modified:
clang/lib/Format/UnwrappedLineFormatter.cpp
Removed:
################################################################################
diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp
index 18a9685ce431..18d61b483952 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -1162,7 +1162,8 @@ unsigned UnwrappedLineFormatter::format(
bool FirstLine = true;
for (const AnnotatedLine *Line =
Joiner.getNextMergedLine(DryRun, IndentTracker);
- Line; Line = NextLine, FirstLine = false) {
+ Line; PrevPrevLine = PreviousLine, PreviousLine = Line, Line = NextLine,
+ FirstLine = false) {
const AnnotatedLine &TheLine = *Line;
unsigned Indent = IndentTracker.getIndent();
@@ -1252,8 +1253,6 @@ unsigned UnwrappedLineFormatter::format(
}
if (!DryRun)
markFinalized(TheLine.First);
- PrevPrevLine = PreviousLine;
- PreviousLine = &TheLine;
}
PenaltyCache[CacheKey] = Penalty;
return Penalty;
More information about the cfe-commits
mailing list