@@ -1266,8 +1266,8 @@ ManagedValue Conversion::emit(SILGenFunction &SGF, SILLocation loc,
1266
1266
case AnyErasure:
1267
1267
case BridgingSubtype:
1268
1268
case Subtype:
1269
- return SGF.emitTransformedValue (loc, value, getBridgingSourceType (),
1270
- getBridgingResultType (), C);
1269
+ return SGF.emitTransformedValue (loc, value, getSourceType (),
1270
+ getResultType (), C);
1271
1271
1272
1272
case ForceOptional: {
1273
1273
auto &optTL = SGF.getTypeLowering (value.getType ());
@@ -1278,32 +1278,30 @@ ManagedValue Conversion::emit(SILGenFunction &SGF, SILLocation loc,
1278
1278
1279
1279
case BridgeToObjC:
1280
1280
return SGF.emitNativeToBridgedValue (loc, value,
1281
- getBridgingSourceType (),
1282
- getBridgingResultType (),
1283
- getBridgingLoweredResultType (), C);
1281
+ getSourceType (),
1282
+ getResultType (),
1283
+ getLoweredResultType (), C);
1284
1284
1285
1285
case ForceAndBridgeToObjC: {
1286
1286
auto &tl = SGF.getTypeLowering (value.getType ());
1287
- auto sourceValueType = getBridgingSourceType ().getOptionalObjectType ();
1287
+ auto sourceValueType = getSourceType ().getOptionalObjectType ();
1288
1288
value = SGF.emitCheckedGetOptionalValueFrom (loc, value,
1289
1289
/* isImplicitUnwrap*/ true ,
1290
1290
tl, SGFContext ());
1291
1291
return SGF.emitNativeToBridgedValue (loc, value, sourceValueType,
1292
- getBridgingResultType (),
1293
- getBridgingLoweredResultType (), C);
1292
+ getResultType (),
1293
+ getLoweredResultType (), C);
1294
1294
}
1295
1295
1296
1296
case BridgeFromObjC:
1297
1297
return SGF.emitBridgedToNativeValue (loc, value,
1298
- getBridgingSourceType (),
1299
- getBridgingResultType (),
1300
- getBridgingLoweredResultType (), C);
1298
+ getSourceType (), getResultType (),
1299
+ getLoweredResultType (), C);
1301
1300
1302
1301
case BridgeResultFromObjC:
1303
1302
return SGF.emitBridgedToNativeValue (loc, value,
1304
- getBridgingSourceType (),
1305
- getBridgingResultType (),
1306
- getBridgingLoweredResultType (), C,
1303
+ getSourceType (), getResultType (),
1304
+ getLoweredResultType (), C,
1307
1305
/* isResult*/ true );
1308
1306
1309
1307
case Reabstract:
@@ -1336,9 +1334,9 @@ Conversion::adjustForInitialOptionalInjection() const {
1336
1334
case Subtype:
1337
1335
return OptionalInjectionConversion::forValue (
1338
1336
getSubtype (
1339
- getBridgingSourceType ().getOptionalObjectType (),
1340
- getBridgingResultType ().getOptionalObjectType (),
1341
- getBridgingLoweredResultType ().getOptionalObjectType ())
1337
+ getSourceType ().getOptionalObjectType (),
1338
+ getResultType ().getOptionalObjectType (),
1339
+ getLoweredResultType ().getOptionalObjectType ())
1342
1340
);
1343
1341
1344
1342
// TODO: can these actually happen?
@@ -1352,9 +1350,8 @@ Conversion::adjustForInitialOptionalInjection() const {
1352
1350
case BridgeFromObjC:
1353
1351
case BridgeResultFromObjC:
1354
1352
return OptionalInjectionConversion::forInjection (
1355
- getBridging (getKind (), getBridgingSourceType ().getOptionalObjectType (),
1356
- getBridgingResultType (),
1357
- getBridgingLoweredResultType (),
1353
+ getBridging (getKind (), getSourceType ().getOptionalObjectType (),
1354
+ getResultType (), getLoweredResultType (),
1358
1355
isBridgingExplicit ())
1359
1356
);
1360
1357
}
@@ -1379,8 +1376,7 @@ Conversion::adjustForInitialOptionalConversions(CanType newSourceType) const {
1379
1376
case BridgeFromObjC:
1380
1377
case BridgeResultFromObjC:
1381
1378
return Conversion::getBridging (getKind (), newSourceType,
1382
- getBridgingResultType (),
1383
- getBridgingLoweredResultType (),
1379
+ getResultType (), getLoweredResultType (),
1384
1380
isBridgingExplicit ());
1385
1381
}
1386
1382
llvm_unreachable (" bad kind" );
@@ -1399,12 +1395,10 @@ std::optional<Conversion> Conversion::adjustForInitialForceValue() const {
1399
1395
return std::nullopt;
1400
1396
1401
1397
case BridgeToObjC: {
1402
- auto sourceOptType =
1403
- OptionalType::get (getBridgingSourceType ())->getCanonicalType ();
1398
+ auto sourceOptType = getSourceType ().wrapInOptionalType ();
1404
1399
return Conversion::getBridging (ForceAndBridgeToObjC,
1405
- sourceOptType,
1406
- getBridgingResultType (),
1407
- getBridgingLoweredResultType (),
1400
+ sourceOptType, getResultType (),
1401
+ getLoweredResultType (),
1408
1402
isBridgingExplicit ());
1409
1403
}
1410
1404
}
@@ -1436,9 +1430,9 @@ static void printReabstraction(const Conversion &conversion,
1436
1430
static void printBridging (const Conversion &conversion, llvm::raw_ostream &out,
1437
1431
StringRef name) {
1438
1432
out << name << " (from: " ;
1439
- conversion.getBridgingSourceType ().print (out);
1433
+ conversion.getSourceType ().print (out);
1440
1434
out << " , to: " ;
1441
- conversion.getBridgingResultType ().print (out);
1435
+ conversion.getResultType ().print (out);
1442
1436
out << " , explicit: " << conversion.isBridgingExplicit () << ' )' ;
1443
1437
}
1444
1438
@@ -1792,7 +1786,7 @@ combineSubtypeIntoReabstract(SILGenFunction &SGF,
1792
1786
if (!isCombinableConversion (inner, outer))
1793
1787
return salvageUncombinableConversion (SGF, inner, outer);
1794
1788
1795
- auto inputSubstType = inner.getBridgingSourceType ();
1789
+ auto inputSubstType = inner.getSourceType ();
1796
1790
auto inputOrigType = AbstractionPattern (inputSubstType);
1797
1791
auto inputLoweredTy = SGF.getLoweredType (inputOrigType, inputSubstType);
1798
1792
@@ -1812,9 +1806,8 @@ combineSubtype(SILGenFunction &SGF,
1812
1806
return salvageUncombinableConversion (SGF, inner, outer);
1813
1807
1814
1808
return CombinedConversions (
1815
- Conversion::getSubtype (inner.getBridgingSourceType (),
1816
- outer.getBridgingResultType (),
1817
- outer.getBridgingLoweredResultType ())
1809
+ Conversion::getSubtype (inner.getSourceType (), outer.getResultType (),
1810
+ outer.getLoweredResultType ())
1818
1811
);
1819
1812
}
1820
1813
@@ -1832,9 +1825,9 @@ combineBridging(SILGenFunction &SGF,
1832
1825
// Otherwise, we can peephole if we understand the resulting conversion
1833
1826
// and applying the peephole doesn't change semantics.
1834
1827
1835
- CanType sourceType = inner.getBridgingSourceType ();
1836
- CanType intermediateType = inner.getBridgingResultType ();
1837
- assert (intermediateType == outer.getBridgingSourceType ());
1828
+ CanType sourceType = inner.getSourceType ();
1829
+ CanType intermediateType = inner.getResultType ();
1830
+ assert (intermediateType == outer.getSourceType ());
1838
1831
1839
1832
// If we're doing a peephole involving a force, we want to propagate
1840
1833
// the force to the source value. If it's not in fact optional, that
@@ -1849,9 +1842,9 @@ combineBridging(SILGenFunction &SGF,
1849
1842
assert (intermediateType);
1850
1843
}
1851
1844
1852
- CanType resultType = outer.getBridgingResultType ();
1845
+ CanType resultType = outer.getResultType ();
1853
1846
SILType loweredSourceTy = SGF.getLoweredType (sourceType);
1854
- SILType loweredResultTy = outer.getBridgingLoweredResultType ();
1847
+ SILType loweredResultTy = outer.getLoweredResultType ();
1855
1848
1856
1849
auto applyPeephole = [&](const std::optional<Conversion> &conversion) {
1857
1850
if (!forced) {
@@ -1862,7 +1855,7 @@ combineBridging(SILGenFunction &SGF,
1862
1855
1863
1856
auto forceConversion =
1864
1857
Conversion::getBridging (Conversion::ForceOptional,
1865
- inner.getBridgingSourceType (), sourceType,
1858
+ inner.getSourceType (), sourceType,
1866
1859
loweredSourceTy);
1867
1860
if (conversion)
1868
1861
return CombinedConversions (forceConversion, *conversion);
0 commit comments