@@ -2877,20 +2877,30 @@ class ApplyInstBase<Impl, Base, true>
2877
2877
void setSelfArgument (SILValue V) {
2878
2878
assert (hasSelfArgument () && " Must have a self argument" );
2879
2879
assert (getNumArguments () && " Should only be called when Callee has "
2880
- " arguments." );
2880
+ " arguments." );
2881
2881
getArgumentOperands ()[getNumArguments () - 1 ].set (V);
2882
2882
}
2883
2883
2884
2884
OperandValueArrayRef getArgumentsWithoutSelf () const {
2885
- assert (hasSelfArgument () && " Must have a self argument" );
2886
2885
assert (getNumArguments () && " Should only be called when Callee has "
2887
- " at least a self parameter." );
2886
+ " at least a self parameter." );
2888
2887
ArrayRef<Operand> ops = this ->getArgumentOperands ();
2889
- ArrayRef<Operand> opsWithoutSelf = ArrayRef<Operand>(&ops[0 ],
2890
- ops.size ()-1 );
2888
+ if (!hasSelfArgument ())
2889
+ return ops;
2890
+ auto opsWithoutSelf = ArrayRef<Operand>(&ops[0 ], ops.size () - 1 );
2891
2891
return OperandValueArrayRef (opsWithoutSelf);
2892
2892
}
2893
2893
2894
+ ArrayRef<Operand> getOperandsWithoutSelf () const {
2895
+ assert (getNumArguments () && " Should only be called when Callee has "
2896
+ " at least a self parameter." );
2897
+ ArrayRef<Operand> ops = this ->getArgumentOperands ();
2898
+ if (!hasSelfArgument ())
2899
+ return ops;
2900
+ auto opsWithoutSelf = ArrayRef<Operand>(&ops[0 ], ops.size () - 1 );
2901
+ return opsWithoutSelf;
2902
+ }
2903
+
2894
2904
llvm::Optional<SILResultInfo> getSingleResult () const {
2895
2905
auto SubstCallee = getSubstCalleeType ();
2896
2906
if (SubstCallee->getNumResults () != 1 )
0 commit comments