Skip to content

Commit ecc71dd

Browse files
committed
add superclass to child_indexes
1 parent dd9ee01 commit ecc71dd

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

lldb/source/Target/SwiftLanguageRuntimeDynamicTypeResolution.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,19 +1223,21 @@ llvm::Optional<size_t> SwiftLanguageRuntimeImpl::GetIndexOfChildMemberWithName(
12231223
auto &builder = reflection_ctx->getBuilder();
12241224
TypeConverter tc(builder);
12251225
LLDBTypeInfoProvider tip(*this, *ts);
1226-
// The class_tr pointer is used to iterate the class hierarchy, from the
1227-
// current class, each superclass, and ends on null.
1228-
auto *class_tr = tr;
1229-
while (class_tr) {
1226+
// `current_tr` iterates the class hierarchy, from the current class, each
1227+
// superclass, and ends on null.
1228+
auto *current_tr = tr;
1229+
while (current_tr) {
12301230
auto *record_ti = llvm::cast<RecordTypeInfo>(
12311231
tc.getClassInstanceTypeInfo(tr, 0, &tip));
1232-
class_tr = builder.lookupSuperclass(class_tr);
1233-
uint32_t offset = class_tr ? 1 : 0;
1232+
auto *super_tr = builder.lookupSuperclass(current_tr);
1233+
uint32_t offset = super_tr ? 1 : 0;
12341234
if (auto size = findFieldWithName(record_ti->getFields(), name,
1235-
child_indexes, offset)) {
1235+
child_indexes, offset))
12361236
return size;
1237-
}
1237+
current_tr = super_tr;
1238+
child_indexes.push_back(0);
12381239
}
1240+
child_indexes.clear();
12391241
return {};
12401242
}
12411243
}

0 commit comments

Comments
 (0)