[clang] [StaticAnalyzer] Use llvm::count (NFC) (PR #141370)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Sat May 24 13:40:25 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/141370

None

>From 0d1f3e67da90cd8aaf153736d30db05bea224b0c Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 24 May 2025 08:54:32 -0700
Subject: [PATCH] [StaticAnalyzer] Use llvm::count (NFC)

---
 clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp b/clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp
index 434c1d1526a22..4cb6bd34fa36d 100644
--- a/clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp
+++ b/clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp
@@ -35,11 +35,7 @@ class ResultMap {
 
 public:
   ResultMap(std::initializer_list<std::pair<CallDescription, bool>> Data)
-      : Found(0),
-        Total(std::count_if(Data.begin(), Data.end(),
-                            [](const std::pair<CallDescription, bool> &Pair) {
-                              return Pair.second == true;
-                            })),
+      : Found(0), Total(llvm::count(llvm::make_second_range(Data), true)),
         Impl(std::move(Data)) {}
 
   const bool *lookup(const CallEvent &Call) {



More information about the cfe-commits mailing list