https://github.com/snarang181 created https://github.com/llvm/llvm-project/pull/143275
None >From dc4e3c9afbef406ae1acbd572dfe9edd9d5efea3 Mon Sep 17 00:00:00 2001 From: Samarth Narang <snar...@umass.edu> Date: Sat, 7 Jun 2025 12:21:17 -0400 Subject: [PATCH] Replace loop with llvm:any_of --- clang/include/clang/AST/DeclContextInternals.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/clang/include/clang/AST/DeclContextInternals.h b/clang/include/clang/AST/DeclContextInternals.h index b17b7627ac90c..a1071f62d5fae 100644 --- a/clang/include/clang/AST/DeclContextInternals.h +++ b/clang/include/clang/AST/DeclContextInternals.h @@ -176,14 +176,10 @@ class StoredDeclsList { DeclListNode::Decls *Tail = erase_if([Decls](NamedDecl *ND) { if (ND->isFromASTFile()) return true; - // FIXME: Can we get rid of this loop completely? - for (NamedDecl *D : Decls) - // Only replace the local declaration if the external declaration has - // higher visibilities. - if (D->getModuleOwnershipKind() <= ND->getModuleOwnershipKind() && - D->declarationReplaces(ND, /*IsKnownNewer=*/false)) - return true; - return false; + return llvm::any_of(Decls, [ND](NamedDecl *D) { + return D->getModuleOwnershipKind() <= ND->getModuleOwnershipKind() && + D->declarationReplaces(ND, /*IsKnownNewer=*/false); + }); }); // Don't have any pending external decls any more. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits