@@ -1561,22 +1561,36 @@ CompilerType SwiftLanguageRuntimeImpl::GetChildCompilerTypeAtIndex(
1561
1561
NodePointer type_node = dem.demangleSymbol (mangled);
1562
1562
llvm::StringRef type_name = TypeSystemSwiftTypeRef::GetBaseName (
1563
1563
ts->CanonicalizeSugar (dem, type_node));
1564
+
1565
+ auto *reflection_ctx = GetReflectionContext ();
1566
+ if (!reflection_ctx)
1567
+ return {};
1568
+ CompilerType instance_type = valobj->GetCompilerType ();
1569
+ auto *instance_ts =
1570
+ llvm::dyn_cast_or_null<TypeSystemSwift>(instance_type.GetTypeSystem ());
1571
+ if (!instance_ts)
1572
+ return {};
1573
+
1574
+ // LLDBTypeInfoProvider needs to kept alive until as long as supers gets accessed.
1564
1575
llvm::SmallVector<SuperClassType, 2 > supers;
1565
- ForEachSuperClassType (*valobj, [&](SuperClassType sc) -> bool {
1566
- if (!found_start) {
1567
- // The ValueObject always points to the same class instance,
1568
- // even when querying base classes. Drop base classes until we
1569
- // reach the requested type.
1570
- if (auto *tr = sc.get_typeref ()) {
1571
- NodePointer base_class = tr->getDemangling (dem);
1572
- if (TypeSystemSwiftTypeRef::GetBaseName (base_class) != type_name)
1573
- return false ;
1574
- found_start = true ;
1575
- }
1576
- }
1577
- supers.push_back (sc);
1578
- return supers.size () >= 2 ;
1579
- });
1576
+ LLDBTypeInfoProvider tip (*this , *instance_ts);
1577
+ lldb::addr_t pointer = valobj->GetPointerValue ();
1578
+ reflection_ctx->ForEachSuperClassType (
1579
+ &tip, pointer, [&](SuperClassType sc) -> bool {
1580
+ if (!found_start) {
1581
+ // The ValueObject always points to the same class instance,
1582
+ // even when querying base classes. Drop base classes until we
1583
+ // reach the requested type.
1584
+ if (auto *tr = sc.get_typeref ()) {
1585
+ NodePointer base_class = tr->getDemangling (dem);
1586
+ if (TypeSystemSwiftTypeRef::GetBaseName (base_class) != type_name)
1587
+ return false ;
1588
+ found_start = true ;
1589
+ }
1590
+ }
1591
+ supers.push_back (sc);
1592
+ return supers.size () >= 2 ;
1593
+ });
1580
1594
1581
1595
if (supers.size () == 0 ) {
1582
1596
LLDB_LOGF (GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES),
0 commit comments