aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Commands/CommandObjectBreakpoint.cpp
diff options
context:
space:
mode:
authorAlex Langford <alangford@apple.com>2023-11-09 13:35:35 -0800
committerGitHub <noreply@github.com>2023-11-09 13:35:35 -0800
commit1486264d5fad0ef7d76a44f6358390cf41218c7e (patch)
treea088128f26cbdec2fcb66399f65a058423d09726 /lldb/source/Commands/CommandObjectBreakpoint.cpp
parentfe98cce6a91c7240a541b213d43d1132c684fd9c (diff)
downloadllvm-1486264d5fad0ef7d76a44f6358390cf41218c7e.zip
llvm-1486264d5fad0ef7d76a44f6358390cf41218c7e.tar.gz
llvm-1486264d5fad0ef7d76a44f6358390cf41218c7e.tar.bz2
[lldb] Change interface of StructuredData::Array::GetItemAtIndexAsString (#71613)
This patch changes the interface of StructuredData::Array::GetItemAtIndexAsString to return a `std::optional<llvm::StringRef>` instead of taking an out parameter. More generally, this commit serves as proposal that we change all of the sibling APIs (`GetItemAtIndexAs`) to do the same thing. The reason this isn't one giant patch is because it is rather unwieldy changing just one of these, so if this is approved, I will do all of the other ones as individual follow-ups.
Diffstat (limited to 'lldb/source/Commands/CommandObjectBreakpoint.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectBreakpoint.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/lldb/source/Commands/CommandObjectBreakpoint.cpp b/lldb/source/Commands/CommandObjectBreakpoint.cpp
index e1d1c5e..6349259 100644
--- a/lldb/source/Commands/CommandObjectBreakpoint.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpoint.cpp
@@ -2235,9 +2235,9 @@ public:
size_t num_names = names_array->GetSize();
for (size_t i = 0; i < num_names; i++) {
- llvm::StringRef name;
- if (names_array->GetItemAtIndexAsString(i, name))
- request.TryCompleteCurrentArg(name);
+ if (std::optional<llvm::StringRef> maybe_name =
+ names_array->GetItemAtIndexAsString(i))
+ request.TryCompleteCurrentArg(*maybe_name);
}
}
}