Author: Kazu Hirata Date: 2022-07-20T09:09:19-07:00 New Revision: 360c1111e358c4c7e8591953ce9548d60c9410a6
URL: https://github.com/llvm/llvm-project/commit/360c1111e358c4c7e8591953ce9548d60c9410a6 DIFF: https://github.com/llvm/llvm-project/commit/360c1111e358c4c7e8591953ce9548d60c9410a6.diff LOG: Use llvm::is_contained (NFC) Added: Modified: lld/MachO/Driver.cpp lldb/source/API/SBBreakpoint.cpp lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp lldb/source/Target/TargetList.cpp llvm/lib/Support/CommandLine.cpp mlir/lib/Analysis/DataFlow/IntegerRangeAnalysis.cpp mlir/lib/IR/AffineExpr.cpp polly/include/polly/ScopInfo.h Removed: ################################################################################ diff --git a/lld/MachO/Driver.cpp b/lld/MachO/Driver.cpp index 63a0e7f3a8434..f5c4e82c5b4c3 100644 --- a/lld/MachO/Driver.cpp +++ b/lld/MachO/Driver.cpp @@ -503,8 +503,7 @@ static bool markReexport(StringRef searchName, ArrayRef<StringRef> extensions) { if (auto *dylibFile = dyn_cast<DylibFile>(file)) { StringRef filename = path::filename(dylibFile->getName()); if (filename.consume_front(searchName) && - (filename.empty() || - find(extensions, filename) != extensions.end())) { + (filename.empty() || llvm::is_contained(extensions, filename))) { dylibFile->reexport = true; return true; } diff --git a/lldb/source/API/SBBreakpoint.cpp b/lldb/source/API/SBBreakpoint.cpp index 5fe8f7fe05837..19b2a4376cf8a 100644 --- a/lldb/source/API/SBBreakpoint.cpp +++ b/lldb/source/API/SBBreakpoint.cpp @@ -835,8 +835,7 @@ class SBBreakpointListImpl { if (bkpt->GetTargetSP() != target_sp) return false; lldb::break_id_t bp_id = bkpt->GetID(); - if (find(m_break_ids.begin(), m_break_ids.end(), bp_id) == - m_break_ids.end()) + if (!llvm::is_contained(m_break_ids, bp_id)) return false; m_break_ids.push_back(bkpt->GetID()); diff --git a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp index 579ac6e36d0ba..4db7abe603d4c 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp @@ -396,15 +396,11 @@ bool RegisterInfoPOSIX_arm64::IsSVERegVG(unsigned reg) const { } bool RegisterInfoPOSIX_arm64::IsPAuthReg(unsigned reg) const { - return std::find(pauth_regnum_collection.begin(), - pauth_regnum_collection.end(), - reg) != pauth_regnum_collection.end(); + return llvm::is_contained(pauth_regnum_collection, reg); } bool RegisterInfoPOSIX_arm64::IsMTEReg(unsigned reg) const { - return std::find(m_mte_regnum_collection.begin(), - m_mte_regnum_collection.end(), - reg) != m_mte_regnum_collection.end(); + return llvm::is_contained(m_mte_regnum_collection, reg); } uint32_t RegisterInfoPOSIX_arm64::GetRegNumSVEZ0() const { return sve_z0; } diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp index 214e98ee91edb..829036976a219 100644 --- a/lldb/source/Target/TargetList.cpp +++ b/lldb/source/Target/TargetList.cpp @@ -509,8 +509,7 @@ uint32_t TargetList::GetIndexOfTarget(lldb::TargetSP target_sp) const { } void TargetList::AddTargetInternal(TargetSP target_sp, bool do_select) { - lldbassert(std::find(m_target_list.begin(), m_target_list.end(), target_sp) == - m_target_list.end() && + lldbassert(!llvm::is_contained(m_target_list, target_sp) && "target already exists it the list"); m_target_list.push_back(std::move(target_sp)); if (do_select) diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp index e3df172ef1133..5e7d631651300 100644 --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -2382,7 +2382,7 @@ class CategorizedHelpPrinter : public HelpPrinter { for (size_t I = 0, E = Opts.size(); I != E; ++I) { Option *Opt = Opts[I].second; for (auto &Cat : Opt->Categories) { - assert(find(SortedCategories, Cat) != SortedCategories.end() && + assert(llvm::is_contained(SortedCategories, Cat) && "Option has an unregistered category"); CategorizedOptions[Cat].push_back(Opt); } diff --git a/mlir/lib/Analysis/DataFlow/IntegerRangeAnalysis.cpp b/mlir/lib/Analysis/DataFlow/IntegerRangeAnalysis.cpp index d5e85519a09a0..0147da813dfb7 100644 --- a/mlir/lib/Analysis/DataFlow/IntegerRangeAnalysis.cpp +++ b/mlir/lib/Analysis/DataFlow/IntegerRangeAnalysis.cpp @@ -84,7 +84,7 @@ void IntegerRangeAnalysis::visitOperation( auto result = v.dyn_cast<OpResult>(); if (!result) return; - assert(llvm::find(op->getResults(), result) != op->result_end()); + assert(llvm::is_contained(op->getResults(), result)); LLVM_DEBUG(llvm::dbgs() << "Inferred range " << attrs << "\n"); IntegerValueRangeLattice *lattice = results[result.getResultNumber()]; @@ -126,8 +126,7 @@ void IntegerRangeAnalysis::visitNonControlFlowArguments( auto arg = v.dyn_cast<BlockArgument>(); if (!arg) return; - if (llvm::find(successor.getSuccessor()->getArguments(), arg) == - successor.getSuccessor()->args_end()) + if (!llvm::is_contained(successor.getSuccessor()->getArguments(), arg)) return; LLVM_DEBUG(llvm::dbgs() << "Inferred range " << attrs << "\n"); diff --git a/mlir/lib/IR/AffineExpr.cpp b/mlir/lib/IR/AffineExpr.cpp index 38d0e9b66dae1..4b553d8e3a9a5 100644 --- a/mlir/lib/IR/AffineExpr.cpp +++ b/mlir/lib/IR/AffineExpr.cpp @@ -974,7 +974,7 @@ static AffineExpr getSemiAffineExprFromFlatForm(ArrayRef<int64_t> flatExprs, // Adds entries to `indexToExprMap`, `coefficients` and `indices`. auto addEntry = [&](std::pair<unsigned, signed> index, int64_t coefficient, AffineExpr expr) { - assert(std::find(indices.begin(), indices.end(), index) == indices.end() && + assert(!llvm::is_contained(indices, index) && "Key is already present in indices vector and overwriting will " "happen in `indexToExprMap` and `coefficients`!"); diff --git a/polly/include/polly/ScopInfo.h b/polly/include/polly/ScopInfo.h index 404edc89fed88..b89d1be50a835 100644 --- a/polly/include/polly/ScopInfo.h +++ b/polly/include/polly/ScopInfo.h @@ -1359,8 +1359,7 @@ class ScopStmt final { if (!Inst) return false; if (isBlockStmt()) - return std::find(Instructions.begin(), Instructions.end(), Inst) != - Instructions.end(); + return llvm::is_contained(Instructions, Inst); return represents(Inst->getParent()); } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits