Skip to content

Commit bcf02f7

Browse files
committed
Ensure that we account for indirect error results in SILFunction/SILInstruction
These were only properly handling SIL-level indirect results, not including indirect error results.
1 parent 1a2f521 commit bcf02f7

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

include/swift/SIL/SILFunction.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1455,7 +1455,8 @@ class SILFunction
14551455
ArrayRef<SILArgument *> getArgumentsWithoutIndirectResults() const {
14561456
assert(!empty() && "Cannot get arguments of a function without a body");
14571457
return begin()->getArguments().slice(
1458-
getConventions().getNumIndirectSILResults());
1458+
getConventions().getNumIndirectSILResults() +
1459+
getConventions().getNumIndirectSILErrorResults());
14591460
}
14601461

14611462
const SILArgument *getSelfArgument() const {

include/swift/SIL/SILInstruction.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2902,7 +2902,9 @@ class ApplyInstBase<Impl, Base, true>
29022902
return getSubstCalleeConv().hasIndirectSILResults();
29032903
}
29042904
unsigned getNumIndirectResults() const {
2905-
return getSubstCalleeConv().getNumIndirectSILResults();
2905+
auto fnConv = getSubstCalleeConv();
2906+
return fnConv.getNumIndirectSILResults() +
2907+
fnConv.getNumIndirectSILErrorResults();
29062908
}
29072909

29082910
bool hasSelfArgument() const {

0 commit comments

Comments
 (0)