Skip to content

Commit 8cc2a3b

Browse files
Merge pull request #71530 from adrian-prantl/122432501
Add ExternalTypeInfoProvider the the key of the ReflectionContext Typ…
2 parents b968125 + 09da198 commit 8cc2a3b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

include/swift/RemoteInspection/ReflectionContext.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)