Skip to content

Commit 6f766c4

Browse files
eecksteinando-huang
authored andcommitted
Swift SIL: add Instruction.isDeleted API
1 parent 70405a6 commit 6f766c4

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

SwiftCompilerSources/Sources/SIL/Instruction.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ public class Instruction : ListNode, CustomStringConvertible, Hashable {
4242
return String(_cxxString: stdString)
4343
}
4444

45+
final public var isDeleted: Bool {
46+
return SILInstruction_isDeleted(bridged)
47+
}
48+
4549
final public var operands: OperandArray {
4650
return OperandArray(opArray: SILInstruction_getOperands(bridged))
4751
}

include/swift/SIL/SILBridging.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ BridgedArgumentConvention SILArgument_getConvention(BridgedArgument argument);
340340
OptionalBridgedInstruction SILInstruction_next(BridgedInstruction inst);
341341
OptionalBridgedInstruction SILInstruction_previous(BridgedInstruction inst);
342342
BridgedBasicBlock SILInstruction_getParent(BridgedInstruction inst);
343+
bool SILInstruction_isDeleted(BridgedInstruction inst);
343344
BridgedArrayRef SILInstruction_getOperands(BridgedInstruction inst);
344345
void SILInstruction_setOperand(BridgedInstruction inst, SwiftInt index,
345346
BridgedValue value);

lib/SIL/Utils/SILBridging.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -743,6 +743,10 @@ BridgedBasicBlock SILInstruction_getParent(BridgedInstruction inst) {
743743
return {i->getParent()};
744744
}
745745

746+
bool SILInstruction_isDeleted(BridgedInstruction inst) {
747+
return castToInst(inst)->isDeleted();
748+
}
749+
746750
BridgedArrayRef SILInstruction_getOperands(BridgedInstruction inst) {
747751
auto operands = castToInst(inst)->getAllOperands();
748752
return {(const unsigned char *)operands.data(), operands.size()};

0 commit comments

Comments
 (0)