Skip to content

Commit 04993ef

Browse files
committed
add superclass to child_indexes
(cherry picked from commit ecc71dd)
1 parent 69aa747 commit 04993ef

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
@@ -1221,19 +1221,21 @@ llvm::Optional<size_t> SwiftLanguageRuntimeImpl::GetIndexOfChildMemberWithName(
12211221
auto &builder = reflection_ctx->getBuilder();
12221222
TypeConverter tc(builder);
12231223
LLDBTypeInfoProvider tip(*this, *ts);
1224-
// The class_tr pointer is used to iterate the class hierarchy, from the
1225-
// current class, each superclass, and ends on null.
1226-
auto *class_tr = tr;
1227-
while (class_tr) {
1224+
// `current_tr` iterates the class hierarchy, from the current class, each
1225+
// superclass, and ends on null.
1226+
auto *current_tr = tr;
1227+
while (current_tr) {
12281228
auto *record_ti = llvm::cast<RecordTypeInfo>(
12291229
tc.getClassInstanceTypeInfo(tr, 0, &tip));
1230-
class_tr = builder.lookupSuperclass(class_tr);
1231-
uint32_t offset = class_tr ? 1 : 0;
1230+
auto *super_tr = builder.lookupSuperclass(current_tr);
1231+
uint32_t offset = super_tr ? 1 : 0;
12321232
if (auto size = findFieldWithName(record_ti->getFields(), name,
1233-
child_indexes, offset)) {
1233+
child_indexes, offset))
12341234
return size;
1235-
}
1235+
current_tr = super_tr;
1236+
child_indexes.push_back(0);
12361237
}
1238+
child_indexes.clear();
12371239
return {};
12381240
}
12391241
}

0 commit comments

Comments
 (0)