Skip to content

Commit 7896423

Browse files
slavapestovsimanerush
authored andcommitted
SIL: Adjust isTypeMetadataForLayoutAccessible() to visit more lowered positions
Fixes part of swiftlang#67645, rdar://119267393
1 parent 331dadb commit 7896423

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
@@ -256,6 +256,24 @@ static bool isTypeMetadataForLayoutAccessible(SILModule &M, SILType type) {
256256
if (type.is<AnyMetatypeType>())
257257
return true;
258258

259+
// - pack expansion types
260+
if (auto expansionType = type.getAs<PackExpansionType>()) {
261+
auto patternType = SILType::getPrimitiveType(expansionType.getPatternType(),
262+
type.getCategory());
263+
return isTypeMetadataForLayoutAccessible(M, patternType);
264+
}
265+
266+
// - lowered pack types
267+
if (auto packType = type.getAs<SILPackType>()) {
268+
for (auto eltType : packType.getElementTypes()) {
269+
if (!isTypeMetadataForLayoutAccessible(
270+
M, SILType::getPrimitiveAddressType(eltType)))
271+
return false;
272+
}
273+
274+
return true;
275+
}
276+
259277
// Otherwise, check that we can fetch the type metadata.
260278
return M.isTypeMetadataAccessible(type.getASTType());
261279
}

0 commit comments

Comments
 (0)