[transferring] Add mangling support for transferring.

This includes runtime support for instantiating transferring param/result in
function types. This is especially important since that is how we instantiate
function types like: typealias Fn = (transferring X) -> ().

rdar://123118061
This commit is contained in:
Michael Gottesman
2024-02-16 13:54:56 -08:00
parent d35dcc8f9c
commit f4efcec55c
18 changed files with 302 additions and 31 deletions

View File

@@ -1379,11 +1379,12 @@ static llvm::Value *getFunctionParameterRef(IRGenFunction &IGF,
/// Mapping type-level parameter flags to ABI parameter flags.
ParameterFlags irgen::getABIParameterFlags(ParameterTypeFlags flags) {
return ParameterFlags()
.withValueOwnership(flags.getValueOwnership())
.withVariadic(flags.isVariadic())
.withAutoClosure(flags.isAutoClosure())
.withNoDerivative(flags.isNoDerivative())
.withIsolated(flags.isIsolated());
.withValueOwnership(flags.getValueOwnership())
.withVariadic(flags.isVariadic())
.withAutoClosure(flags.isAutoClosure())
.withNoDerivative(flags.isNoDerivative())
.withIsolated(flags.isIsolated())
.withTransferring(flags.isTransferring());
}
static std::pair<FunctionTypeFlags, ExtendedFunctionTypeFlags>
@@ -1416,8 +1417,9 @@ getFunctionTypeFlags(CanFunctionType type) {
}
auto extFlags = ExtendedFunctionTypeFlags()
.withTypedThrows(!type->getThrownError().isNull());
.withTypedThrows(!type->getThrownError().isNull())
.withTransferringResult(type->hasTransferringResult());
auto flags = FunctionTypeFlags()
.withConvention(metadataConvention)
.withAsync(type->isAsync())