aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Format/WhitespaceManager.cpp
diff options
context:
space:
mode:
authorOwen Pan <owenpiano@gmail.com>2025-07-06 14:19:30 -0700
committerGitHub <noreply@github.com>2025-07-06 14:19:30 -0700
commit5ccbea9f480d5c387c7f21aa101e72774c91f1d3 (patch)
tree165b015ba243551f9b126d22a5865f788e692abc /clang/lib/Format/WhitespaceManager.cpp
parent6a9a16da7a380e18b996bb6573eeb18b913204fc (diff)
downloadllvm-5ccbea9f480d5c387c7f21aa101e72774c91f1d3.zip
llvm-5ccbea9f480d5c387c7f21aa101e72774c91f1d3.tar.gz
llvm-5ccbea9f480d5c387c7f21aa101e72774c91f1d3.tar.bz2
[clang-format][NFC] Replace size() with empty() (#147164)
Diffstat (limited to 'clang/lib/Format/WhitespaceManager.cpp')
-rw-r--r--clang/lib/Format/WhitespaceManager.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/Format/WhitespaceManager.cpp b/clang/lib/Format/WhitespaceManager.cpp
index cfaadf0..cc3cc0f 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -314,7 +314,7 @@ AlignTokenSequence(const FormatStyle &Style, unsigned Start, unsigned End,
for (unsigned i = Start; i != End; ++i) {
auto &CurrentChange = Changes[i];
- if (ScopeStack.size() != 0 &&
+ if (!ScopeStack.empty() &&
CurrentChange.indentAndNestingLevel() <
Changes[ScopeStack.back()].indentAndNestingLevel()) {
ScopeStack.pop_back();
@@ -332,7 +332,7 @@ AlignTokenSequence(const FormatStyle &Style, unsigned Start, unsigned End,
ScopeStack.push_back(i);
}
- bool InsideNestedScope = ScopeStack.size() != 0;
+ bool InsideNestedScope = !ScopeStack.empty();
bool ContinuedStringLiteral = i > Start &&
CurrentChange.Tok->is(tok::string_literal) &&
Changes[i - 1].Tok->is(tok::string_literal);
@@ -1048,7 +1048,7 @@ void WhitespaceManager::alignChainedConditionals() {
return C.Tok->is(TT_ConditionalExpr) &&
((C.Tok->is(tok::question) && !C.NewlinesBefore) ||
(C.Tok->is(tok::colon) && C.Tok->Next &&
- (C.Tok->Next->FakeLParens.size() == 0 ||
+ (C.Tok->Next->FakeLParens.empty() ||
C.Tok->Next->FakeLParens.back() != prec::Conditional)));
},
Changes, /*StartAt=*/0);
@@ -1057,7 +1057,7 @@ void WhitespaceManager::alignChainedConditionals() {
FormatToken *Previous = C.Tok->getPreviousNonComment();
return C.NewlinesBefore && Previous && Previous->is(TT_ConditionalExpr) &&
(Previous->is(tok::colon) &&
- (C.Tok->FakeLParens.size() == 0 ||
+ (C.Tok->FakeLParens.empty() ||
C.Tok->FakeLParens.back() != prec::Conditional));
};
// Ensure we keep alignment of wrapped operands with non-wrapped operands