Skip to content

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

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 llvmbot added the clang Clang issues not falling into any other category label May 24, 2025
@llvmbot
Copy link
Member

llvmbot commented May 24, 2025

@llvm/pr-subscribers-clang

Author: Kazu Hirata (kazutakahirata)

Changes

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

1 Files Affected:

  • (modified) clang/unittests/StaticAnalyzer/CallDescriptionTest.cpp (+1-5)
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) {

@kazutakahirata kazutakahirata merged commit 1cc9e6e into llvm:main May 24, 2025
13 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_20250524_llvm_count_clang branch May 24, 2025 21:45
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
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants