mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Fix several incorrect uses of ApplySite::getArgumentConvention.
At least most of these were latent bugs since the code was unreachable in the PartialApply case. But that's no excuse to misuse the API. Also, whenever referring to an integer index, be explicit about whether it is an applied argument or callee argument.
This commit is contained in:
@@ -1936,11 +1936,6 @@ public:
|
||||
return OperandValueArrayRef(opsWithoutSelf);
|
||||
}
|
||||
|
||||
/// Return the SILArgumentConvention for the given applied argument index.
|
||||
SILArgumentConvention getArgumentConvention(unsigned index) const {
|
||||
return getSubstCalleeConv().getSILArgumentConvention(index);
|
||||
}
|
||||
|
||||
Optional<SILResultInfo> getSingleResult() const {
|
||||
auto SubstCallee = getSubstCalleeType();
|
||||
if (SubstCallee->getNumAllResults() != 1)
|
||||
@@ -7665,7 +7660,7 @@ public:
|
||||
}
|
||||
|
||||
/// Return the applied argument index for the given operand.
|
||||
unsigned getArgumentIndex(const Operand &oper) const {
|
||||
unsigned getAppliedArgIndex(const Operand &oper) const {
|
||||
assert(oper.getUser() == Inst);
|
||||
assert(isArgumentOperand(oper));
|
||||
|
||||
@@ -7704,21 +7699,16 @@ public:
|
||||
/// Note: Passing an applied argument index into SILFunctionConvention, as
|
||||
/// opposed to a function argument index, is incorrect.
|
||||
unsigned getCalleeArgIndex(const Operand &oper) const {
|
||||
return getCalleeArgIndexOfFirstAppliedArg() + getArgumentIndex(oper);
|
||||
return getCalleeArgIndexOfFirstAppliedArg() + getAppliedArgIndex(oper);
|
||||
}
|
||||
|
||||
/// Return the SILArgumentConvention for the given applied argument operand.
|
||||
SILArgumentConvention getArgumentConvention(Operand &oper) const {
|
||||
unsigned calleeArgIdx =
|
||||
getCalleeArgIndexOfFirstAppliedArg() + getArgumentIndex(oper);
|
||||
getCalleeArgIndexOfFirstAppliedArg() + getAppliedArgIndex(oper);
|
||||
return getSubstCalleeConv().getSILArgumentConvention(calleeArgIdx);
|
||||
}
|
||||
|
||||
// FIXME: This is incorrect. It will be removed in the next commit.
|
||||
SILArgumentConvention getArgumentConvention(unsigned index) const {
|
||||
return getSubstCalleeConv().getSILArgumentConvention(index);
|
||||
}
|
||||
|
||||
/// Return true if 'self' is an applied argument.
|
||||
bool hasSelfArgument() const {
|
||||
switch (Inst->getKind()) {
|
||||
|
||||
Reference in New Issue
Block a user