Merge pull request #79700 from adrian-prantl/getinstancetypeinfo

[reflection] Generalize the implementation of getInstanceTypeInfo()
This commit is contained in:
Adrian Prantl
2025-03-03 09:02:44 -08:00
committed by GitHub

View File

@@ -1038,10 +1038,12 @@ public:
// Generic SIL @box type - there is always an instantiated metadata
// pointer for the boxed type.
if (auto Meta = readMetadata(*MetadataAddress)) {
auto GenericHeapMeta =
cast<TargetGenericBoxHeapMetadata<Runtime>>(Meta.getLocalBuffer());
return getMetadataTypeInfo(GenericHeapMeta->BoxedType,
ExternalTypeInfo);
if (auto *GenericHeapMeta = cast<TargetGenericBoxHeapMetadata<Runtime>>(
Meta.getLocalBuffer())) {
auto MetadataAddress = GenericHeapMeta->BoxedType;
auto TR = readTypeFromMetadata(MetadataAddress);
return getTypeInfo(TR, ExternalTypeInfo);
}
}
return nullptr;
}