[Lldb-commits] [lldb] draft: [lldb] Upgrade ValueObject::GetData to return llvm::Expected (PR #130516)

Adrian Prantl via lldb-commits lldb-commits at lists.llvm.org
Mon Mar 17 14:23:56 PDT 2025


================
@@ -523,13 +522,11 @@ class EntityVariableBase : public Materializer::Entity {
           return;
         }
       } else {
-        DataExtractor data;
-        Status extract_error;
-        valobj_sp->GetData(data, extract_error);
-        if (!extract_error.Success()) {
+        auto data_or_err = valobj_sp->GetData();
+        if (auto error = data_or_err.takeError()) {
           err = Status::FromErrorStringWithFormat(
               "couldn't get the value of %s: %s", GetName().AsCString(),
-              extract_error.AsCString());
+              llvm::toString(std::move(error)).c_str());
----------------
adrian-prantl wrote:

even nicer:
```
llvm::joinErrors(llvm::createStringError("couldn't get the value of %s:", GetName()), std::move(error))
```

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


More information about the lldb-commits mailing list