diff --git a/clang-tools-extra/clang-move/Move.cpp b/clang-tools-extra/clang-move/Move.cpp index 6419bd3372dc..9e44fe12ecdc 100644 --- a/clang-tools-extra/clang-move/Move.cpp +++ b/clang-tools-extra/clang-move/Move.cpp @@ -920,8 +920,7 @@ void ClangMoveTool::onEndOfTranslationUnit() { return false; } }; - if (std::none_of(UnremovedDeclsInOldHeader.begin(), - UnremovedDeclsInOldHeader.end(), IsSupportedKind) && + if (llvm::none_of(UnremovedDeclsInOldHeader, IsSupportedKind) && !Context->Spec.OldHeader.empty()) { auto &SM = RemovedDecls[0]->getASTContext().getSourceManager(); moveAll(SM, Context->Spec.OldHeader, Context->Spec.NewHeader); diff --git a/clang-tools-extra/clangd/refactor/Rename.cpp b/clang-tools-extra/clangd/refactor/Rename.cpp index 50b5481e4f89..af454f0a372b 100644 --- a/clang-tools-extra/clangd/refactor/Rename.cpp +++ b/clang-tools-extra/clangd/refactor/Rename.cpp @@ -757,12 +757,12 @@ llvm::Expected rename(const RenameInputs &RInputs) { return StartOffset.takeError(); if (!EndOffset) return EndOffset.takeError(); - if (llvm::find_if( + if (llvm::none_of( *MainFileRenameEdit, [&StartOffset, &EndOffset](const clang::tooling::Replacement &R) { return R.getOffset() == *StartOffset && R.getLength() == *EndOffset - *StartOffset; - }) == MainFileRenameEdit->end()) { + })) { return makeError(ReasonToReject::NoSymbolFound); } RenameResult Result; diff --git a/clang/lib/Frontend/TextDiagnostic.cpp b/clang/lib/Frontend/TextDiagnostic.cpp index ab0dbcef6534..a0e11fa7a7c9 100644 --- a/clang/lib/Frontend/TextDiagnostic.cpp +++ b/clang/lib/Frontend/TextDiagnostic.cpp @@ -332,8 +332,7 @@ static void selectInterestingSourceRegion(std::string &SourceLine, return; // No special characters are allowed in CaretLine. - assert(CaretLine.end() == - llvm::find_if(CaretLine, [](char c) { return c < ' ' || '~' < c; })); + assert(llvm::none_of(CaretLine, [](char c) { return c < ' ' || '~' < c; })); // Find the slice that we need to display the full caret line // correctly. diff --git a/lld/wasm/SyntheticSections.cpp b/lld/wasm/SyntheticSections.cpp index 1149e206b6b0..bce7c0b72278 100644 --- a/lld/wasm/SyntheticSections.cpp +++ b/lld/wasm/SyntheticSections.cpp @@ -844,8 +844,7 @@ void ProducersSection::addInfo(const WasmProducerInfo &info) { {std::make_pair(&info.Languages, &languages), std::make_pair(&info.Tools, &tools), std::make_pair(&info.SDKs, &sDKs)}) for (auto &producer : *producers.first) - if (producers.second->end() == - llvm::find_if(*producers.second, + if (llvm::none_of(*producers.second, [&](std::pair seen) { return seen.first == producer.first; })) diff --git a/llvm/include/llvm/Analysis/RegionInfoImpl.h b/llvm/include/llvm/Analysis/RegionInfoImpl.h index 561702db3790..9a18e72eebec 100644 --- a/llvm/include/llvm/Analysis/RegionInfoImpl.h +++ b/llvm/include/llvm/Analysis/RegionInfoImpl.h @@ -390,10 +390,10 @@ void RegionBase::transferChildrenTo(RegionT *To) { template void RegionBase::addSubRegion(RegionT *SubRegion, bool moveChildren) { assert(!SubRegion->parent && "SubRegion already has a parent!"); - assert(llvm::find_if(*this, + assert(llvm::none_of(*this, [&](const std::unique_ptr &R) { return R.get() == SubRegion; - }) == children.end() && + }) && "Subregion already exists!"); SubRegion->parent = static_cast(this); diff --git a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h index 00c60d05573c..60abdc5e2003 100644 --- a/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h +++ b/llvm/include/llvm/ExecutionEngine/JITLink/JITLink.h @@ -1004,10 +1004,10 @@ public: /// Create a section with the given name, protection flags, and alignment. Section &createSection(StringRef Name, MemProt Prot) { - assert(llvm::find_if(Sections, + assert(llvm::none_of(Sections, [&](std::unique_ptr
&Sec) { return Sec->getName() == Name; - }) == Sections.end() && + }) && "Duplicate section name"); std::unique_ptr
Sec(new Section(Name, Prot, Sections.size())); Sections.push_back(std::move(Sec)); @@ -1349,9 +1349,8 @@ public: assert(ExternalSymbols.count(&Sym) && "Symbol is not in the externals set"); ExternalSymbols.erase(&Sym); Addressable &Base = *Sym.Base; - assert(llvm::find_if(ExternalSymbols, - [&](Symbol *AS) { return AS->Base == &Base; }) == - ExternalSymbols.end() && + assert(llvm::none_of(ExternalSymbols, + [&](Symbol *AS) { return AS->Base == &Base; }) && "Base addressable still in use"); destroySymbol(Sym); destroyAddressable(Base); @@ -1365,9 +1364,8 @@ public: "Symbol is not in the absolute symbols set"); AbsoluteSymbols.erase(&Sym); Addressable &Base = *Sym.Base; - assert(llvm::find_if(ExternalSymbols, - [&](Symbol *AS) { return AS->Base == &Base; }) == - ExternalSymbols.end() && + assert(llvm::none_of(ExternalSymbols, + [&](Symbol *AS) { return AS->Base == &Base; }) && "Base addressable still in use"); destroySymbol(Sym); destroyAddressable(Base); diff --git a/llvm/include/llvm/Support/GenericDomTreeConstruction.h b/llvm/include/llvm/Support/GenericDomTreeConstruction.h index e504a0eddeba..f59151e027c5 100644 --- a/llvm/include/llvm/Support/GenericDomTreeConstruction.h +++ b/llvm/include/llvm/Support/GenericDomTreeConstruction.h @@ -712,7 +712,7 @@ struct SemiNCAInfo { assert(IsPostDom && "This function is only for postdominators"); // The tree has only trivial roots -- nothing to update. - if (std::none_of(DT.Roots.begin(), DT.Roots.end(), [BUI](const NodePtr N) { + if (llvm::none_of(DT.Roots, [BUI](const NodePtr N) { return HasForwardSuccessors(N, BUI); })) return; diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 0d899918604b..92fe929da535 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -7754,14 +7754,14 @@ static bool tryUnmergingGEPsAcrossIndirectBr(GetElementPtrInst *GEPI, return false; // Check that GEP is used outside the block, meaning it's alive on the // IndirectBr edge(s). - if (find_if(GEPI->users(), [&](User *Usr) { + if (llvm::none_of(GEPI->users(), [&](User *Usr) { if (auto *I = dyn_cast(Usr)) { if (I->getParent() != SrcBlock) { return true; } } return false; - }) == GEPI->users().end()) + })) return false; // The second elements of the GEP chains to be unmerged. std::vector UGEPIs; diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index a0a9b62d3c59..344d3007e85d 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -412,11 +412,11 @@ static MDNode *stripDebugLocFromLoopID(MDNode *N) { // MDNode. This loop also initializes DILocationReachable, later // needed by updateLoopMetadataDebugLocationsImpl; the use of // count_if avoids an early exit. - if (!std::count_if(N->op_begin() + 1, N->op_end(), - [&Visited, &DILocationReachable](const MDOperand &Op) { - return isDILocationReachable( - Visited, DILocationReachable, Op.get()); - })) + if (llvm::none_of(llvm::drop_begin(N->operands()), + [&Visited, &DILocationReachable](const MDOperand &Op) { + return isDILocationReachable(Visited, DILocationReachable, + Op.get()); + })) return N; // If there is only the debug location without any actual loop metadata, we diff --git a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp index cd60a595efa5..d83ba01db853 100644 --- a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp @@ -39,8 +39,8 @@ static void emitSCSPrologue(MachineFunction &MF, MachineBasicBlock &MBB, // Do not save RA to the SCS if it's not saved to the regular stack, // i.e. RA is not at risk of being overwritten. std::vector &CSI = MF.getFrameInfo().getCalleeSavedInfo(); - if (std::none_of(CSI.begin(), CSI.end(), - [&](CalleeSavedInfo &CSR) { return CSR.getReg() == RAReg; })) + if (llvm::none_of( + CSI, [&](CalleeSavedInfo &CSR) { return CSR.getReg() == RAReg; })) return; Register SCSPReg = RISCVABI::getSCSPReg(); @@ -89,8 +89,8 @@ static void emitSCSEpilogue(MachineFunction &MF, MachineBasicBlock &MBB, // See emitSCSPrologue() above. std::vector &CSI = MF.getFrameInfo().getCalleeSavedInfo(); - if (std::none_of(CSI.begin(), CSI.end(), - [&](CalleeSavedInfo &CSR) { return CSR.getReg() == RAReg; })) + if (llvm::none_of( + CSI, [&](CalleeSavedInfo &CSR) { return CSR.getReg() == RAReg; })) return; Register SCSPReg = RISCVABI::getSCSPReg();