[clang-format] Use prefix increment and decrement. NFC.

This commit is contained in:
Marek Kurdej 2022-01-07 11:19:53 +01:00
parent c9e8a516df
commit 359b4e6cdb
7 changed files with 14 additions and 14 deletions

View File

@ -102,7 +102,7 @@ void DefinitionBlockSeparator::separateBlocks(
TargetToken = TargetToken->Next;
if (!TargetToken) {
while (I < Lines.size() && !Lines[I]->First->is(tok::r_brace))
I++;
++I;
}
} else if (CurrentLine->First->closesScope()) {
if (OpeningLineIndex > Lines.size())

View File

@ -2214,7 +2214,7 @@ private:
unsigned St = Idx, End = Idx;
while ((End + 1) < Tokens.size() &&
Tokens[End]->Next == Tokens[End + 1]) {
End++;
++End;
}
auto SR = CharSourceRange::getCharRange(Tokens[St]->Tok.getLocation(),
Tokens[End]->Tok.getEndLoc());
@ -2450,7 +2450,7 @@ std::string replaceCRLF(const std::string &Code) {
do {
Pos = Code.find("\r\n", LastPos);
if (Pos == LastPos) {
LastPos++;
++LastPos;
continue;
}
if (Pos == std::string::npos) {

View File

@ -260,7 +260,7 @@ std::pair<tooling::Replacements, unsigned> NamespaceEndCommentsFixer::analyze(
// remove end comment, it will be merged in next one
updateEndComment(EndCommentPrevTok, std::string(), SourceMgr, &Fixes);
}
CompactedNamespacesCount++;
++CompactedNamespacesCount;
AllNamespaceNames = "::" + NamespaceName + AllNamespaceNames;
continue;
}

View File

@ -260,13 +260,13 @@ private:
while (Start != References.end() && Start->FormattingOff) {
// Skip over all imports w/ disabled formatting.
ReferencesSorted.push_back(*Start);
Start++;
++Start;
}
SmallVector<JsModuleReference, 16> SortChunk;
while (Start != References.end() && !Start->FormattingOff) {
// Skip over all imports w/ disabled formatting.
SortChunk.push_back(*Start);
Start++;
++Start;
}
llvm::stable_sort(SortChunk);
mergeModuleReferences(SortChunk);

View File

@ -1564,9 +1564,9 @@ private:
int ParenLevel = 0;
while (Current) {
if (Current->is(tok::l_paren))
ParenLevel++;
++ParenLevel;
if (Current->is(tok::r_paren))
ParenLevel--;
--ParenLevel;
if (ParenLevel < 1)
break;
Current = Current->Next;
@ -1590,9 +1590,9 @@ private:
break;
}
if (TemplateCloser->is(tok::less))
NestingLevel++;
++NestingLevel;
if (TemplateCloser->is(tok::greater))
NestingLevel--;
--NestingLevel;
if (NestingLevel < 1)
break;
TemplateCloser = TemplateCloser->Next;

View File

@ -2449,7 +2449,7 @@ void UnwrappedLineParser::parseLabel(bool LeftAlignLabel) {
addUnwrappedLine();
if (!Style.IndentCaseBlocks &&
Style.BreakBeforeBraces == FormatStyle::BS_Whitesmiths) {
Line->Level++;
++Line->Level;
}
}
parseStructuralElement();
@ -2608,7 +2608,7 @@ void UnwrappedLineParser::parseRequires() {
if (FormatTok->Previous && FormatTok->Previous->is(tok::greater)) {
addUnwrappedLine();
if (Style.IndentRequires) {
Line->Level++;
++Line->Level;
}
}
nextToken();

View File

@ -310,7 +310,7 @@ AlignTokenSequence(const FormatStyle &Style, unsigned Start, unsigned End,
unsigned PreviousNonComment = i - 1;
while (PreviousNonComment > Start &&
Changes[PreviousNonComment].Tok->is(tok::comment))
PreviousNonComment--;
--PreviousNonComment;
if (i != Start && Changes[i].indentAndNestingLevel() >
Changes[PreviousNonComment].indentAndNestingLevel())
ScopeStack.push_back(i);
@ -1173,7 +1173,7 @@ WhitespaceManager::CellDescriptions WhitespaceManager::getCells(unsigned Start,
NextNonComment = NextNonComment->getNextNonComment();
auto j = i;
while (Changes[j].Tok != NextNonComment && j < End)
j++;
++j;
if (j < End && Changes[j].NewlinesBefore == 0 &&
Changes[j].Tok->isNot(tok::r_brace)) {
Changes[j].NewlinesBefore = 1;