Skip to content

Commit a63f35e

Browse files
committed
Swift SIL: add Instruction.isDeleted API
1 parent 37ab012 commit a63f35e

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
@@ -341,6 +341,7 @@ BridgedArgumentConvention SILArgument_getConvention(BridgedArgument argument);
341341
OptionalBridgedInstruction SILInstruction_next(BridgedInstruction inst);
342342
OptionalBridgedInstruction SILInstruction_previous(BridgedInstruction inst);
343343
BridgedBasicBlock SILInstruction_getParent(BridgedInstruction inst);
344+
bool SILInstruction_isDeleted(BridgedInstruction inst);
344345
BridgedArrayRef SILInstruction_getOperands(BridgedInstruction inst);
345346
void SILInstruction_setOperand(BridgedInstruction inst, SwiftInt index,
346347
BridgedValue value);

lib/SIL/Utils/SILBridging.cpp

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

750+
bool SILInstruction_isDeleted(BridgedInstruction inst) {
751+
return castToInst(inst)->isDeleted();
752+
}
753+
750754
BridgedArrayRef SILInstruction_getOperands(BridgedInstruction inst) {
751755
auto operands = castToInst(inst)->getAllOperands();
752756
return {(const unsigned char *)operands.data(), operands.size()};

0 commit comments

Comments
 (0)