File tree Expand file tree Collapse file tree 2 files changed +28
-19
lines changed Expand file tree Collapse file tree 2 files changed +28
-19
lines changed Original file line number Diff line number Diff line change @@ -261,25 +261,7 @@ struct BorrowScopeOperand {
261
261
return BorrowScopeOperand (*kind, op);
262
262
}
263
263
264
- void visitEndScopeInstructions (function_ref<void (Operand *)> func) const {
265
- switch (kind) {
266
- case BorrowScopeOperandKind::BeginBorrow:
267
- for (auto *use : cast<BeginBorrowInst>(op->getUser ())->getUses ()) {
268
- if (isa<EndBorrowInst>(use->getUser ())) {
269
- func (use);
270
- }
271
- }
272
- return ;
273
- case BorrowScopeOperandKind::BeginApply: {
274
- auto *user = cast<BeginApplyInst>(op->getUser ());
275
- for (auto *use : user->getTokenResult ()->getUses ()) {
276
- func (use);
277
- }
278
- return ;
279
- }
280
- }
281
- llvm_unreachable (" Covered switch isn't covered" );
282
- }
264
+ void visitEndScopeInstructions (function_ref<void (Operand *)> func) const ;
283
265
284
266
void print (llvm::raw_ostream &os) const ;
285
267
SWIFT_DEBUG_DUMP { print (llvm::dbgs ()); }
Original file line number Diff line number Diff line change @@ -122,6 +122,27 @@ llvm::raw_ostream &swift::operator<<(llvm::raw_ostream &os,
122
122
return os;
123
123
}
124
124
125
+ void BorrowScopeOperand::visitEndScopeInstructions (
126
+ function_ref<void (Operand *)> func) const {
127
+ switch (kind) {
128
+ case BorrowScopeOperandKind::BeginBorrow:
129
+ for (auto *use : cast<BeginBorrowInst>(op->getUser ())->getUses ()) {
130
+ if (isa<EndBorrowInst>(use->getUser ())) {
131
+ func (use);
132
+ }
133
+ }
134
+ return ;
135
+ case BorrowScopeOperandKind::BeginApply: {
136
+ auto *user = cast<BeginApplyInst>(op->getUser ());
137
+ for (auto *use : user->getTokenResult ()->getUses ()) {
138
+ func (use);
139
+ }
140
+ return ;
141
+ }
142
+ }
143
+ llvm_unreachable (" Covered switch isn't covered" );
144
+ }
145
+
125
146
// ===----------------------------------------------------------------------===//
126
147
// Borrow Introducers
127
148
// ===----------------------------------------------------------------------===//
@@ -141,6 +162,12 @@ void BorrowScopeIntroducingValueKind::print(llvm::raw_ostream &os) const {
141
162
llvm_unreachable (" Covered switch isn't covered?!" );
142
163
}
143
164
165
+ void BorrowScopeIntroducingValue::print (llvm::raw_ostream &os) const {
166
+ os << " BorrowScopeIntroducingValue:\n "
167
+ " Kind: " << kind << " \n "
168
+ " Value: " << value;
169
+ }
170
+
144
171
void BorrowScopeIntroducingValue::getLocalScopeEndingInstructions (
145
172
SmallVectorImpl<SILInstruction *> &scopeEndingInsts) const {
146
173
assert (isLocalScope () && " Should only call this given a local scope" );
You can’t perform that action at this time.
0 commit comments