[Lldb-commits] [lldb] [LLDB][Value] Require type size when reading a scalar (PR #153386)

via lldb-commits lldb-commits at lists.llvm.org
Thu Aug 14 06:54:11 PDT 2025


================
@@ -347,6 +347,9 @@ Status Value::GetValueAsData(ExecutionContext *exe_ctx, DataExtractor &data,
     else
       data.SetAddressByteSize(sizeof(void *));
 
+    if (!type_size)
+      return Status::FromErrorString("type does not have a size");
----------------
Nerixyz wrote:

I don't think we need an incomplete type here. A value without a compiler type should suffice. So something like

```cpp
Value v(Scalar(42));
DataExtractor extractor;
Status status = v.GetValueAsData(nullptr, extractor, nullptr);
ASSERT_TRUE(status.Fail());
```

I could add a file in `unittests/ValueObject`. There are no unittests that call `GetValueAsData` yet.

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


More information about the lldb-commits mailing list