summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Schäpers <bjoern@hazardy.de>2021-12-05 12:31:56 +0100
committerBjörn Schäpers <bjoern@hazardy.de>2022-01-03 23:06:56 +0100
commit1188f241acb78dacef00b7b6b3ec0b04cb43c786 (patch)
tree51471c2fb283bc49cccb8bcefc61631549266e3d
parentd48d1f8ee84577a1ca38d4fe03956ee27884e399 (diff)
downloadllvm-1188f241acb78dacef00b7b6b3ec0b04cb43c786.tar.gz
Revert "[clang-format][NFC] Prefer pass by reference"
This reverts commit 25f637913fe31b6d23e78ff07c725bb537dd3b97. Differential Revision: https://reviews.llvm.org/D115061
-rw-r--r--clang/lib/Format/UnwrappedLineFormatter.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Format/UnwrappedLineFormatter.cpp b/clang/lib/Format/UnwrappedLineFormatter.cpp
index 2d71a939d7b7..303150348ad8 100644
--- a/clang/lib/Format/UnwrappedLineFormatter.cpp
+++ b/clang/lib/Format/UnwrappedLineFormatter.cpp
@@ -1064,9 +1064,9 @@ private:
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()) {
@@ -1092,7 +1092,7 @@ private:
/// 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))
@@ -1105,8 +1105,8 @@ private:
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