@@ -218,7 +218,7 @@ static ManagedValue borrowedCastToOriginalSelfType(SILGenFunction &SGF,
218
218
if (originalSelfType.is <AnyMetatypeType>()) {
219
219
assert (originalSelfType.isTrivial (SGF.F ) &&
220
220
" Metatypes should always be trivial" );
221
- return ManagedValue::forUnmanaged (originalSelf);
221
+ return ManagedValue::forObjectRValueWithoutOwnership (originalSelf);
222
222
}
223
223
224
224
// Otherwise, we have a non-metatype. Use a borrow+unchecked_ref_cast.
@@ -629,14 +629,14 @@ class Callee {
629
629
auto constantInfo =
630
630
SGF.getConstantInfo (SGF.getTypeExpansionContext (), *constant);
631
631
SILValue ref = SGF.emitGlobalFunctionRef (Loc, *constant, constantInfo);
632
- return ManagedValue::forUnmanaged (ref);
632
+ return ManagedValue::forObjectRValueWithoutOwnership (ref);
633
633
}
634
634
case Kind::StandaloneFunctionDynamicallyReplaceableImpl: {
635
635
auto constantInfo =
636
636
SGF.getConstantInfo (SGF.getTypeExpansionContext (), *constant);
637
637
SILValue ref =
638
638
SGF.emitGlobalFunctionRef (Loc, *constant, constantInfo, true );
639
- return ManagedValue::forUnmanaged (ref);
639
+ return ManagedValue::forObjectRValueWithoutOwnership (ref);
640
640
}
641
641
case Kind::ClassMethod: {
642
642
auto methodTy = SGF.SGM .Types .getConstantOverrideType (
@@ -655,7 +655,7 @@ class Callee {
655
655
SILType::getPrimitiveObjectType (methodTy));
656
656
}
657
657
S.pop ();
658
- return ManagedValue::forUnmanaged (methodVal);
658
+ return ManagedValue::forObjectRValueWithoutOwnership (methodVal);
659
659
}
660
660
case Kind::SuperMethod: {
661
661
ArgumentScope S (SGF, Loc);
@@ -709,7 +709,7 @@ class Callee {
709
709
*constant, constantInfo.getSILType ());
710
710
}
711
711
S.pop ();
712
- return ManagedValue::forUnmanaged (fn);
712
+ return ManagedValue::forObjectRValueWithoutOwnership (fn);
713
713
}
714
714
case Kind::DynamicMethod: {
715
715
auto closureType = getDynamicMethodLoweredType (
@@ -720,7 +720,7 @@ class Callee {
720
720
Loc, borrowedSelf->getValue (), *constant,
721
721
closureType);
722
722
S.pop ();
723
- return ManagedValue::forUnmanaged (fn);
723
+ return ManagedValue::forObjectRValueWithoutOwnership (fn);
724
724
}
725
725
}
726
726
llvm_unreachable (" unhandled kind" );
@@ -1010,7 +1010,7 @@ class SILGenApply : public Lowering::ExprVisitor<SILGenApply> {
1010
1010
llvm_unreachable (" shouldn't happen" );
1011
1011
}
1012
1012
1013
- auto result = ManagedValue::forUnmanaged (convertedValue);
1013
+ auto result = ManagedValue::forObjectRValueWithoutOwnership (convertedValue);
1014
1014
return {result, SGF.getLoweredType (instanceType)};
1015
1015
}
1016
1016
@@ -1550,9 +1550,12 @@ class SILGenApply : public Lowering::ExprVisitor<SILGenApply> {
1550
1550
self = SGF.emitUndef (selfFormalType);
1551
1551
} else if (SGF.AllocatorMetatype ) {
1552
1552
self = emitCorrespondingSelfValue (
1553
- ManagedValue::forUnmanaged (SGF.AllocatorMetatype ), arg);
1553
+ ManagedValue::forObjectRValueWithoutOwnership (
1554
+ SGF.AllocatorMetatype ),
1555
+ arg);
1554
1556
} else {
1555
- self = ManagedValue::forUnmanaged (SGF.emitMetatypeOfValue (expr, arg));
1557
+ self = ManagedValue::forObjectRValueWithoutOwnership (
1558
+ SGF.emitMetatypeOfValue (expr, arg));
1556
1559
}
1557
1560
} else {
1558
1561
// If we haven't allocated "self" yet at this point, do so.
@@ -1565,10 +1568,10 @@ class SILGenApply : public Lowering::ExprVisitor<SILGenApply> {
1565
1568
// initializer is @objc.
1566
1569
usesObjCAllocation = true ;
1567
1570
}
1568
-
1569
- self = allocateObject (
1570
- ManagedValue::forUnmanaged ( SGF.AllocatorMetatype ), arg ,
1571
- usesObjCAllocation);
1571
+
1572
+ self = allocateObject (ManagedValue::forObjectRValueWithoutOwnership (
1573
+ SGF.AllocatorMetatype ),
1574
+ arg, usesObjCAllocation);
1572
1575
1573
1576
// Perform any adjustments needed to 'self'.
1574
1577
self = emitCorrespondingSelfValue (self, arg);
@@ -1819,7 +1822,8 @@ static PreparedArguments emitStringLiteralArgs(SILGenFunction &SGF, SILLocation
1819
1822
AnyFunctionType::Param param (Int32Ty.getASTType ());
1820
1823
PreparedArguments args (llvm::ArrayRef<AnyFunctionType::Param>{param});
1821
1824
args.add (E, RValue (SGF, E, Int32Ty.getASTType (),
1822
- ManagedValue::forUnmanaged (UnicodeScalarValue )));
1825
+ ManagedValue::forObjectRValueWithoutOwnership (
1826
+ UnicodeScalarValue )));
1823
1827
return args;
1824
1828
}
1825
1829
}
@@ -1836,10 +1840,9 @@ static PreparedArguments emitStringLiteralArgs(SILGenFunction &SGF, SILLocation
1836
1840
auto *isASCIIInst = SGF.B .createIntegerLiteral (E, Int1Ty, isASCII);
1837
1841
1838
1842
ManagedValue EltsArray[] = {
1839
- ManagedValue::forUnmanaged (string),
1840
- ManagedValue::forUnmanaged (lengthInst),
1841
- ManagedValue::forUnmanaged (isASCIIInst)
1842
- };
1843
+ ManagedValue::forObjectRValueWithoutOwnership (string),
1844
+ ManagedValue::forObjectRValueWithoutOwnership (lengthInst),
1845
+ ManagedValue::forObjectRValueWithoutOwnership (isASCIIInst)};
1843
1846
1844
1847
AnyFunctionType::Param TypeEltsArray[] = {
1845
1848
AnyFunctionType::Param (EltsArray[0 ].getType ().getASTType ()),
@@ -2043,7 +2046,8 @@ buildBuiltinLiteralArgs(SILGenFunction &SGF, SGFContext C,
2043
2046
auto i1Ty = SILType::getBuiltinIntegerType (1 , SGF.getASTContext ());
2044
2047
SILValue boolValue = SGF.B .createIntegerLiteral (booleanLiteral, i1Ty,
2045
2048
booleanLiteral->getValue ());
2046
- ManagedValue boolManaged = ManagedValue::forUnmanaged (boolValue);
2049
+ ManagedValue boolManaged =
2050
+ ManagedValue::forObjectRValueWithoutOwnership (boolValue);
2047
2051
CanType ty = boolManaged.getType ().getASTType ()->getCanonicalType ();
2048
2052
builtinLiteralArgs.emplace (AnyFunctionType::Param (ty));
2049
2053
builtinLiteralArgs.add (booleanLiteral, RValue (SGF, {boolManaged}, ty));
@@ -2055,7 +2059,7 @@ buildBuiltinLiteralArgs(SILGenFunction &SGF, SGFContext C,
2055
2059
IntegerLiteralExpr *integerLiteral) {
2056
2060
PreparedArguments builtinLiteralArgs;
2057
2061
ManagedValue integerManaged =
2058
- ManagedValue::forUnmanaged (SGF.B .createIntegerLiteral (
2062
+ ManagedValue::forObjectRValueWithoutOwnership (SGF.B .createIntegerLiteral (
2059
2063
integerLiteral,
2060
2064
SILType::getBuiltinIntegerLiteralType (SGF.getASTContext ()),
2061
2065
integerLiteral->getRawValue ()));
@@ -2071,7 +2075,7 @@ buildBuiltinLiteralArgs(SILGenFunction &SGF, SGFContext C,
2071
2075
PreparedArguments builtinLiteralArgs;
2072
2076
auto *litTy = floatLiteral->getBuiltinType ()->castTo <BuiltinFloatType>();
2073
2077
ManagedValue floatManaged =
2074
- ManagedValue::forUnmanaged (SGF.B .createFloatLiteral (
2078
+ ManagedValue::forObjectRValueWithoutOwnership (SGF.B .createFloatLiteral (
2075
2079
floatLiteral,
2076
2080
SILType::getBuiltinFloatType (litTy->getFPKind (), SGF.getASTContext ()),
2077
2081
floatLiteral->getValue ()));
@@ -2100,7 +2104,7 @@ buildBuiltinLiteralArgs(SILGenFunction &SGF, SGFContext C,
2100
2104
// The version of the regex string.
2101
2105
// %3 = integer_literal $Builtin.IntLiteral <version>
2102
2106
auto versionIntLiteral =
2103
- ManagedValue::forUnmanaged (SGF.B .createIntegerLiteral (
2107
+ ManagedValue::forObjectRValueWithoutOwnership (SGF.B .createIntegerLiteral (
2104
2108
expr, SILType::getBuiltinIntegerLiteralType (SGF.getASTContext ()),
2105
2109
expr->getVersion ()));
2106
2110
@@ -2187,7 +2191,8 @@ buildBuiltinLiteralArgs(SILGenFunction &SGF, SGFContext C,
2187
2191
auto silTy = SILType::getBuiltinIntegerLiteralType (ctx);
2188
2192
auto ty = silTy.getASTType ();
2189
2193
SILValue integer = SGF.B .createIntegerLiteral (magicLiteral, silTy, Value);
2190
- ManagedValue integerManaged = ManagedValue::forUnmanaged (integer);
2194
+ ManagedValue integerManaged =
2195
+ ManagedValue::forObjectRValueWithoutOwnership (integer);
2191
2196
PreparedArguments builtinLiteralArgs;
2192
2197
builtinLiteralArgs.emplace (AnyFunctionType::Param (ty));
2193
2198
builtinLiteralArgs.add (magicLiteral, RValue (SGF, {integerManaged}, ty));
@@ -6090,7 +6095,7 @@ RValue SILGenFunction::emitApplyAllocatingInitializer(SILLocation loc,
6090
6095
if (selfMetaTy != selfParamMetaTy)
6091
6096
selfMeta = B.createUpcast (loc, selfMeta, selfParamMetaTy);
6092
6097
6093
- selfMetaVal = ManagedValue::forUnmanaged (selfMeta);
6098
+ selfMetaVal = ManagedValue::forObjectRValueWithoutOwnership (selfMeta);
6094
6099
}
6095
6100
6096
6101
// Form the callee.
@@ -6221,10 +6226,9 @@ SILGenFunction::emitUninitializedArrayAllocation(Type ArrayTy,
6221
6226
// Invoke the intrinsic, which returns a tuple.
6222
6227
auto subMap = ArrayTy->getContextSubstitutionMap (SGM.M .getSwiftModule (),
6223
6228
Ctx.getArrayDecl ());
6224
- auto result = emitApplyOfLibraryIntrinsic (Loc, allocate,
6225
- subMap,
6226
- ManagedValue::forUnmanaged (Length),
6227
- SGFContext ());
6229
+ auto result = emitApplyOfLibraryIntrinsic (
6230
+ Loc, allocate, subMap,
6231
+ ManagedValue::forObjectRValueWithoutOwnership (Length), SGFContext ());
6228
6232
6229
6233
// Explode the tuple.
6230
6234
SmallVector<ManagedValue, 2 > resultElts;
@@ -6935,7 +6939,7 @@ ManagedValue SILGenFunction::emitAsyncLetStart(
6935
6939
getLoweredType (ctx.TheRawPointerType ), subs,
6936
6940
{taskOptions, taskFunction.getValue (), resultBuf});
6937
6941
6938
- return ManagedValue::forUnmanaged (apply);
6942
+ return ManagedValue::forObjectRValueWithoutOwnership (apply);
6939
6943
}
6940
6944
6941
6945
ManagedValue SILGenFunction::emitCancelAsyncTask (
@@ -6946,7 +6950,7 @@ ManagedValue SILGenFunction::emitCancelAsyncTask(
6946
6950
ctx.getIdentifier (getBuiltinName (BuiltinValueKind::CancelAsyncTask)),
6947
6951
getLoweredType (ctx.TheEmptyTupleType ), SubstitutionMap (),
6948
6952
{ task });
6949
- return ManagedValue::forUnmanaged (apply);
6953
+ return ManagedValue::forObjectRValueWithoutOwnership (apply);
6950
6954
}
6951
6955
6952
6956
ManagedValue SILGenFunction::emitReadAsyncLetBinding (SILLocation loc,
0 commit comments