Skip to content

Commit de2e526

Browse files
committed
[SIL] NFC: Improved block id printing.
1 parent 21270bf commit de2e526

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

include/swift/SIL/SILBasicBlock.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -518,13 +518,13 @@ public SwiftObjectHeader {
518518

519519
#ifndef NDEBUG
520520
/// Print the ID of the block, bbN.
521-
void dumpID() const;
521+
void dumpID(bool newline = true) const;
522522

523523
/// Print the ID of the block with \p OS, bbN.
524-
void printID(llvm::raw_ostream &OS) const;
524+
void printID(llvm::raw_ostream &OS, bool newline = true) const;
525525

526526
/// Print the ID of the block with \p Ctx, bbN.
527-
void printID(SILPrintContext &Ctx) const;
527+
void printID(SILPrintContext &Ctx, bool newline = true) const;
528528
#endif
529529

530530
/// getSublistAccess() - returns pointer to member of instruction list

lib/SIL/IR/SILPrinter.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -853,8 +853,11 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
853853
}
854854

855855
#ifndef NDEBUG
856-
void printID(const SILBasicBlock *BB) {
857-
*this << Ctx.getID(BB) << "\n";
856+
void printID(const SILBasicBlock *BB, bool newline) {
857+
*this << Ctx.getID(BB);
858+
if (newline) {
859+
*this << "\n";
860+
}
858861
}
859862
#endif
860863

@@ -3115,17 +3118,17 @@ void SILBasicBlock::print(SILPrintContext &Ctx) const {
31153118
}
31163119

31173120
#ifndef NDEBUG
3118-
void SILBasicBlock::dumpID() const {
3119-
printID(llvm::errs());
3121+
void SILBasicBlock::dumpID(bool newline) const {
3122+
printID(llvm::errs(), newline);
31203123
}
31213124

3122-
void SILBasicBlock::printID(llvm::raw_ostream &OS) const {
3125+
void SILBasicBlock::printID(llvm::raw_ostream &OS, bool newline) const {
31233126
SILPrintContext Ctx(OS);
3124-
printID(Ctx);
3127+
printID(Ctx, newline);
31253128
}
31263129

3127-
void SILBasicBlock::printID(SILPrintContext &Ctx) const {
3128-
SILPrinter(Ctx).printID(this);
3130+
void SILBasicBlock::printID(SILPrintContext &Ctx, bool newline) const {
3131+
SILPrinter(Ctx).printID(this, newline);
31293132
}
31303133
#endif
31313134

0 commit comments

Comments
 (0)