mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #6135 from jckarter/use-sil-box-field-accessors-4
Mangle SILBoxTypes with their layout.
This commit is contained in:
@@ -1217,11 +1217,28 @@ void Mangler::mangleType(Type type, unsigned uncurryLevel) {
|
||||
return;
|
||||
}
|
||||
|
||||
case TypeKind::SILBox:
|
||||
Buffer << 'X' << 'b';
|
||||
mangleType(cast<SILBoxType>(tybase)->getBoxedType(),
|
||||
uncurryLevel);
|
||||
case TypeKind::SILBox: {
|
||||
Buffer << 'X' << 'B';
|
||||
auto boxTy = cast<SILBoxType>(tybase);
|
||||
// TODO: Should layouts get substitutions?
|
||||
auto layout = boxTy->getLayout();
|
||||
if (auto sig = layout->getGenericSignature()) {
|
||||
Buffer << 'G';
|
||||
mangleGenericSignature(sig);
|
||||
}
|
||||
for (auto &field : layout->getFields()) {
|
||||
Buffer << (field.isMutable() ? 'm' : 'i');
|
||||
mangleType(field.getLoweredType(), 0);
|
||||
}
|
||||
Buffer << '_';
|
||||
if (!boxTy->getGenericArgs().empty()) {
|
||||
for (auto &arg : boxTy->getGenericArgs()) {
|
||||
mangleType(arg.getReplacement(), 0);
|
||||
}
|
||||
Buffer << '_';
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
case TypeKind::SILBlockStorage:
|
||||
llvm_unreachable("should never be mangled");
|
||||
@@ -1229,6 +1246,11 @@ void Mangler::mangleType(Type type, unsigned uncurryLevel) {
|
||||
llvm_unreachable("bad type kind");
|
||||
}
|
||||
|
||||
void Mangler::mangleLegacyBoxType(CanType fieldType) {
|
||||
Buffer << 'X' << 'b';
|
||||
mangleType(fieldType, 0);
|
||||
}
|
||||
|
||||
/// Mangle a list of protocols. Each protocol is a substitution
|
||||
/// candidate.
|
||||
/// <protocol-list> ::= <protocol-name>+
|
||||
|
||||
Reference in New Issue
Block a user