Skip to content

Commit d89aacb

Browse files
committed
traverse class hierarchy
1 parent 1d92d40 commit d89aacb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lldb/source/Target/SwiftLanguageRuntimeDynamicTypeResolution.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,14 +1221,15 @@ llvm::Optional<size_t> SwiftLanguageRuntimeImpl::GetIndexOfChildMemberWithName(
12211221
auto &builder = reflection_ctx->getBuilder();
12221222
auto tc = TypeConverter(builder);
12231223
auto tip = LLDBTypeInfoProvider(*this, *ts);
1224-
auto *cti = tc.getClassInstanceTypeInfo(tr, 0, &tip);
1225-
if (auto *rti = llvm::cast_or_null<RecordTypeInfo>(cti)) {
1226-
uint32_t offset = builder.lookupSuperclass(tr) ? 1 : 0;
1227-
if (auto size = findFieldWithName(rti->getFields(), name, child_indexes,
1228-
offset)) {
1224+
auto *class_ti = tc.getClassInstanceTypeInfo(tr, 0, &tip);
1225+
while (auto *record_ti = llvm::cast_or_null<RecordTypeInfo>(class_ti)) {
1226+
auto super_tr = builder.lookupSuperclass(tr);
1227+
uint32_t offset = super_tr ? 1 : 0;
1228+
if (auto size = findFieldWithName(record_ti->getFields(), name,
1229+
child_indexes, offset)) {
12291230
return size;
12301231
}
1231-
// TODO: handle base classes.
1232+
class_ti = reflection_ctx->getTypeInfo(super_tr, &tip);
12321233
}
12331234
return {};
12341235
}

0 commit comments

Comments
 (0)