[Lldb-commits] [lldb] [lldb][TypeSystemClang] Allow arrays to be dereferenced in C/C++. (PR #135843)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 23 04:58:35 PDT 2025


labath wrote:

> @labath @jimingham This is just one way to allow C/C++ to dereference arrays and let other languages decide on which types they allow to dereference. I tried making a `GetDereferencedType` function in TypeSystem, but it doesn't really need to do anything right now, everything is handled in `GetChildCompilerTypeAtIndex` anyway.

I think something like `GetDereferencedType` would still look better. Maybe the clang implementation of that function could internally defer to `GetChildCompilerTypeAtIndex` ?

> Also, you raised a problem that if a user has defined a synthetic child provider for the array type, then after converting array to a pointer that provider will not be used. Allowing the array to be dereferenced will do the same because of where the check for a synthetic child is in `ValueObject::Dereference`. I'm really not sure how to avoid that.

I'm not worried about that with a patch like this since the problem remains contained within `ValueObject::Dereference`, and you're not changing the existing logic. If we wanted to implement something like this, I suspect we would want to first check with the synthetic child provider to see if it provides a dereference operation, and only then fall back to the "normal" type system logic. But that's yet another patch.

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


More information about the lldb-commits mailing list