@@ -131,7 +131,7 @@ static bool canUnsafeCastStruct(SILType fromType, StructDecl *fromStruct,
131
131
132
132
// Can the first element of fromStruct be cast by value into toType?
133
133
SILType fromEltTy = fromType.getFieldType (*fromRange.begin (), M);
134
- if (SILType::canUnsafeCastValue (fromEltTy, toType, M))
134
+ if (SILType::canPerformABICompatibleUnsafeCastValue (fromEltTy, toType, M))
135
135
return true ;
136
136
137
137
// Otherwise, flatten one level of struct elements on each side.
@@ -149,7 +149,7 @@ static bool canUnsafeCastStruct(SILType fromType, StructDecl *fromStruct,
149
149
150
150
SILType fromEltTy = fromType.getFieldType (*fromI, M);
151
151
SILType toEltTy = toType.getFieldType (*toI, M);
152
- if (!SILType::canUnsafeCastValue (fromEltTy, toEltTy, M))
152
+ if (!SILType::canPerformABICompatibleUnsafeCastValue (fromEltTy, toEltTy, M))
153
153
return false ;
154
154
}
155
155
// fromType's overlapping elements are compatible.
@@ -162,8 +162,9 @@ static bool canUnsafeCastTuple(SILType fromType, CanTupleType fromTupleTy,
162
162
SILType toType, SILModule &M) {
163
163
unsigned numFromElts = fromTupleTy->getNumElements ();
164
164
// Can the first element of fromTupleTy be cast by value into toType?
165
- if (numFromElts != 0 && SILType::canUnsafeCastValue (
166
- fromType.getTupleElementType (0 ), toType, M)) {
165
+ if (numFromElts != 0
166
+ && SILType::canPerformABICompatibleUnsafeCastValue (
167
+ fromType.getTupleElementType (0 ), toType, M)) {
167
168
return true ;
168
169
}
169
170
// Otherwise, flatten one level of tuple elements on each side.
@@ -176,8 +177,9 @@ static bool canUnsafeCastTuple(SILType fromType, CanTupleType fromTupleTy,
176
177
return false ;
177
178
178
179
for (unsigned i = 0 ; i != numToElts; ++i) {
179
- if (!SILType::canUnsafeCastValue (fromType.getTupleElementType (i),
180
- toType.getTupleElementType (i), M)) {
180
+ if (!SILType::canPerformABICompatibleUnsafeCastValue (
181
+ fromType.getTupleElementType (i), toType.getTupleElementType (i),
182
+ M)) {
181
183
return false ;
182
184
}
183
185
}
@@ -221,7 +223,8 @@ static bool canUnsafeCastEnum(SILType fromType, EnumDecl *fromEnum,
221
223
continue ;
222
224
223
225
auto fromElementTy = fromType.getEnumElementType (fromElement, M);
224
- if (SILType::canUnsafeCastValue (fromElementTy, toElementTy, M))
226
+ if (SILType::canPerformABICompatibleUnsafeCastValue (fromElementTy,
227
+ toElementTy, M))
225
228
return true ;
226
229
}
227
230
return false ;
@@ -263,8 +266,9 @@ static bool canUnsafeCastScalars(SILType fromType, SILType toType,
263
266
return LeastFromWidth >= GreatestToWidth;
264
267
}
265
268
266
- bool SILType::canUnsafeCastValue (SILType fromType, SILType toType,
267
- SILModule &M) {
269
+ bool SILType::canPerformABICompatibleUnsafeCastValue (SILType fromType,
270
+ SILType toType,
271
+ SILModule &M) {
268
272
if (fromType == toType)
269
273
return true ;
270
274
0 commit comments