@@ -1258,8 +1258,8 @@ ManagedValue Conversion::emit(SILGenFunction &SGF, SILLocation loc,
1258
1258
case AnyErasure:
1259
1259
case BridgingSubtype:
1260
1260
case Subtype:
1261
- return SGF.emitTransformedValue (loc, value, getBridgingSourceType (),
1262
- getBridgingResultType (), C);
1261
+ return SGF.emitTransformedValue (loc, value, getSourceType (),
1262
+ getResultType (), C);
1263
1263
1264
1264
case ForceOptional: {
1265
1265
auto &optTL = SGF.getTypeLowering (value.getType ());
@@ -1270,32 +1270,30 @@ ManagedValue Conversion::emit(SILGenFunction &SGF, SILLocation loc,
1270
1270
1271
1271
case BridgeToObjC:
1272
1272
return SGF.emitNativeToBridgedValue (loc, value,
1273
- getBridgingSourceType (),
1274
- getBridgingResultType (),
1275
- getBridgingLoweredResultType (), C);
1273
+ getSourceType (),
1274
+ getResultType (),
1275
+ getLoweredResultType (), C);
1276
1276
1277
1277
case ForceAndBridgeToObjC: {
1278
1278
auto &tl = SGF.getTypeLowering (value.getType ());
1279
- auto sourceValueType = getBridgingSourceType ().getOptionalObjectType ();
1279
+ auto sourceValueType = getSourceType ().getOptionalObjectType ();
1280
1280
value = SGF.emitCheckedGetOptionalValueFrom (loc, value,
1281
1281
/* isImplicitUnwrap*/ true ,
1282
1282
tl, SGFContext ());
1283
1283
return SGF.emitNativeToBridgedValue (loc, value, sourceValueType,
1284
- getBridgingResultType (),
1285
- getBridgingLoweredResultType (), C);
1284
+ getResultType (),
1285
+ getLoweredResultType (), C);
1286
1286
}
1287
1287
1288
1288
case BridgeFromObjC:
1289
1289
return SGF.emitBridgedToNativeValue (loc, value,
1290
- getBridgingSourceType (),
1291
- getBridgingResultType (),
1292
- getBridgingLoweredResultType (), C);
1290
+ getSourceType (), getResultType (),
1291
+ getLoweredResultType (), C);
1293
1292
1294
1293
case BridgeResultFromObjC:
1295
1294
return SGF.emitBridgedToNativeValue (loc, value,
1296
- getBridgingSourceType (),
1297
- getBridgingResultType (),
1298
- getBridgingLoweredResultType (), C,
1295
+ getSourceType (), getResultType (),
1296
+ getLoweredResultType (), C,
1299
1297
/* isResult*/ true );
1300
1298
1301
1299
case Reabstract:
@@ -1328,9 +1326,9 @@ Conversion::adjustForInitialOptionalInjection() const {
1328
1326
case Subtype:
1329
1327
return OptionalInjectionConversion::forValue (
1330
1328
getSubtype (
1331
- getBridgingSourceType ().getOptionalObjectType (),
1332
- getBridgingResultType ().getOptionalObjectType (),
1333
- getBridgingLoweredResultType ().getOptionalObjectType ())
1329
+ getSourceType ().getOptionalObjectType (),
1330
+ getResultType ().getOptionalObjectType (),
1331
+ getLoweredResultType ().getOptionalObjectType ())
1334
1332
);
1335
1333
1336
1334
// TODO: can these actually happen?
@@ -1344,9 +1342,8 @@ Conversion::adjustForInitialOptionalInjection() const {
1344
1342
case BridgeFromObjC:
1345
1343
case BridgeResultFromObjC:
1346
1344
return OptionalInjectionConversion::forInjection (
1347
- getBridging (getKind (), getBridgingSourceType ().getOptionalObjectType (),
1348
- getBridgingResultType (),
1349
- getBridgingLoweredResultType (),
1345
+ getBridging (getKind (), getSourceType ().getOptionalObjectType (),
1346
+ getResultType (), getLoweredResultType (),
1350
1347
isBridgingExplicit ())
1351
1348
);
1352
1349
}
@@ -1371,8 +1368,7 @@ Conversion::adjustForInitialOptionalConversions(CanType newSourceType) const {
1371
1368
case BridgeFromObjC:
1372
1369
case BridgeResultFromObjC:
1373
1370
return Conversion::getBridging (getKind (), newSourceType,
1374
- getBridgingResultType (),
1375
- getBridgingLoweredResultType (),
1371
+ getResultType (), getLoweredResultType (),
1376
1372
isBridgingExplicit ());
1377
1373
}
1378
1374
llvm_unreachable (" bad kind" );
@@ -1391,12 +1387,10 @@ std::optional<Conversion> Conversion::adjustForInitialForceValue() const {
1391
1387
return std::nullopt;
1392
1388
1393
1389
case BridgeToObjC: {
1394
- auto sourceOptType =
1395
- OptionalType::get (getBridgingSourceType ())->getCanonicalType ();
1390
+ auto sourceOptType = getSourceType ().wrapInOptionalType ();
1396
1391
return Conversion::getBridging (ForceAndBridgeToObjC,
1397
- sourceOptType,
1398
- getBridgingResultType (),
1399
- getBridgingLoweredResultType (),
1392
+ sourceOptType, getResultType (),
1393
+ getLoweredResultType (),
1400
1394
isBridgingExplicit ());
1401
1395
}
1402
1396
}
@@ -1428,9 +1422,9 @@ static void printReabstraction(const Conversion &conversion,
1428
1422
static void printBridging (const Conversion &conversion, llvm::raw_ostream &out,
1429
1423
StringRef name) {
1430
1424
out << name << " (from: " ;
1431
- conversion.getBridgingSourceType ().print (out);
1425
+ conversion.getSourceType ().print (out);
1432
1426
out << " , to: " ;
1433
- conversion.getBridgingResultType ().print (out);
1427
+ conversion.getResultType ().print (out);
1434
1428
out << " , explicit: " << conversion.isBridgingExplicit () << ' )' ;
1435
1429
}
1436
1430
@@ -1784,7 +1778,7 @@ combineSubtypeIntoReabstract(SILGenFunction &SGF,
1784
1778
if (!isCombinableConversion (inner, outer))
1785
1779
return salvageUncombinableConversion (SGF, inner, outer);
1786
1780
1787
- auto inputSubstType = inner.getBridgingSourceType ();
1781
+ auto inputSubstType = inner.getSourceType ();
1788
1782
auto inputOrigType = AbstractionPattern (inputSubstType);
1789
1783
auto inputLoweredTy = SGF.getLoweredType (inputOrigType, inputSubstType);
1790
1784
@@ -1804,9 +1798,8 @@ combineSubtype(SILGenFunction &SGF,
1804
1798
return salvageUncombinableConversion (SGF, inner, outer);
1805
1799
1806
1800
return CombinedConversions (
1807
- Conversion::getSubtype (inner.getBridgingSourceType (),
1808
- outer.getBridgingResultType (),
1809
- outer.getBridgingLoweredResultType ())
1801
+ Conversion::getSubtype (inner.getSourceType (), outer.getResultType (),
1802
+ outer.getLoweredResultType ())
1810
1803
);
1811
1804
}
1812
1805
@@ -1824,9 +1817,9 @@ combineBridging(SILGenFunction &SGF,
1824
1817
// Otherwise, we can peephole if we understand the resulting conversion
1825
1818
// and applying the peephole doesn't change semantics.
1826
1819
1827
- CanType sourceType = inner.getBridgingSourceType ();
1828
- CanType intermediateType = inner.getBridgingResultType ();
1829
- assert (intermediateType == outer.getBridgingSourceType ());
1820
+ CanType sourceType = inner.getSourceType ();
1821
+ CanType intermediateType = inner.getResultType ();
1822
+ assert (intermediateType == outer.getSourceType ());
1830
1823
1831
1824
// If we're doing a peephole involving a force, we want to propagate
1832
1825
// the force to the source value. If it's not in fact optional, that
@@ -1841,9 +1834,9 @@ combineBridging(SILGenFunction &SGF,
1841
1834
assert (intermediateType);
1842
1835
}
1843
1836
1844
- CanType resultType = outer.getBridgingResultType ();
1837
+ CanType resultType = outer.getResultType ();
1845
1838
SILType loweredSourceTy = SGF.getLoweredType (sourceType);
1846
- SILType loweredResultTy = outer.getBridgingLoweredResultType ();
1839
+ SILType loweredResultTy = outer.getLoweredResultType ();
1847
1840
1848
1841
auto applyPeephole = [&](const std::optional<Conversion> &conversion) {
1849
1842
if (!forced) {
@@ -1854,7 +1847,7 @@ combineBridging(SILGenFunction &SGF,
1854
1847
1855
1848
auto forceConversion =
1856
1849
Conversion::getBridging (Conversion::ForceOptional,
1857
- inner.getBridgingSourceType (), sourceType,
1850
+ inner.getSourceType (), sourceType,
1858
1851
loweredSourceTy);
1859
1852
if (conversion)
1860
1853
return CombinedConversions (forceConversion, *conversion);
0 commit comments