[Lldb-commits] [lldb] [lldb] upgrade HandleFrameFormatVariable callees to llvm::Expected (PR #144731)

Michael Buch via lldb-commits lldb-commits at lists.llvm.org
Thu Jun 19 02:47:01 PDT 2025


================
@@ -1954,32 +1896,41 @@ bool CPlusPlusLanguage::HandleFrameFormatVariable(
     FormatEntity::Entry::Type type, Stream &s) {
   switch (type) {
   case FormatEntity::Entry::Type::FunctionScope: {
-    std::optional<llvm::StringRef> scope = GetDemangledScope(sc);
-    if (!scope)
+    auto scope_or_err = GetDemangledScope(sc);
+    if (!scope_or_err) {
+      LLDB_LOG_ERROR(GetLog(LLDBLog::Language), scope_or_err.takeError(),
+                     "Failed to retrieve scope: {0}");
       return false;
+    }
 
-    s << *scope;
+    s << *scope_or_err;
 
     return true;
   }
 
   case FormatEntity::Entry::Type::FunctionBasename: {
-    std::optional<llvm::StringRef> name = GetDemangledBasename(sc);
-    if (!name)
+    auto name_or_err = GetDemangledBasename(sc);
+    if (!name_or_err) {
+      LLDB_LOG_ERROR(GetLog(LLDBLog::Language), name_or_err.takeError(),
+                     "Failed to retrieve basename: {0}");
----------------
Michael137 wrote:

```suggestion
                     "Failed to handle ${function.basename}: {0}");
```
And do this for the other messages in this switch too?

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


More information about the lldb-commits mailing list