From 8af160b0b8ca8102b9490a287244af75727872f5 Mon Sep 17 00:00:00 2001 From: Raphael Isemann Date: Thu, 13 Aug 2020 13:44:25 +0200 Subject: [PATCH] [lldb][NFC] Use llvm::is_contained instead of std::find in a few places --- lldb/source/Breakpoint/Breakpoint.cpp | 5 +---- lldb/source/Commands/CommandObjectThread.cpp | 3 +-- lldb/source/Host/common/NativeProcessProtocol.cpp | 3 +-- lldb/source/Symbol/LineTable.cpp | 2 +- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/lldb/source/Breakpoint/Breakpoint.cpp b/lldb/source/Breakpoint/Breakpoint.cpp index 9ed9549a789e..06d08ecdb3eb 100644 --- a/lldb/source/Breakpoint/Breakpoint.cpp +++ b/lldb/source/Breakpoint/Breakpoint.cpp @@ -241,15 +241,12 @@ bool Breakpoint::SerializedBreakpointMatchesNames( return false; size_t num_names = names_array->GetSize(); - std::vector::iterator begin = names.begin(); - std::vector::iterator end = names.end(); for (size_t i = 0; i < num_names; i++) { llvm::StringRef name; if (names_array->GetItemAtIndexAsString(i, name)) { - if (std::find(begin, end, name) != end) { + if (llvm::is_contained(names, name)) return true; - } } } return false; diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index f0392264bff7..26e150f1ccc5 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -1982,8 +1982,7 @@ public: protected: bool HandleOneThread(lldb::tid_t tid, CommandReturnObject &result) override { // If we have already handled this from a -t option, skip it here. - if (std::find(m_options.m_tids.begin(), m_options.m_tids.end(), tid) != - m_options.m_tids.end()) + if (llvm::is_contained(m_options.m_tids, tid)) return true; Process *process = m_exe_ctx.GetProcessPtr(); diff --git a/lldb/source/Host/common/NativeProcessProtocol.cpp b/lldb/source/Host/common/NativeProcessProtocol.cpp index a4d0b4181d58..493e14cb904b 100644 --- a/lldb/source/Host/common/NativeProcessProtocol.cpp +++ b/lldb/source/Host/common/NativeProcessProtocol.cpp @@ -298,8 +298,7 @@ Status NativeProcessProtocol::RemoveHardwareBreakpoint(lldb::addr_t addr) { bool NativeProcessProtocol::RegisterNativeDelegate( NativeDelegate &native_delegate) { std::lock_guard guard(m_delegates_mutex); - if (std::find(m_delegates.begin(), m_delegates.end(), &native_delegate) != - m_delegates.end()) + if (llvm::is_contained(m_delegates, &native_delegate)) return false; m_delegates.push_back(&native_delegate); diff --git a/lldb/source/Symbol/LineTable.cpp b/lldb/source/Symbol/LineTable.cpp index 19c39bd0aeb5..1d4a405ad47d 100644 --- a/lldb/source/Symbol/LineTable.cpp +++ b/lldb/source/Symbol/LineTable.cpp @@ -315,7 +315,7 @@ uint32_t LineTable::FindLineEntryIndexByFileIndex( if (m_entries[idx].is_terminal_entry) continue; - if (llvm::find(file_indexes, m_entries[idx].file_idx) == file_indexes.end()) + if (!llvm::is_contained(file_indexes, m_entries[idx].file_idx)) continue; // Exact match always wins. Otherwise try to find the closest line > the