================
@@ -3194,16 +3194,19 @@ lldb::ValueObjectSP 
ValueObject::CastToBasicType(CompilerType type) {
       GetCompilerType().IsPointerType() || GetCompilerType().IsNullPtrType();
   bool is_float = GetCompilerType().IsFloat();
   bool is_integer = GetCompilerType().IsInteger();
+  ExecutionContext exe_ctx(GetExecutionContextRef());
 
   if (!type.IsScalarType()) {
-    m_error = Status::FromErrorString("target type must be a scalar");
-    return GetSP();
+    Status error = Status::FromErrorString("target type must be a scalar");
+    return ValueObjectConstResult::Create(
+        exe_ctx.GetBestExecutionContextScope(), error.Clone());
----------------
labath wrote:

```suggestion
    return ValueObjectConstResult::Create(
        exe_ctx.GetBestExecutionContextScope(), Status::FromErrorString("target 
type must be a scalar"));
```

If you really want to have a variable for this, then you can keep what you have 
and use `std::move` instead of `Clone`, but I think this is better (and I think 
Adrian would agree :) ).

This comment applies throughout the patch.

https://github.com/llvm/llvm-project/pull/117401
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to