diff options
author | Alex Langford <alangford@apple.com> | 2023-11-09 13:35:35 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-09 13:35:35 -0800 |
commit | 1486264d5fad0ef7d76a44f6358390cf41218c7e (patch) | |
tree | a088128f26cbdec2fcb66399f65a058423d09726 /lldb/source/Commands/CommandObjectBreakpoint.cpp | |
parent | fe98cce6a91c7240a541b213d43d1132c684fd9c (diff) | |
download | llvm-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.cpp | 6 |
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); } } } |