[Lldb-commits] [lldb] [LLDB] Add more helper functions to ValueObject class. (PR #87197)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Mon Apr 1 12:59:47 PDT 2024
================
@@ -618,6 +631,24 @@ class ValueObject {
virtual lldb::ValueObjectSP CastPointerType(const char *name,
lldb::TypeSP &type_sp);
+ /// Return the target load address assocaited with this value object.
+ lldb::addr_t GetLoadAddress();
+
+ lldb::ValueObjectSP CastDerivedToBaseType(CompilerType type,
+ const std::vector<uint32_t> &idx);
+
+ lldb::ValueObjectSP CastBaseToDerivedType(CompilerType type, uint64_t offset);
+
+ lldb::ValueObjectSP CastScalarToBasicType(CompilerType type, Status &error);
----------------
clayborg wrote:
Same comment as Jim made below where the returned `lldb::ValueObjectSP` can have its error set correctly.
Also, we have a bunch of `CastXXXXToXXXX` calls added below. Do we really need all of these? Can we just have one `lldb::ValueObjectSP Cast(CompilerType type)` function and deduce what should be done internally and fail gracefully?
Or if we do need functions specific to `Scalar` and `Enum` we can add just `lldb::ValueObjectSP CastScalar(CompilerType type)` and `lldb::ValueObjectSP CastEnum(CompilerType type)`.
It would be great if we just have a single `lldb::ValueObjectSP Cast(CompilerType type)` function that works for everything. We should be able to figure out internally how things are stored (scalar, enum would be deduced from the current `ValueObject`, and figure out what we are casting it to with by looking at `CompilerType`
https://github.com/llvm/llvm-project/pull/87197
More information about the lldb-commits
mailing list