================ @@ -53,44 +49,52 @@ bool WatchpointResource::Contains(addr_t addr) { void WatchpointResource::AddOwner(const WatchpointSP &wp_sp) { std::lock_guard<std::recursive_mutex> guard(m_owners_mutex); - m_owners.Add(wp_sp); + m_owners.push_back(wp_sp); } void WatchpointResource::RemoveOwner(WatchpointSP &wp_sp) { std::lock_guard<std::recursive_mutex> guard(m_owners_mutex); - m_owners.Remove(wp_sp); + const auto &it = std::find(m_owners.begin(), m_owners.end(), wp_sp); + if (it != m_owners.end()) + m_owners.erase(it); } size_t WatchpointResource::GetNumberOfOwners() { std::lock_guard<std::recursive_mutex> guard(m_owners_mutex); - return m_owners.GetSize(); + return m_owners.size(); } bool WatchpointResource::OwnersContains(WatchpointSP &wp_sp) { std::lock_guard<std::recursive_mutex> guard(m_owners_mutex); - return m_owners.Contains(wp_sp); + const auto &it = std::find(m_owners.begin(), m_owners.end(), wp_sp); + if (it != m_owners.end()) + return true; + return false; } bool WatchpointResource::OwnersContains(const Watchpoint *wp) { std::lock_guard<std::recursive_mutex> guard(m_owners_mutex); - return m_owners.Contains(wp); + for (WatchpointCollection::const_iterator it = m_owners.begin(); + it != m_owners.end(); ++it) + if ((*it).get() == wp) + return true; + return false; } WatchpointSP WatchpointResource::GetOwnerAtIndex(size_t idx) { std::lock_guard<std::recursive_mutex> guard(m_owners_mutex); - assert(idx < m_owners.GetSize()); - if (idx >= m_owners.GetSize()) + lldbassert(idx < m_owners.size()); + if (idx >= m_owners.size()) return {}; - return m_owners.GetByIndex(idx); + return m_owners[idx]; ---------------- bulbazord wrote:
Looking over this again, is there a use case where you would want to reference a specific owner by index instead of using `Owners()`? https://github.com/llvm/llvm-project/pull/68845 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits