Skip to content

Commit a172489

Browse files
Merge pull request #79700 from adrian-prantl/getinstancetypeinfo
[reflection] Generalize the implementation of getInstanceTypeInfo()
2 parents f79b73a + 58c01be commit a172489

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

include/swift/RemoteInspection/ReflectionContext.h

+6-4
Original file line numberDiff line numberDiff line change
@@ -1038,10 +1038,12 @@ class ReflectionContext
10381038
// Generic SIL @box type - there is always an instantiated metadata
10391039
// pointer for the boxed type.
10401040
if (auto Meta = readMetadata(*MetadataAddress)) {
1041-
auto GenericHeapMeta =
1042-
cast<TargetGenericBoxHeapMetadata<Runtime>>(Meta.getLocalBuffer());
1043-
return getMetadataTypeInfo(GenericHeapMeta->BoxedType,
1044-
ExternalTypeInfo);
1041+
if (auto *GenericHeapMeta = cast<TargetGenericBoxHeapMetadata<Runtime>>(
1042+
Meta.getLocalBuffer())) {
1043+
auto MetadataAddress = GenericHeapMeta->BoxedType;
1044+
auto TR = readTypeFromMetadata(MetadataAddress);
1045+
return getTypeInfo(TR, ExternalTypeInfo);
1046+
}
10451047
}
10461048
return nullptr;
10471049
}

0 commit comments

Comments
 (0)