[clang] [Format] Use llvm::count_if (NFC) (PR #141518)
Kazu Hirata via cfe-commits
cfe-commits at lists.llvm.org
Mon May 26 13:02:00 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/141518
None
>From 363881869140e8ce4874a91b9b46d64a9647a7a1 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Mon, 26 May 2025 09:43:03 -0700
Subject: [PATCH] [Format] Use llvm::count_if (NFC)
---
clang/lib/Format/MacroCallReconstructor.cpp | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/clang/lib/Format/MacroCallReconstructor.cpp b/clang/lib/Format/MacroCallReconstructor.cpp
index c9b618c6cb5b0..116bbad320e1f 100644
--- a/clang/lib/Format/MacroCallReconstructor.cpp
+++ b/clang/lib/Format/MacroCallReconstructor.cpp
@@ -511,9 +511,8 @@ MacroCallReconstructor::createUnwrappedLine(const ReconstructedLine &Line,
for (const auto &N : Line.Tokens) {
Result.Tokens.push_back(N->Tok);
UnwrappedLineNode &Current = Result.Tokens.back();
- auto NumChildren =
- std::count_if(N->Children.begin(), N->Children.end(),
- [](const auto &Child) { return !Child->Tokens.empty(); });
+ auto NumChildren = llvm::count_if(
+ N->Children, [](const auto &Child) { return !Child->Tokens.empty(); });
if (NumChildren == 1 && Current.Tok->isOneOf(tok::l_paren, tok::comma)) {
// If we only have one child, and the child is due to a macro expansion
// (either attached to a left parenthesis or comma), merge the child into
More information about the cfe-commits
mailing list