[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 16:23:28 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:
Ah, I missed that I was looking at a diff against your original diff which didn't make sense. In context the code seems fine.
But then that also showed that you are the author of the "somewhat confusing comment". Can you make that comment more helpful? Suppressing the synthetic child production would force this child to get its type directly from the CompilerType, which I would call the "real" child. So that comment seems to make sense when we passed `true` but doesn't make sense when passing true.
You don't need to introduce tests for this at this stage if that's dependent on other changes, but this seems like a tricky point, so it should have a comment. But this one doesn't make sense to me.
https://github.com/llvm/llvm-project/pull/87197
More information about the lldb-commits
mailing list