Create two versions (for caller and callee) of the functions that answer questions about parameter convention (#74124)

Create two versions of the following functions:

isConsumedParameter
isGuaranteedParameter
SILParameterInfo::isConsumed
SILParameterInfo::isGuaranteed
SILArgumentConvention::isOwnedConvention
SILArgumentConvention::isGuaranteedConvention

These changes will be needed when we add a new convention for
non-trivial C++ types as the functions will return different answers
depending on whether they are called for the caller or the callee. This
commit doesn't change any functionality.
This commit is contained in:
Akira Hatanaka
2024-06-18 09:06:09 -07:00
committed by GitHub
parent 13bf2ec540
commit d92f181ace
35 changed files with 136 additions and 90 deletions

View File

@@ -1269,12 +1269,12 @@ void DeclAndTypeClangFunctionPrinter::printCxxThunkBody(
signature.visitParameterList(
[&](const LoweredFunctionSignature::IndirectResultValue &) {},
[&](const LoweredFunctionSignature::DirectParameter &param) {
if (isConsumedParameter(param.getConvention()))
if (isConsumedParameterInCaller(param.getConvention()))
emitParamCopyForConsume(param.getParamDecl());
++paramIndex;
},
[&](const LoweredFunctionSignature::IndirectParameter &param) {
if (isConsumedParameter(param.getConvention()))
if (isConsumedParameterInCaller(param.getConvention()))
emitParamCopyForConsume(param.getParamDecl());
++paramIndex;
},
@@ -1338,12 +1338,12 @@ void DeclAndTypeClangFunctionPrinter::printCxxThunkBody(
},
[&](const LoweredFunctionSignature::DirectParameter &param) {
printParamUse(param.getParamDecl(), /*isIndirect=*/false,
isConsumedParameter(param.getConvention()),
isConsumedParameterInCaller(param.getConvention()),
encodeTypeInfo(param, moduleContext, typeMapping));
},
[&](const LoweredFunctionSignature::IndirectParameter &param) {
printParamUse(param.getParamDecl(), /*isIndirect=*/true,
isConsumedParameter(param.getConvention()),
isConsumedParameterInCaller(param.getConvention()),
/*directTypeEncoding=*/"");
},
[&](const LoweredFunctionSignature::GenericRequirementParameter