Skip to content

Commit 07d6fbf

Browse files
authored
[lldb][NFCI] Remove BreakpointIDList::InsertStringArray (#77161)
This abstraction is leaky and BreakpointIDList does not need to know about CommandReturnObject. Additionally, setting the CommandReturnObject inout param to a success state does very little. The function returns immediately if the input ArrayRef is empty, and reading CommandObjectMultiwordBreakpoint::VerifyIDs more closely, the input is always empty if the previous call to BreakpointIDList::FindAndReplaceIDRanges failed. If the call was successful, then the CommandReturnObject is already in a success state. I have opted to remove the function altogether and inline the functionality where it was used.
1 parent eb42868 commit 07d6fbf

File tree

3 files changed

+3
-17
lines changed

3 files changed

+3
-17
lines changed

lldb/include/lldb/Breakpoint/BreakpointIDList.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ class BreakpointIDList {
4848

4949
bool FindBreakpointID(const char *bp_id, size_t *position) const;
5050

51-
void InsertStringArray(llvm::ArrayRef<const char *> string_array,
52-
CommandReturnObject &result);
53-
5451
// Returns a pair consisting of the beginning and end of a breakpoint
5552
// ID range expression. If the input string is not a valid specification,
5653
// returns an empty pair.

lldb/source/Breakpoint/BreakpointIDList.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,19 +82,6 @@ bool BreakpointIDList::FindBreakpointID(const char *bp_id_str,
8282
return FindBreakpointID(*bp_id, position);
8383
}
8484

85-
void BreakpointIDList::InsertStringArray(
86-
llvm::ArrayRef<const char *> string_array, CommandReturnObject &result) {
87-
if(string_array.empty())
88-
return;
89-
90-
for (const char *str : string_array) {
91-
auto bp_id = BreakpointID::ParseCanonicalReference(str);
92-
if (bp_id)
93-
m_breakpoint_ids.push_back(*bp_id);
94-
}
95-
result.SetStatus(eReturnStatusSuccessFinishNoResult);
96-
}
97-
9885
// This function takes OLD_ARGS, which is usually the result of breaking the
9986
// command string arguments into
10087
// an array of space-separated strings, and searches through the arguments for

lldb/source/Commands/CommandObjectBreakpoint.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2494,7 +2494,9 @@ void CommandObjectMultiwordBreakpoint::VerifyIDs(
24942494
// NOW, convert the list of breakpoint id strings in TEMP_ARGS into an actual
24952495
// BreakpointIDList:
24962496

2497-
valid_ids->InsertStringArray(temp_args.GetArgumentArrayRef(), result);
2497+
for (llvm::StringRef temp_arg : temp_args.GetArgumentArrayRef())
2498+
if (auto bp_id = BreakpointID::ParseCanonicalReference(temp_arg))
2499+
valid_ids->AddBreakpointID(*bp_id);
24982500

24992501
// At this point, all of the breakpoint ids that the user passed in have
25002502
// been converted to breakpoint IDs and put into valid_ids.

0 commit comments

Comments
 (0)