[Lldb-commits] [lldb] [lldb][NFCI] Change return type of BreakpointIDList::GetBreakpointIDAtIndex (PR #77166)

Chelsea Cassanova via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 5 17:46:05 PST 2024


================
@@ -20,17 +20,15 @@ using namespace lldb_private;
 
 // class BreakpointIDList
 
-BreakpointIDList::BreakpointIDList()
-    : m_invalid_id(LLDB_INVALID_BREAK_ID, LLDB_INVALID_BREAK_ID) {}
+BreakpointIDList::BreakpointIDList() : m_breakpoint_ids() {}
 
 BreakpointIDList::~BreakpointIDList() = default;
 
 size_t BreakpointIDList::GetSize() const { return m_breakpoint_ids.size(); }
 
-const BreakpointID &
-BreakpointIDList::GetBreakpointIDAtIndex(size_t index) const {
+BreakpointID BreakpointIDList::GetBreakpointIDAtIndex(size_t index) const {
   return ((index < m_breakpoint_ids.size()) ? m_breakpoint_ids[index]
-                                            : m_invalid_id);
+                                            : BreakpointID());
----------------
chelcassanova wrote:

Small question here since I'm not yet familiar with the structure of breakpoint IDs lists. Is there a scenario in which the check that `index` is within the bounds of the list fails but `BreakpointID()` is valid? Would the `BreakpointID()` always be invalid when that check fails?

https://github.com/llvm/llvm-project/pull/77166


More information about the lldb-commits mailing list