Skip to content

Commit aa75d00

Browse files
committed
[SIL] NFC: Improved block id printing.
1 parent d649598 commit aa75d00

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

@@ -3108,17 +3111,17 @@ void SILBasicBlock::print(SILPrintContext &Ctx) const {
31083111
}
31093112

31103113
#ifndef NDEBUG
3111-
void SILBasicBlock::dumpID() const {
3112-
printID(llvm::errs());
3114+
void SILBasicBlock::dumpID(bool newline) const {
3115+
printID(llvm::errs(), newline);
31133116
}
31143117

3115-
void SILBasicBlock::printID(llvm::raw_ostream &OS) const {
3118+
void SILBasicBlock::printID(llvm::raw_ostream &OS, bool newline) const {
31163119
SILPrintContext Ctx(OS);
3117-
printID(Ctx);
3120+
printID(Ctx, newline);
31183121
}
31193122

3120-
void SILBasicBlock::printID(SILPrintContext &Ctx) const {
3121-
SILPrinter(Ctx).printID(this);
3123+
void SILBasicBlock::printID(SILPrintContext &Ctx, bool newline) const {
3124+
SILPrinter(Ctx).printID(this, newline);
31223125
}
31233126
#endif
31243127

0 commit comments

Comments
 (0)