From 978c754076e37c7b392240dd121b5b6cb8d1bde2 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Tue, 19 Jan 2021 20:19:15 -0800 Subject: [PATCH] [llvm] Use llvm::any_of (NFC) --- llvm/lib/Support/CommandLine.cpp | 2 +- llvm/tools/llvm-objcopy/ELF/Object.cpp | 4 ++-- llvm/utils/TableGen/AsmWriterEmitter.cpp | 11 +++++------ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index c8578f9..6d89481 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -1204,7 +1204,7 @@ bool cl::ExpandResponseFiles(StringSaver &Saver, TokenizerCallback Tokenizer, }; // Check for recursive response files. - if (std::any_of(FileStack.begin() + 1, FileStack.end(), IsEquivalent)) { + if (any_of(drop_begin(FileStack), IsEquivalent)) { // This file is recursive, so we leave it in the argument stream and // move on. AllExpanded = false; diff --git a/llvm/tools/llvm-objcopy/ELF/Object.cpp b/llvm/tools/llvm-objcopy/ELF/Object.cpp index 2f455d7..0ff82f9 100644 --- a/llvm/tools/llvm-objcopy/ELF/Object.cpp +++ b/llvm/tools/llvm-objcopy/ELF/Object.cpp @@ -2451,8 +2451,8 @@ template Error ELFWriter::finalize() { if (Obj.sections().size() >= SHN_LORESERVE) { SectionTableRef Sections = Obj.sections(); NeedsLargeIndexes = - std::any_of(Sections.begin() + SHN_LORESERVE, Sections.end(), - [](const SectionBase &Sec) { return Sec.HasSymbol; }); + any_of(drop_begin(Sections, SHN_LORESERVE), + [](const SectionBase &Sec) { return Sec.HasSymbol; }); // TODO: handle case where only one section needs the large index table but // only needs it because the large index table hasn't been removed yet. } diff --git a/llvm/utils/TableGen/AsmWriterEmitter.cpp b/llvm/utils/TableGen/AsmWriterEmitter.cpp index 3e27bd7..a09ea77 100644 --- a/llvm/utils/TableGen/AsmWriterEmitter.cpp +++ b/llvm/utils/TableGen/AsmWriterEmitter.cpp @@ -218,12 +218,11 @@ FindUniqueOperandCommands(std::vector &UniqueOperandCommands, // Otherwise, scan to see if all of the other instructions in this command // set share the operand. - if (std::any_of(Idxs.begin()+1, Idxs.end(), - [&](unsigned Idx) { - const AsmWriterInst &OtherInst = Instructions[Idx]; - return OtherInst.Operands.size() == Op || - OtherInst.Operands[Op] != FirstInst.Operands[Op]; - })) + if (any_of(drop_begin(Idxs), [&](unsigned Idx) { + const AsmWriterInst &OtherInst = Instructions[Idx]; + return OtherInst.Operands.size() == Op || + OtherInst.Operands[Op] != FirstInst.Operands[Op]; + })) break; // Okay, everything in this command set has the same next operand. Add it -- 2.7.4