// sorted-and-uniqued list of protocols and the type arguments
// canonicalized.
QualType canonical;
- bool typeArgsAreCanonical = std::all_of(effectiveTypeArgs.begin(),
- effectiveTypeArgs.end(),
- [&](QualType type) {
- return type.isCanonical();
- });
+ bool typeArgsAreCanonical = llvm::all_of(
+ effectiveTypeArgs, [&](QualType type) { return type.isCanonical(); });
bool protocolsSorted = areSortedAndUniqued(protocols);
if (!typeArgsAreCanonical || !protocolsSorted || !baseType.isCanonical()) {
// Determine the canonical type arguments.
assert(!Sizes.empty() && "Unable to determine NDS and WDS.");
// The LS of a function parameter / return value can only be a power
// of 2, starting from 8 bits, up to 128.
- assert(std::all_of(Sizes.begin(), Sizes.end(),
- [](unsigned Size) {
- return Size == 8 || Size == 16 || Size == 32 ||
- Size == 64 || Size == 128;
- }) &&
+ assert(llvm::all_of(Sizes,
+ [](unsigned Size) {
+ return Size == 8 || Size == 16 || Size == 32 ||
+ Size == 64 || Size == 128;
+ }) &&
"Invalid size");
return std::make_tuple(*std::min_element(std::begin(Sizes), std::end(Sizes)),
Address ThisPtr(&*AI, CGM.getClassPointerAlignment(MD->getParent()));
llvm::BasicBlock *EntryBB = &Fn->front();
llvm::BasicBlock::iterator ThisStore =
- std::find_if(EntryBB->begin(), EntryBB->end(), [&](llvm::Instruction &I) {
+ llvm::find_if(*EntryBB, [&](llvm::Instruction &I) {
return isa<llvm::StoreInst>(I) &&
I.getOperand(0) == ThisPtr.getPointer();
});
#endif
}
- const std::unique_ptr<VPtrInfo> *VFPtrI = std::find_if(
- VFPtrs.begin(), VFPtrs.end(), [&](const std::unique_ptr<VPtrInfo>& VPI) {
+ const std::unique_ptr<VPtrInfo> *VFPtrI =
+ llvm::find_if(VFPtrs, [&](const std::unique_ptr<VPtrInfo> &VPI) {
return VPI->FullOffsetInMDC == VPtrOffset;
});
if (VFPtrI == VFPtrs.end()) {
std::vector<std::string> ConfigFiles =
CLOptions->getAllArgValues(options::OPT_config);
if (ConfigFiles.size() > 1) {
- if (!std::all_of(ConfigFiles.begin(), ConfigFiles.end(),
- [ConfigFiles](const std::string &s) {
- return s == ConfigFiles[0];
- })) {
+ if (!llvm::all_of(ConfigFiles, [ConfigFiles](const std::string &s) {
+ return s == ConfigFiles[0];
+ })) {
Diag(diag::err_drv_duplicate_config);
return true;
}
}
GPUArch = GPUArchs[0];
if (GPUArchs.size() > 1) {
- bool AllSame = std::all_of(
- GPUArchs.begin(), GPUArchs.end(),
- [&](const StringRef &GPUArch) { return GPUArch == GPUArchs.front(); });
+ bool AllSame = llvm::all_of(GPUArchs, [&](const StringRef &GPUArch) {
+ return GPUArch == GPUArchs.front();
+ });
if (!AllSame)
return llvm::createStringError(
std::error_code(), "Multiple AMD GPUs found with different archs");
Multilibs.FilterOut([&](const Multilib &M) {
std::vector<std::string> RD = FilePaths(M);
- return std::all_of(RD.begin(), RD.end(), [&](std::string P) {
- return !getVFS().exists(P);
- });
+ return llvm::all_of(RD, [&](std::string P) { return !getVFS().exists(P); });
});
Multilib::flags_list Flags;
Lines[i] = Lines[i].ltrim(Blanks);
StringRef IndentPrefix = getLineCommentIndentPrefix(Lines[i], Style);
OriginalPrefix[i] = IndentPrefix;
- const unsigned SpacesInPrefix =
- std::count(IndentPrefix.begin(), IndentPrefix.end(), ' ');
+ const unsigned SpacesInPrefix = llvm::count(IndentPrefix, ' ');
// On the first line of the comment section we calculate how many spaces
// are to be added or removed, all lines after that just get only the
// If there are any stacked lexers, we're in a #include.
assert(IsFileLexer(IncludeMacroStack[0]) &&
"Top level include stack isn't our primary lexer?");
- return std::none_of(
- IncludeMacroStack.begin() + 1, IncludeMacroStack.end(),
+ return llvm::none_of(
+ llvm::drop_begin(IncludeMacroStack),
[&](const IncludeStackInfo &ISI) -> bool { return IsFileLexer(ISI); });
}
// might be because we've transformed some of them. Check for potential
// "out" parameters and err on the side of not warning.
unsigned MaybeOutParamCount =
- std::count_if(Params.begin(), Params.end(),
- [](const ParmVarDecl *Param) -> bool {
- QualType ParamTy = Param->getType();
- if (ParamTy->isReferenceType() || ParamTy->isPointerType())
- return !ParamTy->getPointeeType().isConstQualified();
- return false;
- });
+ llvm::count_if(Params, [](const ParmVarDecl *Param) -> bool {
+ QualType ParamTy = Param->getType();
+ if (ParamTy->isReferenceType() || ParamTy->isPointerType())
+ return !ParamTy->getPointeeType().isConstQualified();
+ return false;
+ });
ParamCountValid = SwiftParamCount + MaybeOutParamCount >= ParamCount;
}
DecompType.getQualifiers());
auto DiagnoseBadNumberOfBindings = [&]() -> bool {
- unsigned NumFields =
- std::count_if(RD->field_begin(), RD->field_end(),
- [](FieldDecl *FD) { return !FD->isUnnamedBitfield(); });
+ unsigned NumFields = llvm::count_if(
+ RD->fields(), [](FieldDecl *FD) { return !FD->isUnnamedBitfield(); });
assert(Bindings.size() != NumFields);
S.Diag(Src->getLocation(), diag::err_decomp_decl_wrong_number_bindings)
<< DecompType << (unsigned)Bindings.size() << NumFields << NumFields
// all language modes, and diagnose the empty lookup in ActOnCallExpr if we
// successfully form a call to an undeclared template-id.
bool AllFunctions =
- getLangOpts().CPlusPlus20 &&
- std::all_of(Found.begin(), Found.end(), [](NamedDecl *ND) {
+ getLangOpts().CPlusPlus20 && llvm::all_of(Found, [](NamedDecl *ND) {
return isa<FunctionDecl>(ND->getUnderlyingDecl());
});
if (AllFunctions || (Found.empty() && !IsDependent)) {
void ASTReader::PrintStats() {
std::fprintf(stderr, "*** AST File Statistics:\n");
- unsigned NumTypesLoaded
- = TypesLoaded.size() - std::count(TypesLoaded.begin(), TypesLoaded.end(),
- QualType());
- unsigned NumDeclsLoaded
- = DeclsLoaded.size() - std::count(DeclsLoaded.begin(), DeclsLoaded.end(),
- (Decl *)nullptr);
- unsigned NumIdentifiersLoaded
- = IdentifiersLoaded.size() - std::count(IdentifiersLoaded.begin(),
- IdentifiersLoaded.end(),
- (IdentifierInfo *)nullptr);
- unsigned NumMacrosLoaded
- = MacrosLoaded.size() - std::count(MacrosLoaded.begin(),
- MacrosLoaded.end(),
- (MacroInfo *)nullptr);
- unsigned NumSelectorsLoaded
- = SelectorsLoaded.size() - std::count(SelectorsLoaded.begin(),
- SelectorsLoaded.end(),
- Selector());
+ unsigned NumTypesLoaded =
+ TypesLoaded.size() - llvm::count(TypesLoaded, QualType());
+ unsigned NumDeclsLoaded =
+ DeclsLoaded.size() - llvm::count(DeclsLoaded, (Decl *)nullptr);
+ unsigned NumIdentifiersLoaded =
+ IdentifiersLoaded.size() -
+ llvm::count(IdentifiersLoaded, (IdentifierInfo *)nullptr);
+ unsigned NumMacrosLoaded =
+ MacrosLoaded.size() - llvm::count(MacrosLoaded, (MacroInfo *)nullptr);
+ unsigned NumSelectorsLoaded =
+ SelectorsLoaded.size() - llvm::count(SelectorsLoaded, Selector());
if (unsigned TotalNumSLocEntries = getTotalNumSLocs())
std::fprintf(stderr, " %u/%u source location entries read (%f%%)\n",
} // namespace
static CallExpr::arg_range dropDefaultArgs(CallExpr::arg_range Args) {
- auto FirstDefaultArg = std::find_if(Args.begin(), Args.end(), [](auto It) {
- return isa<CXXDefaultArgExpr>(It);
- });
+ auto FirstDefaultArg =
+ llvm::find_if(Args, [](auto It) { return isa<CXXDefaultArgExpr>(It); });
return llvm::make_range(Args.begin(), FirstDefaultArg);
}
// Handle -cc1 integrated tools, even if -cc1 was expanded from a response
// file.
- auto FirstArg = std::find_if(Args.begin() + 1, Args.end(),
- [](const char *A) { return A != nullptr; });
+ auto FirstArg = llvm::find_if(llvm::drop_begin(Args),
+ [](const char *A) { return A != nullptr; });
if (FirstArg != Args.end() && StringRef(*FirstArg).startswith("-cc1")) {
// If -cc1 came from a response file, remove the EOL sentinels.
if (MarkEOLs) {
auto Signature = B->getValueAsListOfDefs("Signature");
// Reuse signatures to avoid unnecessary duplicates.
auto it =
- std::find_if(SignaturesList.begin(), SignaturesList.end(),
- [&](const std::pair<std::vector<Record *>, unsigned> &a) {
- return a.first == Signature;
- });
+ llvm::find_if(SignaturesList,
+ [&](const std::pair<std::vector<Record *>, unsigned> &a) {
+ return a.first == Signature;
+ });
unsigned SignIndex;
if (it == SignaturesList.end()) {
VerifySignature(Signature, B);
continue;
unsigned ArgNum = 0;
- bool MatchingArgumentTypes =
- std::all_of(Types.begin(), Types.end(), [&](const auto &Type) {
- return Type == I.getParamType(ArgNum++);
- });
+ bool MatchingArgumentTypes = llvm::all_of(Types, [&](const auto &Type) {
+ return Type == I.getParamType(ArgNum++);
+ });
if (MatchingArgumentTypes)
GoodVec.push_back(&I);