Skip to content

Commit 2e08d61

Browse files
committed
Fix SILBasicBlock::{dump,print}ID so that they are available in no-asserts but just print out NOASSERTS instead of a debug id.
1 parent c554028 commit 2e08d61

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

include/swift/SIL/SILBasicBlock.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,6 @@ public SwiftObjectHeader {
563563

564564
void printAsOperand(raw_ostream &OS, bool PrintType = true);
565565

566-
#ifndef NDEBUG
567566
/// Print the ID of the block, bbN.
568567
void dumpID(bool newline = true) const;
569568

@@ -572,7 +571,6 @@ public SwiftObjectHeader {
572571

573572
/// Print the ID of the block with \p Ctx, bbN.
574573
void printID(SILPrintContext &Ctx, bool newline = true) const;
575-
#endif
576574

577575
/// getSublistAccess() - returns pointer to member of instruction list
578576
static InstListType SILBasicBlock::*getSublistAccess() {

lib/SIL/IR/SILPrinter.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3245,20 +3245,30 @@ void SILBasicBlock::print(SILPrintContext &Ctx) const {
32453245
SILPrinter(Ctx).print(this);
32463246
}
32473247

3248-
#ifndef NDEBUG
32493248
void SILBasicBlock::dumpID(bool newline) const {
3249+
#ifndef NDEBUG
32503250
printID(llvm::errs(), newline);
3251+
#else
3252+
llvm::errs() << "NOASSERTS" << (newline ? "\n" : "");
3253+
#endif
32513254
}
32523255

32533256
void SILBasicBlock::printID(llvm::raw_ostream &OS, bool newline) const {
3257+
#ifndef NDEBUG
32543258
SILPrintContext Ctx(OS);
32553259
printID(Ctx, newline);
3260+
#else
3261+
llvm::errs() << "NOASSERTS" << (newline ? "\n" : "");
3262+
#endif
32563263
}
32573264

32583265
void SILBasicBlock::printID(SILPrintContext &Ctx, bool newline) const {
3266+
#ifndef NDEBUG
32593267
SILPrinter(Ctx).printID(this, newline);
3260-
}
3268+
#else
3269+
llvm::errs() << "NOASSERTS" << (newline ? "\n" : "");
32613270
#endif
3271+
}
32623272

32633273
/// Pretty-print the SILFunction to errs.
32643274
void SILFunction::dump(bool Verbose) const {

0 commit comments

Comments
 (0)