Skip to content

Commit 81d0392

Browse files
slavapestovsimanerush
authored andcommitted
SIL: Adjust isTypeMetadataForLayoutAccessible() to visit more lowered positions
Fixes part of #67645, rdar://119267393
1 parent 2fa1022 commit 81d0392

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib/SIL/IR/SIL.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,24 @@ static bool isTypeMetadataForLayoutAccessible(SILModule &M, SILType type) {
249249
if (type.is<AnyMetatypeType>())
250250
return true;
251251

252+
// - pack expansion types
253+
if (auto expansionType = type.getAs<PackExpansionType>()) {
254+
auto patternType = SILType::getPrimitiveType(expansionType.getPatternType(),
255+
type.getCategory());
256+
return isTypeMetadataForLayoutAccessible(M, patternType);
257+
}
258+
259+
// - lowered pack types
260+
if (auto packType = type.getAs<SILPackType>()) {
261+
for (auto eltType : packType.getElementTypes()) {
262+
if (!isTypeMetadataForLayoutAccessible(M,
263+
SILType::getPrimitiveAddressType(eltType)))
264+
return false;
265+
}
266+
267+
return true;
268+
}
269+
252270
// Otherwise, check that we can fetch the type metadata.
253271
return M.isTypeMetadataAccessible(type.getASTType());
254272
}

0 commit comments

Comments
 (0)