[Lldb-commits] [lldb] [LLDB] Add more helper functions to ValueObject class. (PR #87197)

via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 5 13:42:16 PDT 2024


================
@@ -3015,11 +3017,12 @@ llvm::Expected<lldb::ValueObjectSP> ValueObject::CastDerivedToBaseType(
 
   lldb::TargetSP target = GetTargetSP();
   // The `value` can be a pointer, but GetChildAtIndex works for pointers too.
-  lldb::ValueObjectSP inner_value;
+  lldb::ValueObjectSP inner_value = GetSP();
 
   for (const uint32_t i : base_type_indices)
     // Force static value, otherwise we can end up with the "real" type.
-    inner_value = GetChildAtIndex(i, /*can_create_synthetic*/ false);
----------------
jimingham wrote:

I don't understand this change.  How is getting `this->GetSP()->GetChildAtIndex` different from `this->GetChildAtIndex`?

The other change here seems to be to change can_create_synthetic from false to true.  IIUC, the comment directly above this change says why it chose `false` here, though it is a somewhat confusing comment.  Since you seem to disagree with that comment, you should probably change the comment to say why you think `true` is the right value here.

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


More information about the lldb-commits mailing list