Use llvm::none_of (NFC)

This commit is contained in:
Kazu Hirata 2022-08-14 16:25:39 -07:00
parent 55f0a87ea4
commit f5a68feab3
10 changed files with 25 additions and 30 deletions
clang-tools-extra
clang-move
clangd/refactor
clang/lib/Frontend
lld/wasm
llvm
include/llvm
Analysis
ExecutionEngine/JITLink
Support
lib

View File

@ -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);

View File

@ -757,12 +757,12 @@ llvm::Expected<RenameResult> 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;

View File

@ -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.

View File

@ -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<std::string, std::string> seen) {
return seen.first == producer.first;
}))

View File

@ -390,10 +390,10 @@ void RegionBase<Tr>::transferChildrenTo(RegionT *To) {
template <class Tr>
void RegionBase<Tr>::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<RegionT> &R) {
return R.get() == SubRegion;
}) == children.end() &&
}) &&
"Subregion already exists!");
SubRegion->parent = static_cast<RegionT *>(this);

View File

@ -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<Section> &Sec) {
return Sec->getName() == Name;
}) == Sections.end() &&
}) &&
"Duplicate section name");
std::unique_ptr<Section> 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);

View File

@ -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;

View File

@ -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<Instruction>(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<GetElementPtrInst *> UGEPIs;

View File

@ -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

View File

@ -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<CalleeSavedInfo> &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<CalleeSavedInfo> &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();