diff --git a/clang/include/clang/AST/DeclContextInternals.h b/clang/include/clang/AST/DeclContextInternals.h index b17b7627ac90c..a0f37886cc014 100644 --- a/clang/include/clang/AST/DeclContextInternals.h +++ b/clang/include/clang/AST/DeclContextInternals.h @@ -177,13 +177,12 @@ class StoredDeclsList { if (ND->isFromASTFile()) return true; // FIXME: Can we get rid of this loop completely? - for (NamedDecl *D : Decls) + return llvm::any_of(Decls, [ND](NamedDecl *D) { // 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; + // higher visiblities. + return D->getModuleOwnershipKind() <= ND->getModuleOwnershipKind() && + D->declarationReplaces(ND, /*IsKnownNewer=*/false); + }); }); // Don't have any pending external decls any more.