Skip to content

Commit 34451af

Browse files
committed
print <nullptr>
1 parent 88f6bf8 commit 34451af

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

llvm/lib/Transforms/Utils/BasicBlockUtils.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,7 +1778,10 @@ bool llvm::hasOnlySimpleTerminator(const Function &F) {
17781778

17791779
Printable llvm::printBasicBlock(const BasicBlock *BB) {
17801780
return Printable([BB](raw_ostream &OS) {
1781-
if (BB)
1782-
return BB->printAsOperand(OS);
1781+
if (!BB) {
1782+
OS << "<nullptr>";
1783+
return;
1784+
}
1785+
BB->printAsOperand(OS);
17831786
});
17841787
}

llvm/unittests/Transforms/Utils/BasicBlockUtilsTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -743,5 +743,5 @@ define void @foo() {
743743
SCheck.clear();
744744
}
745745
OS << printBasicBlock(nullptr);
746-
EXPECT_EQ(OS.str(), "");
746+
EXPECT_EQ(OS.str(), "<nullptr>");
747747
}

0 commit comments

Comments
 (0)