[lldb][NFC] Use llvm::is_contained instead of std::find in a few places

This commit is contained in:
Raphael Isemann
2020-08-13 13:44:25 +02:00
parent a31d20e67e
commit 8af160b0b8
4 changed files with 4 additions and 9 deletions

View File

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

View File

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

View File

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

View File

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