Skip to content

[Format] Use llvm::count_if (NFC) #141518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented May 26, 2025

@llvm/pr-subscribers-clang-format

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/141518.diff

1 Files Affected:

  • (modified) clang/lib/Format/MacroCallReconstructor.cpp (+2-3)
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

@kazutakahirata kazutakahirata merged commit 23c2f88 into llvm:main May 27, 2025
13 checks passed
sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Jun 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants