[clang] 25f6379 - [clang-format][NFC] Prefer pass by reference
Björn Schäpers via cfe-commits
cfe-commits at lists.llvm.org
Sat Dec 4 12:30:10 PST 2021
Author: Björn Schäpers
Date: 2021-12-04T21:29:29+01:00
New Revision: 25f637913fe31b6d23e78ff07c725bb537dd3b97
URL: https://github.com/llvm/llvm-project/commit/25f637913fe31b6d23e78ff07c725bb537dd3b97
DIFF: https://github.com/llvm/llvm-project/commit/25f637913fe31b6d23e78ff07c725bb537dd3b97.diff
LOG: [clang-format][NFC] Prefer pass by reference
Differential Revision: https://reviews.llvm.org/D115061
Added:
Modified:
clang/lib/Format/UnwrappedLineFormatter.cpp
Removed:
################################################################################
diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp
index d099cfee9dea2..b9175c59216ba 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -1044,9 +1044,9 @@ class OptimizingLineFormatter : public LineFormatter {
FormatDecision LastFormat = Node->State.NextToken->getDecision();
if (LastFormat == FD_Unformatted || LastFormat == FD_Continue)
- addNextStateToQueue(Penalty, Node, /*NewLine=*/false, &Count, &Queue);
+ addNextStateToQueue(Penalty, Node, /*NewLine=*/false, Count, Queue);
if (LastFormat == FD_Unformatted || LastFormat == FD_Break)
- addNextStateToQueue(Penalty, Node, /*NewLine=*/true, &Count, &Queue);
+ addNextStateToQueue(Penalty, Node, /*NewLine=*/true, Count, Queue);
}
if (Queue.empty()) {
@@ -1072,7 +1072,7 @@ class OptimizingLineFormatter : public LineFormatter {
/// Assume the current state is \p PreviousNode and has been reached with a
/// penalty of \p Penalty. Insert a line break if \p NewLine is \c true.
void addNextStateToQueue(unsigned Penalty, StateNode *PreviousNode,
- bool NewLine, unsigned *Count, QueueType *Queue) {
+ bool NewLine, unsigned &Count, QueueType &Queue) {
if (NewLine && !Indenter->canBreak(PreviousNode->State))
return;
if (!NewLine && Indenter->mustBreak(PreviousNode->State))
@@ -1085,8 +1085,8 @@ class OptimizingLineFormatter : public LineFormatter {
Penalty += Indenter->addTokenToState(Node->State, NewLine, true);
- Queue->push(QueueItem(OrderedPenalty(Penalty, *Count), Node));
- ++(*Count);
+ Queue.push(QueueItem(OrderedPenalty(Penalty, Count), Node));
+ ++Count;
}
/// Applies the best formatting by reconstructing the path in the
More information about the cfe-commits
mailing list