[llvm] Fix LLDB data formatter for llvm::Expected<T> with non-reference types (PR #179294)

Michael Buch via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 3 08:24:23 PST 2026


================
@@ -488,8 +488,13 @@ def update(self) -> None:
         # Anonymous union.
         union = self.expected.child[0]
         storage = union.GetChildMemberWithName(member)
-        stored_type = storage.type.template_args[0]
-        self.stored_value = storage.Cast(stored_type).Clone(name)
+        # For reference types, storage_type is std::reference_wrapper<T>,
+        # so we need to unwrap it. For non-reference types, storage_type is T directly.
+        if storage.type.GetNumberOfTemplateArguments() > 0:
----------------
Michael137 wrote:

Does this handle `llvm::Expected<SomeTemplate<int>>` correctly? Could we add a test for it?

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


More information about the llvm-commits mailing list