Skip to content

Commit abe28dc

Browse files
authored
Merge pull request #68638 from augusto2112/5.9-dont-trust-external-cache
Don't trust the external cache when looking for field descriptors
2 parents b3ffd5e + cfc2469 commit abe28dc

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

stdlib/public/RemoteInspection/TypeRefBuilder.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,15 +331,23 @@ RemoteRef<FieldDescriptor> TypeRefBuilder::getFieldTypeInfo(const TypeRef *TR) {
331331
}
332332
}
333333

334-
// On failure, fill out the cache, ReflectionInfo by ReflectionInfo,
335-
// until we find the field descriptor we're looking for.
334+
// If the heuristic didn't work, iterate over every reflection info
335+
// that the external cache hasn't processed.
336336
for (size_t i = 0; i < ReflectionInfos.size(); ++i) {
337337
if (ExternalTypeRefCache && ExternalTypeRefCache->isReflectionInfoCached(i))
338338
continue;
339339
if (auto FD = findFieldDescriptorAtIndex(i, *MangledName))
340340
return *FD;
341341
}
342342

343+
// If we still haven't found the field descriptor go over every reflection
344+
// info, even the ones the external cache supposedly processed.
345+
// TODO: if we find the field descriptor here there is a bug somewhere (most
346+
// likely on the external cache). Log this somehow.
347+
for (size_t i = 0; i < ReflectionInfos.size(); ++i)
348+
if (auto FD = findFieldDescriptorAtIndex(i, *MangledName))
349+
return *FD;
350+
343351
return nullptr;
344352
}
345353

0 commit comments

Comments
 (0)