Skip to content

Commit 4d02520

Browse files
committed
Send delete notifications when basic block arguments are being erased.
1 parent 408d205 commit 4d02520

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

include/swift/SIL/SILBasicBlock.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public llvm::ilist_node<SILBasicBlock>, public SILAllocated<SILBasicBlock> {
167167
SILArgument *replaceBBArg(unsigned i, SILType Ty, const ValueDecl *D=nullptr);
168168

169169
/// Erase a specific argument from the arg list.
170-
void eraseBBArg(int Index) { BBArgList.erase(BBArgList.begin() + Index); }
170+
void eraseBBArg(int Index);
171171

172172
/// Allocate a new argument of type \p Ty and append it to the argument
173173
/// list. Optionally you can pass in a value decl parameter.

lib/SIL/SILBasicBlock.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,12 @@ SILArgument *SILBasicBlock::insertBBArg(bbarg_iterator Iter, SILType Ty,
118118
return new (getModule()) SILArgument(this, Iter, Ty, D);
119119
}
120120

121+
void SILBasicBlock::eraseBBArg(int Index) {
122+
// Notify the delete handlers that this BB argument is going away.
123+
getModule().notifyDeleteHandlers(getBBArg(Index));
124+
BBArgList.erase(BBArgList.begin() + Index);
125+
}
126+
121127
/// \brief Splits a basic block into two at the specified instruction.
122128
///
123129
/// Note that all the instructions BEFORE the specified iterator

0 commit comments

Comments
 (0)