[Lldb-commits] [lldb] [lldb] Add SBType::FindNestedType() function (PR #68705)

Vlad Serebrennikov via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 10 06:52:59 PDT 2023


Endilll wrote:

Intended usage is going to look like the following for `PointerIntPair`:
```python
class PointerIntPairProvider:
    def update(self):
        pointer_info = self.valobj.type.template_args[4] # PointerIntPairInfo
        masks = pointer_info.FindNestedType("MaskAndShiftConstants")
        if masks.IsValid():
            for enumerator in enum.enum_members:
                if enumerator.name == "PointerBitMask":
                    pointer_mask = enumerator.unsigned
                    # extract pointer using the mask
```
Fully qualified name of `PointerIntPairInfo` used in `clang::QualType` is the following: `llvm::PointerIntPairInfo<llvm::PointerUnion<const clang::Type*, const clang::ExtQuals *>, 3, llvm::PointerLikeTypeTraits<llvm::PointerUnion<const clang::Type *, const clang::ExtQuals *> > >::MaskAndShiftConstants`. I'm not sure if existing `SBTarget::FindFirstType()` can handle this case as well as proposed function.

I'll submit a proper API test shortly.

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


More information about the lldb-commits mailing list