@@ -122,7 +122,10 @@ class ReflectionContext
122122 using super::readMetadata;
123123 using super::readObjCClassName;
124124 using super::readResolvedPointerValue;
125- llvm::DenseMap<typename super::StoredPointer, const RecordTypeInfo *> Cache;
125+ llvm::DenseMap<std::pair<typename super::StoredPointer,
126+ remote::TypeInfoProvider::IdType>,
127+ const RecordTypeInfo *>
128+ Cache;
126129
127130 // / All buffers we need to keep around long term. This will automatically free them
128131 // / when this object is destroyed.
@@ -892,7 +895,8 @@ class ReflectionContext
892895 getMetadataTypeInfo (StoredPointer MetadataAddress,
893896 remote::TypeInfoProvider *ExternalTypeInfo) {
894897 // See if we cached the layout already
895- auto found = Cache.find (MetadataAddress);
898+ auto ExternalTypeInfoId = ExternalTypeInfo ? ExternalTypeInfo->getId () : 0 ;
899+ auto found = Cache.find ({MetadataAddress, ExternalTypeInfoId});
896900 if (found != Cache.end ())
897901 return found->second ;
898902
@@ -922,7 +926,7 @@ class ReflectionContext
922926 }
923927
924928 // Cache the result for future lookups
925- Cache[MetadataAddress] = TI;
929+ Cache[{ MetadataAddress, ExternalTypeInfoId} ] = TI;
926930 return TI;
927931 }
928932
0 commit comments