@@ -680,7 +680,9 @@ class ReflectionContext
680680
681681 // / Return a description of the layout of a class instance with the given
682682 // / metadata as its isa pointer.
683- const TypeInfo *getMetadataTypeInfo (StoredPointer MetadataAddress) {
683+ const TypeInfo *
684+ getMetadataTypeInfo (StoredPointer MetadataAddress,
685+ remote::TypeInfoProvider *ExternalTypeInfo) {
684686 // See if we cached the layout already
685687 auto found = Cache.find (MetadataAddress);
686688 if (found != Cache.end ())
@@ -702,7 +704,7 @@ class ReflectionContext
702704
703705 // Perform layout
704706 if (start)
705- TI = TC.getClassInstanceTypeInfo (TR, *start);
707+ TI = TC.getClassInstanceTypeInfo (TR, *start, ExternalTypeInfo );
706708
707709 break ;
708710 }
@@ -718,7 +720,9 @@ class ReflectionContext
718720
719721 // / Return a description of the layout of a class instance with the given
720722 // / metadata as its isa pointer.
721- const TypeInfo *getInstanceTypeInfo (StoredPointer ObjectAddress) {
723+ const TypeInfo *
724+ getInstanceTypeInfo (StoredPointer ObjectAddress,
725+ remote::TypeInfoProvider *ExternalTypeInfo) {
722726 auto MetadataAddress = readMetadataFromInstance (ObjectAddress);
723727 if (!MetadataAddress)
724728 return nullptr ;
@@ -729,7 +733,7 @@ class ReflectionContext
729733
730734 switch (*kind) {
731735 case MetadataKind::Class:
732- return getMetadataTypeInfo (*MetadataAddress);
736+ return getMetadataTypeInfo (*MetadataAddress, ExternalTypeInfo );
733737
734738 case MetadataKind::HeapLocalVariable: {
735739 auto CDAddr = this ->readCaptureDescriptorFromMetadata (*MetadataAddress);
@@ -751,7 +755,7 @@ class ReflectionContext
751755
752756 auto Info = getBuilder ().getClosureContextInfo (CD);
753757
754- return getClosureContextInfo (ObjectAddress, Info);
758+ return getClosureContextInfo (ObjectAddress, Info, ExternalTypeInfo );
755759 }
756760
757761 case MetadataKind::HeapGenericLocalVariable: {
@@ -760,7 +764,8 @@ class ReflectionContext
760764 if (auto Meta = readMetadata (*MetadataAddress)) {
761765 auto GenericHeapMeta =
762766 cast<TargetGenericBoxHeapMetadata<Runtime>>(Meta.getLocalBuffer ());
763- return getMetadataTypeInfo (GenericHeapMeta->BoxedType );
767+ return getMetadataTypeInfo (GenericHeapMeta->BoxedType ,
768+ ExternalTypeInfo);
764769 }
765770 return nullptr ;
766771 }
@@ -774,15 +779,15 @@ class ReflectionContext
774779 }
775780 }
776781
777- bool
778- projectExistential (RemoteAddress ExistentialAddress ,
779- const TypeRef *ExistentialTR ,
780- const TypeRef **OutInstanceTR ,
781- RemoteAddress *OutInstanceAddress ) {
782+ bool projectExistential (RemoteAddress ExistentialAddress,
783+ const TypeRef *ExistentialTR ,
784+ const TypeRef **OutInstanceTR ,
785+ RemoteAddress *OutInstanceAddress ,
786+ remote::TypeInfoProvider *ExternalTypeInfo ) {
782787 if (ExistentialTR == nullptr )
783788 return false ;
784789
785- auto ExistentialTI = getTypeInfo (ExistentialTR);
790+ auto ExistentialTI = getTypeInfo (ExistentialTR, ExternalTypeInfo );
786791 if (ExistentialTI == nullptr )
787792 return false ;
788793
@@ -846,14 +851,14 @@ class ReflectionContext
846851 // / Returns true if the enum case could be successfully determined. In
847852 // / particular, note that this code may return false for valid in-memory data
848853 // / if the compiler used a strategy we do not yet understand.
849- bool projectEnumValue (RemoteAddress EnumAddress,
850- const TypeRef *EnumTR ,
851- int *CaseIndex ) {
854+ bool projectEnumValue (RemoteAddress EnumAddress, const TypeRef *EnumTR,
855+ int *CaseIndex ,
856+ remote::TypeInfoProvider *ExternalTypeInfo ) {
852857 // Get the TypeInfo and sanity-check it
853858 if (EnumTR == nullptr ) {
854859 return false ;
855860 }
856- auto TI = getTypeInfo (EnumTR);
861+ auto TI = getTypeInfo (EnumTR, ExternalTypeInfo );
857862 if (TI == nullptr ) {
858863 return false ;
859864 }
@@ -865,11 +870,12 @@ class ReflectionContext
865870 }
866871
867872 // / Return a description of the layout of a value with the given type.
868- const TypeInfo *getTypeInfo (const TypeRef *TR) {
873+ const TypeInfo *getTypeInfo (const TypeRef *TR,
874+ remote::TypeInfoProvider *ExternalTypeInfo) {
869875 if (TR == nullptr ) {
870876 return nullptr ;
871877 } else {
872- return getBuilder ().getTypeConverter ().getTypeInfo (TR);
878+ return getBuilder ().getTypeConverter ().getTypeInfo (TR, ExternalTypeInfo );
873879 }
874880 }
875881
@@ -1160,8 +1166,9 @@ class ReflectionContext
11601166 }
11611167
11621168private:
1163- const TypeInfo *getClosureContextInfo (StoredPointer Context,
1164- const ClosureContextInfo &Info) {
1169+ const TypeInfo *
1170+ getClosureContextInfo (StoredPointer Context, const ClosureContextInfo &Info,
1171+ remote::TypeInfoProvider *ExternalTypeInfo) {
11651172 RecordTypeInfoBuilder Builder (getBuilder ().getTypeConverter (),
11661173 RecordKind::ClosureContext);
11671174
@@ -1219,7 +1226,7 @@ class ReflectionContext
12191226 SubstCaptureTR = OrigCaptureTR;
12201227
12211228 if (SubstCaptureTR != nullptr ) {
1222- Builder.addField (" " , SubstCaptureTR);
1229+ Builder.addField (" " , SubstCaptureTR, ExternalTypeInfo );
12231230 if (Builder.isInvalid ())
12241231 return nullptr ;
12251232
0 commit comments