[Lldb-commits] [lldb] 8af160b - [lldb][NFC] Use llvm::is_contained instead of std::find in a few places
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Thu Aug 13 05:11:54 PDT 2020
Author: Raphael Isemann
Date: 2020-08-13T14:11:28+02:00
New Revision: 8af160b0b8ca8102b9490a287244af75727872f5
URL: https://github.com/llvm/llvm-project/commit/8af160b0b8ca8102b9490a287244af75727872f5
DIFF: https://github.com/llvm/llvm-project/commit/8af160b0b8ca8102b9490a287244af75727872f5.diff
LOG: [lldb][NFC] Use llvm::is_contained instead of std::find in a few places
Added:
Modified:
lldb/source/Breakpoint/Breakpoint.cpp
lldb/source/Commands/CommandObjectThread.cpp
lldb/source/Host/common/NativeProcessProtocol.cpp
lldb/source/Symbol/LineTable.cpp
Removed:
################################################################################
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<std::string>::iterator begin = names.begin();
- std::vector<std::string>::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 @@ class CommandObjectThreadPlanList : public CommandObjectIterateOverThreads {
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<std::recursive_mutex> 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
More information about the lldb-commits
mailing list