Skip to content

Commit 51ad2f0

Browse files
committed
Added llvm::any_of.
1 parent 850299b commit 51ad2f0

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

clang/lib/Sema/SemaTypeTraits.cpp

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "clang/Sema/Overload.h"
2424
#include "clang/Sema/Sema.h"
2525
#include "clang/Sema/SemaHLSL.h"
26+
#include "llvm/ADT/STLExtras.h"
2627

2728
using namespace clang;
2829

@@ -2607,23 +2608,15 @@ static void DiagnoseNonAggregateReason(Sema &SemaRef, SourceLocation Loc,
26072608
<< diag::TraitNotSatisfiedReason::InheritedCtr;
26082609
}
26092610

2610-
bool HasInherited = false;
2611-
for (const Decl *Sub : D->decls()) {
2611+
bool HasInherited = llvm::any_of(D->decls(), [](auto const *Sub) {
2612+
bool Result = false;
26122613
if (auto *UD = dyn_cast<UsingDecl>(Sub)) {
2613-
for (auto I = UD->shadow_begin(), E = UD->shadow_end(); I != E; ++I) {
2614-
if (isa<ConstructorUsingShadowDecl>(*I)) {
2615-
HasInherited = true;
2616-
break;
2617-
}
2618-
}
2619-
if (HasInherited)
2620-
break;
2614+
Result = llvm::any_of(UD->shadows(), [](auto const &I) {
2615+
return isa<ConstructorUsingShadowDecl>(I);
2616+
});
26212617
}
2622-
if (isa<ConstructorUsingShadowDecl>(Sub)) {
2623-
HasInherited = true;
2624-
break;
2625-
}
2626-
}
2618+
return isa<ConstructorUsingShadowDecl>(Sub) || Result;
2619+
});
26272620

26282621
if (HasInherited) {
26292622
SemaRef.Diag(Loc, diag::note_unsatisfied_trait_reason)

0 commit comments

Comments
 (0)