Skip to content

Commit 906763f

Browse files
committed
[silgen] Add a SILGenFunction & argument to Cleanup::dump().
This enables LValueWritebackCleanup and a future version of EndBorrowCleanup to dump their values which have to be looked up from SILGenFunction.
1 parent 9747214 commit 906763f

File tree

8 files changed

+18
-17
lines changed

8 files changed

+18
-17
lines changed

lib/SILGen/Cleanup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ void CleanupManager::dump() const {
257257
auto iter = Stack.find(begin);
258258
const Cleanup &stackCleanup = *iter;
259259
llvm::errs() << "CLEANUP DEPTH: " << begin.getDepth() << "\n";
260-
stackCleanup.dump();
260+
stackCleanup.dump(Gen);
261261
begin = Stack.stabilize(++iter);
262262
Stack.checkIterator(begin);
263263
}

lib/SILGen/Cleanup.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ class LLVM_LIBRARY_VISIBILITY Cleanup {
7373
bool isActive() const { return state >= CleanupState::Active; }
7474
bool isDead() const { return state == CleanupState::Dead; }
7575

76-
virtual void emit(SILGenFunction &Gen, CleanupLocation L) = 0;
77-
virtual void dump() const = 0;
76+
virtual void emit(SILGenFunction &gen, CleanupLocation L) = 0;
77+
virtual void dump(SILGenFunction &gen) const = 0;
7878
};
7979

8080
/// A cleanup depth is generally used to denote the set of cleanups

lib/SILGen/SILGenApply.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3831,7 +3831,7 @@ class DeallocateUninitializedBox : public Cleanup {
38313831
gen.B.createDeallocBox(l, box);
38323832
}
38333833

3834-
void dump() const override {
3834+
void dump(SILGenFunction &gen) const override {
38353835
#ifndef NDEBUG
38363836
llvm::errs() << "DeallocateUninitializedBox "
38373837
<< "State:" << getState() << " "
@@ -4958,7 +4958,7 @@ namespace {
49584958
gen.emitUninitializedArrayDeallocation(l, Array);
49594959
}
49604960

4961-
void dump() const override {
4961+
void dump(SILGenFunction &gen) const override {
49624962
#ifndef NDEBUG
49634963
llvm::errs() << "DeallocateUninitializedArray "
49644964
<< "State:" << getState() << " "

lib/SILGen/SILGenDecl.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ namespace {
120120
void emit(SILGenFunction &gen, CleanupLocation l) override {
121121
gen.B.emitDestroyValueOperation(l, closure);
122122
}
123-
void dump() const override {
123+
void dump(SILGenFunction &) const override {
124124
#ifndef NDEBUG
125125
llvm::errs() << "CleanupClosureConstant\n"
126126
<< "State:" << getState() << "\n"
@@ -222,7 +222,7 @@ class EndBorrowCleanup : public Cleanup {
222222
gen.B.createEndBorrow(l, borrowed, original);
223223
}
224224

225-
void dump() const override {
225+
void dump(SILGenFunction &) const override {
226226
#ifndef NDEBUG
227227
llvm::errs() << "EndBorrowCleanup "
228228
<< "State:" << getState() << "\n"
@@ -246,7 +246,7 @@ class ReleaseValueCleanup : public Cleanup {
246246
gen.B.emitDestroyValueOperation(l, v);
247247
}
248248

249-
void dump() const override {
249+
void dump(SILGenFunction &) const override {
250250
#ifndef NDEBUG
251251
llvm::errs() << "ReleaseValueCleanup\n"
252252
<< "State:" << getState() << "\n"
@@ -267,7 +267,7 @@ class DeallocStackCleanup : public Cleanup {
267267
gen.B.createDeallocStack(l, Addr);
268268
}
269269

270-
void dump() const override {
270+
void dump(SILGenFunction &) const override {
271271
#ifndef NDEBUG
272272
llvm::errs() << "DeallocStackCleanup\n"
273273
<< "State:" << getState() << "\n"
@@ -288,7 +288,7 @@ class DestroyLocalVariable : public Cleanup {
288288
gen.destroyLocalVariable(l, Var);
289289
}
290290

291-
void dump() const override {
291+
void dump(SILGenFunction &) const override {
292292
#ifndef NDEBUG
293293
llvm::errs() << "DestroyLocalVariable\n"
294294
<< "State:" << getState() << "\n";
@@ -310,7 +310,7 @@ class DeallocateUninitializedLocalVariable : public Cleanup {
310310
gen.deallocateUninitializedLocalVariable(l, Var);
311311
}
312312

313-
void dump() const override {
313+
void dump(SILGenFunction &) const override {
314314
#ifndef NDEBUG
315315
llvm::errs() << "DeallocateUninitializedLocalVariable\n"
316316
<< "State:" << getState() << "\n";
@@ -1247,7 +1247,7 @@ namespace {
12471247
}
12481248
}
12491249

1250-
void dump() const override {
1250+
void dump(SILGenFunction &) const override {
12511251
#ifndef NDEBUG
12521252
llvm::errs() << "DeinitExistentialCleanup\n"
12531253
<< "State:" << getState() << "\n"

lib/SILGen/SILGenLValue.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct LValueWritebackCleanup : Cleanup {
5050
lvalue.performWriteback(gen, /*isFinal*/ false);
5151
}
5252

53-
void dump() const override {
53+
void dump(SILGenFunction &) const override {
5454
#ifndef NDEBUG
5555
llvm::errs() << "LValueWritebackCleanup\n"
5656
<< "State: " << getState() << "Depth: " << Depth.getDepth()

lib/SILGen/SILGenMaterializeForSet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ namespace {
747747
void emit(SILGenFunction &gen, CleanupLocation loc) override {
748748
gen.B.createDeallocValueBuffer(loc, ValueType, Buffer);
749749
}
750-
void dump() const override {
750+
void dump(SILGenFunction &) const override {
751751
#ifndef NDEBUG
752752
llvm::errs() << "DeallocateValueBuffer\n"
753753
<< "State: " << getState() << "Buffer: " << Buffer << "\n";

lib/SILGen/SILGenProlog.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ class StrongReleaseCleanup : public Cleanup {
6363
void emit(SILGenFunction &gen, CleanupLocation l) override {
6464
gen.B.emitDestroyValueOperation(l, box);
6565
}
66-
void dump() const override {
66+
67+
void dump(SILGenFunction &) const override {
6768
#ifndef NDEBUG
6869
llvm::errs() << "DeallocateValueBuffer\n"
6970
<< "State: " << getState() << "box: " << box << "\n";

lib/SILGen/SILGenStmt.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ namespace {
405405
void emit(SILGenFunction &SGF, CleanupLocation l) override {
406406
assert(false && "Sema didn't catch exit out of a defer?");
407407
}
408-
void dump() const override {
408+
void dump(SILGenFunction &) const override {
409409
#ifndef NDEBUG
410410
llvm::errs() << "DeferEscapeCheckerCleanup\n"
411411
<< "State: " << getState() << "\n";
@@ -431,7 +431,7 @@ namespace {
431431
if (SGF.B.hasValidInsertionPoint())
432432
SGF.Cleanups.setCleanupState(TheCleanup, CleanupState::Dead);
433433
}
434-
void dump() const override {
434+
void dump(SILGenFunction &) const override {
435435
#ifndef NDEBUG
436436
llvm::errs() << "DeferCleanup\n"
437437
<< "State: " << getState() << "\n";

0 commit comments

Comments
 (0)