mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[silgen] Use Builtin.ImplicitActor instead of Optional<any Actor> to represent the implicit isolated parameter.
NOTE: We are not performing any bitmasking at all now. This is so that we can transition the code base/tests to expect Builtin.ImplicitActor instead of Optional<any Actor>. NOTE: The actual test changes are in the next commit. I did this to make it easier to review the changes. This should not have any user visible changes.
This commit is contained in:
@@ -1248,3 +1248,16 @@ ManagedValue SILGenBuilder::borrowObjectRValue(SILGenFunction &SGF,
|
||||
}
|
||||
return SGF.emitFormalEvaluationManagedBeginBorrow(loc, value);
|
||||
}
|
||||
|
||||
SILValue SILGenBuilder::convertToImplicitActor(SILLocation loc,
|
||||
SILValue value) {
|
||||
auto type = SILType::getBuiltinImplicitActorType(getASTContext());
|
||||
if (value->getType() == type)
|
||||
return value;
|
||||
assert(value->getType() == SILType::getOpaqueIsolationType(getASTContext()) &&
|
||||
"Can only convert Optional<any Actor> to "
|
||||
"Builtin.ImplicitActor");
|
||||
if (value->getOwnershipKind() != OwnershipKind::Guaranteed)
|
||||
value = SGF.emitManagedBeginBorrow(loc, value).getValue();
|
||||
return createUncheckedValueCast(loc, value, type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user