Skip to content

Commit 25c0aa3

Browse files
committed
[silgen] Add dump/print methods to IndirectSlot and ParamInfo.
This just makes it easier to work with these types in the debugger. Just slicing off commits from a larger patch.
1 parent d36b067 commit 25c0aa3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/SILGen/SILGenPoly.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,14 @@ class IndirectSlot {
159159
if (hasAddress()) return getAddress();
160160
return SGF.emitTemporaryAllocation(loc, getType());
161161
}
162+
void print(llvm::raw_ostream &os) const {
163+
if (hasAddress())
164+
os << "Address: " << *getAddress();
165+
else
166+
os << "Type: " << getType();
167+
}
168+
169+
SWIFT_DEBUG_DUMP { print(llvm::dbgs()); llvm::dbgs() << '\n'; }
162170
};
163171

164172
} // end anonymous namespace
@@ -1271,6 +1279,13 @@ class ParamInfo {
12711279
(isIndirectFormalParameter(convention) &&
12721280
SGF.silConv.useLoweredAddresses());
12731281
}
1282+
1283+
void print(llvm::raw_ostream &os) const {
1284+
os << "ParamInfo. Slot: ";
1285+
slot.print(os);
1286+
};
1287+
1288+
SWIFT_DEBUG_DUMP { print(llvm::dbgs()); llvm::dbgs() << '\n'; }
12741289
};
12751290

12761291
/// Given a list of inputs that are suited to the parameters of one

0 commit comments

Comments
 (0)