[Lldb-commits] [lldb] [lldb] Upgrade `GetIndexOfChildWithName` to use `llvm::Expected` (PR #136693)
Michael Buch via lldb-commits
lldb-commits at lists.llvm.org
Tue Apr 22 08:09:37 PDT 2025
================
@@ -456,7 +460,7 @@ ExtractLibcxxStringInfo(ValueObject &valobj) {
if (!l)
return {};
- StringLayout layout = l->GetIndexOfChildWithName("__data_") == 0
+ StringLayout layout = l->GetIndexOfChildWithName("__data_").get() == 0
----------------
Michael137 wrote:
This would compare the underlying pointer value to `0`, aka it's now a nullptr check, which is not what we want. (I'd expect some test-failures...hopefully)
We should do something like this instead:
```
auto index_or_err = l->GetIndexOfChildWithName("__data_");
if (!index_or_err)
return index_or_err.takeError();
StringLayout layout = *index_or_err == 0 ? StringLayout::DSC : StringLayout::CSD;
```
https://github.com/llvm/llvm-project/pull/136693
More information about the lldb-commits
mailing list