[clang] 359b4e6 - [clang-format] Use prefix increment and decrement. NFC.
Marek Kurdej via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 7 02:23:31 PST 2022
Author: Marek Kurdej
Date: 2022-01-07T11:19:53+01:00
New Revision: 359b4e6cdb7ae60c51e33ce71443843b71cb643d
URL: https://github.com/llvm/llvm-project/commit/359b4e6cdb7ae60c51e33ce71443843b71cb643d
DIFF: https://github.com/llvm/llvm-project/commit/359b4e6cdb7ae60c51e33ce71443843b71cb643d.diff
LOG: [clang-format] Use prefix increment and decrement. NFC.
Added:
Modified:
clang/lib/Format/DefinitionBlockSeparator.cpp
clang/lib/Format/Format.cpp
clang/lib/Format/NamespaceEndCommentsFixer.cpp
clang/lib/Format/SortJavaScriptImports.cpp
clang/lib/Format/TokenAnnotator.cpp
clang/lib/Format/UnwrappedLineParser.cpp
clang/lib/Format/WhitespaceManager.cpp
Removed:
################################################################################
diff --git a/clang/lib/Format/DefinitionBlockSeparator.cpp b/clang/lib/Format/DefinitionBlockSeparator.cpp
index ba51594f3f69..7748ad4a3bfe 100644
--- a/clang/lib/Format/DefinitionBlockSeparator.cpp
+++ b/clang/lib/Format/DefinitionBlockSeparator.cpp
@@ -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())
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index d1bc378766cd..ffb1b14b76b6 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -2214,7 +2214,7 @@ class Cleaner : public TokenAnalyzer {
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) {
diff --git a/clang/lib/Format/NamespaceEndCommentsFixer.cpp b/clang/lib/Format/NamespaceEndCommentsFixer.cpp
index 9c00d243f34a..951a98258051 100644
--- a/clang/lib/Format/NamespaceEndCommentsFixer.cpp
+++ b/clang/lib/Format/NamespaceEndCommentsFixer.cpp
@@ -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;
}
diff --git a/clang/lib/Format/SortJavaScriptImports.cpp b/clang/lib/Format/SortJavaScriptImports.cpp
index 77dc0d683e5f..52c222a8b3dc 100644
--- a/clang/lib/Format/SortJavaScriptImports.cpp
+++ b/clang/lib/Format/SortJavaScriptImports.cpp
@@ -260,13 +260,13 @@ class JavaScriptImportSorter : public TokenAnalyzer {
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);
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp
index 5241685630a5..22c56537bb9e 100644
--- a/clang/lib/Format/TokenAnnotator.cpp
+++ b/clang/lib/Format/TokenAnnotator.cpp
@@ -1564,9 +1564,9 @@ class AnnotatingParser {
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 @@ class AnnotatingParser {
break;
}
if (TemplateCloser->is(tok::less))
- NestingLevel++;
+ ++NestingLevel;
if (TemplateCloser->is(tok::greater))
- NestingLevel--;
+ --NestingLevel;
if (NestingLevel < 1)
break;
TemplateCloser = TemplateCloser->Next;
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index 5895c2efdef4..2bf5cedd2ae4 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/lib/Format/UnwrappedLineParser.cpp
@@ -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();
diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp
index 3f87e70fb90c..9f3f18aa3eb0 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -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;
More information about the cfe-commits
mailing list