diff --git a/clang-tools-extra/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp b/clang-tools-extra/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp index 245c03fe8e9c..dbda14c97e5f 100644 --- a/clang-tools-extra/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp +++ b/clang-tools-extra/clang-tidy/bugprone/MacroRepeatedSideEffectsCheck.cpp @@ -49,13 +49,11 @@ void MacroRepeatedPPCallbacks::MacroExpands(const Token &MacroNameTok, // Bail out if the contents of the macro are containing keywords that are // making the macro too complex. - if (std::find_if( - MI->tokens().begin(), MI->tokens().end(), [](const Token &T) { - return T.isOneOf(tok::kw_if, tok::kw_else, tok::kw_switch, - tok::kw_case, tok::kw_break, tok::kw_while, - tok::kw_do, tok::kw_for, tok::kw_continue, - tok::kw_goto, tok::kw_return); - }) != MI->tokens().end()) + if (llvm::any_of(MI->tokens(), [](const Token &T) { + return T.isOneOf(tok::kw_if, tok::kw_else, tok::kw_switch, tok::kw_case, + tok::kw_break, tok::kw_while, tok::kw_do, tok::kw_for, + tok::kw_continue, tok::kw_goto, tok::kw_return); + })) return; for (unsigned ArgNo = 0U; ArgNo < MI->getNumParams(); ++ArgNo) { diff --git a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp index b5e5191876ca..67d8ccbd6cad 100644 --- a/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp +++ b/clang-tools-extra/clang-tidy/tool/ClangTidyMain.cpp @@ -604,9 +604,9 @@ int clangTidyMain(int argc, const char **argv) { std::vector Errors = runClangTidy(Context, OptionsParser->getCompilations(), PathList, BaseFS, FixNotes, EnableCheckProfile, ProfilePrefix); - bool FoundErrors = llvm::find_if(Errors, [](const ClangTidyError &E) { - return E.DiagLevel == ClangTidyError::Error; - }) != Errors.end(); + bool FoundErrors = llvm::any_of(Errors, [](const ClangTidyError &E) { + return E.DiagLevel == ClangTidyError::Error; + }); // --fix-errors and --fix-notes imply --fix. FixBehaviour Behaviour = FixNotes ? FB_FixNotes diff --git a/clang-tools-extra/clangd/index/Merge.cpp b/clang-tools-extra/clangd/index/Merge.cpp index 997bbfb6672a..0d15dfcb1f25 100644 --- a/clang-tools-extra/clangd/index/Merge.cpp +++ b/clang-tools-extra/clangd/index/Merge.cpp @@ -196,10 +196,9 @@ static bool prefer(const SymbolLocation &L, const SymbolLocation &R) { return true; auto HasCodeGenSuffix = [](const SymbolLocation &Loc) { constexpr static const char *CodegenSuffixes[] = {".proto"}; - return std::any_of(std::begin(CodegenSuffixes), std::end(CodegenSuffixes), - [&](llvm::StringRef Suffix) { - return llvm::StringRef(Loc.FileURI).endswith(Suffix); - }); + return llvm::any_of(CodegenSuffixes, [&](llvm::StringRef Suffix) { + return llvm::StringRef(Loc.FileURI).endswith(Suffix); + }); }; return HasCodeGenSuffix(L) && !HasCodeGenSuffix(R); } diff --git a/clang/lib/Lex/ModuleMap.cpp b/clang/lib/Lex/ModuleMap.cpp index 57e344622f25..47d6f5893e97 100644 --- a/clang/lib/Lex/ModuleMap.cpp +++ b/clang/lib/Lex/ModuleMap.cpp @@ -456,10 +456,8 @@ static bool violatesPrivateInclude(Module *RequestingModule, &Header.getModule()->Headers[Module::HK_Private], &Header.getModule()->Headers[Module::HK_PrivateTextual]}; for (auto *Hs : HeaderList) - IsPrivate |= - std::find_if(Hs->begin(), Hs->end(), [&](const Module::Header &H) { - return H.Entry == IncFileEnt; - }) != Hs->end(); + IsPrivate |= llvm::any_of( + *Hs, [&](const Module::Header &H) { return H.Entry == IncFileEnt; }); assert(IsPrivate && "inconsistent headers and roles"); } #endif diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 0b4c450f76e0..cd5cdbde7f3f 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -15400,7 +15400,7 @@ ExprResult Sema::BuildBinOp(Scope *S, SourceLocation OpLoc, pty->getKind() == BuiltinType::Overload)) { auto *OE = dyn_cast(LHSExpr); if (OE && !OE->hasTemplateKeyword() && !OE->hasExplicitTemplateArgs() && - std::any_of(OE->decls_begin(), OE->decls_end(), [](NamedDecl *ND) { + llvm::any_of(OE->decls(), [](NamedDecl *ND) { return isa(ND); })) { Diag(OE->getQualifier() ? OE->getQualifierLoc().getBeginLoc() diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 67cf8f0371c5..171f005816b5 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -2520,7 +2520,7 @@ void Sema::DeclareImplicitDeductionGuides(TemplateDecl *Template, continue; // Cannot make a deduction guide when unparsed arguments are present. - if (std::any_of(CD->param_begin(), CD->param_end(), [](ParmVarDecl *P) { + if (llvm::any_of(CD->parameters(), [](ParmVarDecl *P) { return !P || P->hasUnparsedDefaultArg(); })) continue; diff --git a/lld/wasm/SyntheticSections.h b/lld/wasm/SyntheticSections.h index eac017883ef5..06579054b630 100644 --- a/lld/wasm/SyntheticSections.h +++ b/lld/wasm/SyntheticSections.h @@ -290,14 +290,12 @@ public: bool needsRelocations() { if (config->extendedConst) return false; - return llvm::find_if(internalGotSymbols, [=](Symbol *sym) { - return !sym->isTLS(); - }) != internalGotSymbols.end(); + return llvm::any_of(internalGotSymbols, + [=](Symbol *sym) { return !sym->isTLS(); }); } bool needsTLSRelocations() { - return llvm::find_if(internalGotSymbols, [=](Symbol *sym) { - return sym->isTLS(); - }) != internalGotSymbols.end(); + return llvm::any_of(internalGotSymbols, + [=](Symbol *sym) { return sym->isTLS(); }); } void generateRelocationCode(raw_ostream &os, bool TLS) const; diff --git a/llvm/include/llvm/Passes/StandardInstrumentations.h b/llvm/include/llvm/Passes/StandardInstrumentations.h index 32ecc9ec5fb0..30287cde5de7 100644 --- a/llvm/include/llvm/Passes/StandardInstrumentations.h +++ b/llvm/include/llvm/Passes/StandardInstrumentations.h @@ -133,9 +133,9 @@ public: } bool isPoisoned() const { - return BBGuards && - std::any_of(BBGuards->begin(), BBGuards->end(), - [](const auto &BB) { return BB.second.isPoisoned(); }); + return BBGuards && llvm::any_of(*BBGuards, [](const auto &BB) { + return BB.second.isPoisoned(); + }); } static void printDiff(raw_ostream &out, const CFG &Before, diff --git a/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp b/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp index 068bc1062df2..31d11c84c877 100644 --- a/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp +++ b/mlir/lib/Dialect/Affine/Analysis/AffineStructures.cpp @@ -321,9 +321,8 @@ unsigned FlatAffineValueConstraints::insertVar(VarKind kind, unsigned pos, } bool FlatAffineValueConstraints::hasValues() const { - return llvm::find_if(values, [](Optional var) { - return var.has_value(); - }) != values.end(); + return llvm::any_of( + values, [](const Optional &var) { return var.has_value(); }); } /// Checks if two constraint systems are in the same space, i.e., if they are diff --git a/polly/lib/Analysis/ScopBuilder.cpp b/polly/lib/Analysis/ScopBuilder.cpp index 9bfd8717449b..ab8e5adc2397 100644 --- a/polly/lib/Analysis/ScopBuilder.cpp +++ b/polly/lib/Analysis/ScopBuilder.cpp @@ -697,8 +697,7 @@ isl::set ScopBuilder::getPredecessorDomainConstraints(BasicBlock *BB, // If the predecessor is in a region we used for propagation we can skip it. auto PredBBInRegion = [PredBB](Region *PR) { return PR->contains(PredBB); }; - if (std::any_of(PropagatedRegions.begin(), PropagatedRegions.end(), - PredBBInRegion)) { + if (llvm::any_of(PropagatedRegions, PredBBInRegion)) { continue; }