forked from OSchip/llvm-project
Use llvm::count_if (NFC)
This commit is contained in:
parent
bc96b36a41
commit
3850edd9e0
|
@ -87,9 +87,7 @@ static bool isMaxValAllBitSetLiteral(const EnumDecl *EnumDec) {
|
|||
}
|
||||
|
||||
static int countNonPowOfTwoLiteralNum(const EnumDecl *EnumDec) {
|
||||
return std::count_if(
|
||||
EnumDec->enumerator_begin(), EnumDec->enumerator_end(),
|
||||
[](const EnumConstantDecl *E) { return isNonPowerOf2NorNullLiteral(E); });
|
||||
return llvm::count_if(EnumDec->enumerators(), isNonPowerOf2NorNullLiteral);
|
||||
}
|
||||
|
||||
/// Check if there is one or two enumerators that are not a power of 2 and are
|
||||
|
|
|
@ -2726,8 +2726,8 @@ static void emitAttributes(RecordKeeper &Records, raw_ostream &OS,
|
|||
|
||||
// Emit constructors that takes no arguments if none already exists.
|
||||
// This is used for delaying arguments.
|
||||
bool HasRequiredArgs = std::count_if(
|
||||
Args.begin(), Args.end(), [=](const std::unique_ptr<Argument> &arg) {
|
||||
bool HasRequiredArgs =
|
||||
llvm::count_if(Args, [=](const std::unique_ptr<Argument> &arg) {
|
||||
return !arg->isFake() && !arg->isOptional();
|
||||
});
|
||||
if (DelayedArgs && HasRequiredArgs)
|
||||
|
|
|
@ -1297,7 +1297,7 @@ int DistinguishUtils::FindLastToDistinguishByName(
|
|||
// passed-object, and that x is TKR compatible with
|
||||
int DistinguishUtils::CountCompatibleWith(
|
||||
const DummyArgument &x, const DummyArguments &args) const {
|
||||
return std::count_if(args.begin(), args.end(), [&](const DummyArgument &y) {
|
||||
return llvm::count_if(args, [&](const DummyArgument &y) {
|
||||
return !y.pass && !y.IsOptional() && IsTkrCompatible(x, y);
|
||||
});
|
||||
}
|
||||
|
@ -1306,7 +1306,7 @@ int DistinguishUtils::CountCompatibleWith(
|
|||
// distinguishable from x and not passed-object.
|
||||
int DistinguishUtils::CountNotDistinguishableFrom(
|
||||
const DummyArgument &x, const DummyArguments &args) const {
|
||||
return std::count_if(args.begin(), args.end(), [&](const DummyArgument &y) {
|
||||
return llvm::count_if(args, [&](const DummyArgument &y) {
|
||||
return !y.pass && std::holds_alternative<DummyDataObject>(y.u) &&
|
||||
!Distinguishable(y, x);
|
||||
});
|
||||
|
|
|
@ -1509,21 +1509,20 @@ bool IsEventTypeOrLockType(const DerivedTypeSpec *derivedTypeSpec) {
|
|||
}
|
||||
|
||||
int CountLenParameters(const DerivedTypeSpec &type) {
|
||||
return std::count_if(type.parameters().begin(), type.parameters().end(),
|
||||
[](const auto &pair) { return pair.second.isLen(); });
|
||||
return llvm::count_if(
|
||||
type.parameters(), [](const auto &pair) { return pair.second.isLen(); });
|
||||
}
|
||||
|
||||
int CountNonConstantLenParameters(const DerivedTypeSpec &type) {
|
||||
return std::count_if(
|
||||
type.parameters().begin(), type.parameters().end(), [](const auto &pair) {
|
||||
if (!pair.second.isLen()) {
|
||||
return false;
|
||||
} else if (const auto &expr{pair.second.GetExplicit()}) {
|
||||
return !IsConstantExpr(*expr);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return llvm::count_if(type.parameters(), [](const auto &pair) {
|
||||
if (!pair.second.isLen()) {
|
||||
return false;
|
||||
} else if (const auto &expr{pair.second.GetExplicit()}) {
|
||||
return !IsConstantExpr(*expr);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Are the type parameters of type1 compile-time compatible with the
|
||||
|
|
|
@ -98,14 +98,13 @@ void CodeSection::writeRelocations(raw_ostream &os) const {
|
|||
|
||||
void DataSection::finalizeContents() {
|
||||
raw_string_ostream os(dataSectionHeader);
|
||||
unsigned segmentCount = std::count_if(
|
||||
segments.begin(), segments.end(),
|
||||
[](OutputSegment *segment) { return segment->requiredInBinary(); });
|
||||
unsigned segmentCount = llvm::count_if(segments, [](OutputSegment *segment) {
|
||||
return segment->requiredInBinary();
|
||||
});
|
||||
#ifndef NDEBUG
|
||||
unsigned activeCount = std::count_if(
|
||||
segments.begin(), segments.end(), [](OutputSegment *segment) {
|
||||
return (segment->initFlags & WASM_DATA_SEGMENT_IS_PASSIVE) == 0;
|
||||
});
|
||||
unsigned activeCount = llvm::count_if(segments, [](OutputSegment *segment) {
|
||||
return (segment->initFlags & WASM_DATA_SEGMENT_IS_PASSIVE) == 0;
|
||||
});
|
||||
#endif
|
||||
|
||||
assert((config->sharedMemory || !config->isPic || config->extendedConst ||
|
||||
|
|
|
@ -597,10 +597,9 @@ void ElemSection::writeBody() {
|
|||
|
||||
DataCountSection::DataCountSection(ArrayRef<OutputSegment *> segments)
|
||||
: SyntheticSection(llvm::wasm::WASM_SEC_DATACOUNT),
|
||||
numSegments(std::count_if(segments.begin(), segments.end(),
|
||||
[](OutputSegment *const segment) {
|
||||
return segment->requiredInBinary();
|
||||
})) {}
|
||||
numSegments(llvm::count_if(segments, [](OutputSegment *const segment) {
|
||||
return segment->requiredInBinary();
|
||||
})) {}
|
||||
|
||||
void DataCountSection::writeBody() {
|
||||
writeUleb128(bodyOutputStream, numSegments, "data count");
|
||||
|
|
|
@ -417,8 +417,8 @@ Optional<VFInfo> VFABI::tryDemangleForVFABI(StringRef MangledName,
|
|||
// this parser:
|
||||
// 1. Uniqueness.
|
||||
// 2. Must be the last in the parameter list.
|
||||
const auto NGlobalPreds = std::count_if(
|
||||
Parameters.begin(), Parameters.end(), [](const VFParameter PK) {
|
||||
const auto NGlobalPreds =
|
||||
llvm::count_if(Parameters, [](const VFParameter &PK) {
|
||||
return PK.ParamKind == VFParamKind::GlobalPredicate;
|
||||
});
|
||||
assert(NGlobalPreds < 2 && "Cannot have more than one global predicate.");
|
||||
|
|
Loading…
Reference in New Issue