[Lldb-commits] [lldb] [lldb] [mostly NFC] Large WP foundation: WatchpointResources (PR #68845)
David Spickett via lldb-commits
lldb-commits at lists.llvm.org
Tue Oct 17 03:00:22 PDT 2023
================
@@ -0,0 +1,61 @@
+//===-- WatchpointResourceList.cpp ----------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Target/WatchpointResourceList.h"
+#include "lldb/Target/WatchpointResource.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+WatchpointResourceList::WatchpointResourceList() : m_resources(), m_mutex() {}
+
+WatchpointResourceList::~WatchpointResourceList() { Clear(); }
+
+uint32_t WatchpointResourceList::GetSize() {
+ std::lock_guard<std::mutex> guard(m_mutex);
+ return m_resources.size();
+}
+
+lldb::WatchpointResourceSP
+WatchpointResourceList::GetResourceAtIndex(uint32_t idx) {
+ std::lock_guard<std::mutex> guard(m_mutex);
+ if (idx < m_resources.size()) {
+ return m_resources[idx];
+ } else {
+ return {};
----------------
DavidSpickett wrote:
Also return in an else (as in, no need for the else)
https://github.com/llvm/llvm-project/pull/68845
More information about the lldb-commits
mailing list