File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -186,7 +186,15 @@ struct Arguments {
186
186
}
187
187
Operand *takeOperand () { return takeInstance<OperandArgument>(" operand" ); }
188
188
SILInstruction *takeInstruction () {
189
- return takeInstance<InstructionArgument>(" instruction" );
189
+ auto argument = takeArgument ();
190
+ if (isa<ValueArgument>(argument)) {
191
+ auto value = cast<ValueArgument>(argument).getValue ();
192
+ auto *definingInstruction = value.getDefiningInstruction ();
193
+ assert (definingInstruction &&
194
+ " selected instruction via argument value!?" );
195
+ return definingInstruction;
196
+ }
197
+ return getInstance<InstructionArgument>(" instruction" , argument);
190
198
}
191
199
SILArgument *takeBlockArgument () {
192
200
return takeInstance<BlockArgumentArgument>(" block argument" );
You can’t perform that action at this time.
0 commit comments