[clang] 0d7f66d - [Sema] Use llvm::is_contained instead of llvm::all_of (NFC) (#158213)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 12 07:52:00 PDT 2025
Author: Kazu Hirata
Date: 2025-09-12T07:51:56-07:00
New Revision: 0d7f66d49cd80c5c688433427c74ae9b32e818f7
URL: https://github.com/llvm/llvm-project/commit/0d7f66d49cd80c5c688433427c74ae9b32e818f7
DIFF: https://github.com/llvm/llvm-project/commit/0d7f66d49cd80c5c688433427c74ae9b32e818f7.diff
LOG: [Sema] Use llvm::is_contained instead of llvm::all_of (NFC) (#158213)
The code in question uses llvm::all_of and llvm::identity to see if
every pointer is nonnull:
Ptr1 && Ptr2 && Ptr3 && ...
This patch simplifies the expression by checking for the absence of
nullptr with !llvm::is_contained.
Added:
Modified:
clang/lib/Sema/HeuristicResolver.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/HeuristicResolver.cpp b/clang/lib/Sema/HeuristicResolver.cpp
index 6d79f3feeaace..29840a430292e 100644
--- a/clang/lib/Sema/HeuristicResolver.cpp
+++ b/clang/lib/Sema/HeuristicResolver.cpp
@@ -13,7 +13,6 @@
#include "clang/AST/ExprCXX.h"
#include "clang/AST/TemplateBase.h"
#include "clang/AST/Type.h"
-#include "llvm/ADT/identity.h"
namespace clang {
@@ -562,7 +561,7 @@ HeuristicResolverImpl::getFunctionProtoTypeLoc(const Expr *Fn) {
// In some edge cases the AST can contain a "trivial" FunctionProtoTypeLoc
// which has null parameters. Avoid these as they don't contain useful
// information.
- if (llvm::all_of(F.getParams(), llvm::identity<ParmVarDecl *>()))
+ if (!llvm::is_contained(F.getParams(), nullptr))
return F;
}
More information about the cfe-commits
mailing list