llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Samarth Narang (snarang181) <details> <summary>Changes</summary> This patch simplifies the declaration replacement logic in replaceExternalDecls by replacing a manual loop with an idiomatic use of llvm::any_of. This improves code readability and aligns with common LLVM coding style. --- Full diff: https://github.com/llvm/llvm-project/pull/143275.diff 1 Files Affected: - (modified) clang/include/clang/AST/DeclContextInternals.h (+4-8) ``````````diff 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. `````````` </details> https://github.com/llvm/llvm-project/pull/143275 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits