@@ -1266,8 +1266,8 @@ ManagedValue Conversion::emit(SILGenFunction &SGF, SILLocation loc,
12661266 case AnyErasure:
12671267 case BridgingSubtype:
12681268 case Subtype:
1269- return SGF.emitTransformedValue (loc, value, getBridgingSourceType (),
1270- getBridgingResultType (), C);
1269+ return SGF.emitTransformedValue (loc, value, getSourceType (),
1270+ getResultType (), C);
12711271
12721272 case ForceOptional: {
12731273 auto &optTL = SGF.getTypeLowering (value.getType ());
@@ -1278,32 +1278,30 @@ ManagedValue Conversion::emit(SILGenFunction &SGF, SILLocation loc,
12781278
12791279 case BridgeToObjC:
12801280 return SGF.emitNativeToBridgedValue (loc, value,
1281- getBridgingSourceType (),
1282- getBridgingResultType (),
1283- getBridgingLoweredResultType (), C);
1281+ getSourceType (),
1282+ getResultType (),
1283+ getLoweredResultType (), C);
12841284
12851285 case ForceAndBridgeToObjC: {
12861286 auto &tl = SGF.getTypeLowering (value.getType ());
1287- auto sourceValueType = getBridgingSourceType ().getOptionalObjectType ();
1287+ auto sourceValueType = getSourceType ().getOptionalObjectType ();
12881288 value = SGF.emitCheckedGetOptionalValueFrom (loc, value,
12891289 /* isImplicitUnwrap*/ true ,
12901290 tl, SGFContext ());
12911291 return SGF.emitNativeToBridgedValue (loc, value, sourceValueType,
1292- getBridgingResultType (),
1293- getBridgingLoweredResultType (), C);
1292+ getResultType (),
1293+ getLoweredResultType (), C);
12941294 }
12951295
12961296 case BridgeFromObjC:
12971297 return SGF.emitBridgedToNativeValue (loc, value,
1298- getBridgingSourceType (),
1299- getBridgingResultType (),
1300- getBridgingLoweredResultType (), C);
1298+ getSourceType (), getResultType (),
1299+ getLoweredResultType (), C);
13011300
13021301 case BridgeResultFromObjC:
13031302 return SGF.emitBridgedToNativeValue (loc, value,
1304- getBridgingSourceType (),
1305- getBridgingResultType (),
1306- getBridgingLoweredResultType (), C,
1303+ getSourceType (), getResultType (),
1304+ getLoweredResultType (), C,
13071305 /* isResult*/ true );
13081306
13091307 case Reabstract:
@@ -1336,9 +1334,9 @@ Conversion::adjustForInitialOptionalInjection() const {
13361334 case Subtype:
13371335 return OptionalInjectionConversion::forValue (
13381336 getSubtype (
1339- getBridgingSourceType ().getOptionalObjectType (),
1340- getBridgingResultType ().getOptionalObjectType (),
1341- getBridgingLoweredResultType ().getOptionalObjectType ())
1337+ getSourceType ().getOptionalObjectType (),
1338+ getResultType ().getOptionalObjectType (),
1339+ getLoweredResultType ().getOptionalObjectType ())
13421340 );
13431341
13441342 // TODO: can these actually happen?
@@ -1352,9 +1350,8 @@ Conversion::adjustForInitialOptionalInjection() const {
13521350 case BridgeFromObjC:
13531351 case BridgeResultFromObjC:
13541352 return OptionalInjectionConversion::forInjection (
1355- getBridging (getKind (), getBridgingSourceType ().getOptionalObjectType (),
1356- getBridgingResultType (),
1357- getBridgingLoweredResultType (),
1353+ getBridging (getKind (), getSourceType ().getOptionalObjectType (),
1354+ getResultType (), getLoweredResultType (),
13581355 isBridgingExplicit ())
13591356 );
13601357 }
@@ -1379,8 +1376,7 @@ Conversion::adjustForInitialOptionalConversions(CanType newSourceType) const {
13791376 case BridgeFromObjC:
13801377 case BridgeResultFromObjC:
13811378 return Conversion::getBridging (getKind (), newSourceType,
1382- getBridgingResultType (),
1383- getBridgingLoweredResultType (),
1379+ getResultType (), getLoweredResultType (),
13841380 isBridgingExplicit ());
13851381 }
13861382 llvm_unreachable (" bad kind" );
@@ -1399,12 +1395,10 @@ std::optional<Conversion> Conversion::adjustForInitialForceValue() const {
13991395 return std::nullopt ;
14001396
14011397 case BridgeToObjC: {
1402- auto sourceOptType =
1403- OptionalType::get (getBridgingSourceType ())->getCanonicalType ();
1398+ auto sourceOptType = getSourceType ().wrapInOptionalType ();
14041399 return Conversion::getBridging (ForceAndBridgeToObjC,
1405- sourceOptType,
1406- getBridgingResultType (),
1407- getBridgingLoweredResultType (),
1400+ sourceOptType, getResultType (),
1401+ getLoweredResultType (),
14081402 isBridgingExplicit ());
14091403 }
14101404 }
@@ -1436,9 +1430,9 @@ static void printReabstraction(const Conversion &conversion,
14361430static void printBridging (const Conversion &conversion, llvm::raw_ostream &out,
14371431 StringRef name) {
14381432 out << name << " (from: " ;
1439- conversion.getBridgingSourceType ().print (out);
1433+ conversion.getSourceType ().print (out);
14401434 out << " , to: " ;
1441- conversion.getBridgingResultType ().print (out);
1435+ conversion.getResultType ().print (out);
14421436 out << " , explicit: " << conversion.isBridgingExplicit () << ' )' ;
14431437}
14441438
@@ -1792,7 +1786,7 @@ combineSubtypeIntoReabstract(SILGenFunction &SGF,
17921786 if (!isCombinableConversion (inner, outer))
17931787 return salvageUncombinableConversion (SGF, inner, outer);
17941788
1795- auto inputSubstType = inner.getBridgingSourceType ();
1789+ auto inputSubstType = inner.getSourceType ();
17961790 auto inputOrigType = AbstractionPattern (inputSubstType);
17971791 auto inputLoweredTy = SGF.getLoweredType (inputOrigType, inputSubstType);
17981792
@@ -1812,9 +1806,8 @@ combineSubtype(SILGenFunction &SGF,
18121806 return salvageUncombinableConversion (SGF, inner, outer);
18131807
18141808 return CombinedConversions (
1815- Conversion::getSubtype (inner.getBridgingSourceType (),
1816- outer.getBridgingResultType (),
1817- outer.getBridgingLoweredResultType ())
1809+ Conversion::getSubtype (inner.getSourceType (), outer.getResultType (),
1810+ outer.getLoweredResultType ())
18181811 );
18191812}
18201813
@@ -1832,9 +1825,9 @@ combineBridging(SILGenFunction &SGF,
18321825 // Otherwise, we can peephole if we understand the resulting conversion
18331826 // and applying the peephole doesn't change semantics.
18341827
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 ());
18381831
18391832 // If we're doing a peephole involving a force, we want to propagate
18401833 // the force to the source value. If it's not in fact optional, that
@@ -1849,9 +1842,9 @@ combineBridging(SILGenFunction &SGF,
18491842 assert (intermediateType);
18501843 }
18511844
1852- CanType resultType = outer.getBridgingResultType ();
1845+ CanType resultType = outer.getResultType ();
18531846 SILType loweredSourceTy = SGF.getLoweredType (sourceType);
1854- SILType loweredResultTy = outer.getBridgingLoweredResultType ();
1847+ SILType loweredResultTy = outer.getLoweredResultType ();
18551848
18561849 auto applyPeephole = [&](const std::optional<Conversion> &conversion) {
18571850 if (!forced) {
@@ -1862,7 +1855,7 @@ combineBridging(SILGenFunction &SGF,
18621855
18631856 auto forceConversion =
18641857 Conversion::getBridging (Conversion::ForceOptional,
1865- inner.getBridgingSourceType (), sourceType,
1858+ inner.getSourceType (), sourceType,
18661859 loweredSourceTy);
18671860 if (conversion)
18681861 return CombinedConversions (forceConversion, *conversion);
0 commit comments