Skip to content

Commit 88f6bf8

Browse files
committed
implement feedback
1 parent 3337875 commit 88f6bf8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

llvm/unittests/Transforms/Utils/BasicBlockUtilsTest.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -719,23 +719,28 @@ attributes #0 = { presplitcoroutine }
719719

720720
TEST(BasicBlockUtils, BasicBlockPrintable) {
721721
std::string S;
722+
std::string SCheck;
722723
llvm::raw_string_ostream OS{S};
724+
llvm::raw_string_ostream OSCheck{SCheck};
723725

724726
LLVMContext C;
725727
std::unique_ptr<Module> M = parseIR(C, R"IR(
726728
define void @foo() {
727-
.entry:
728729
br label %bb0
729730
bb0:
731+
br label %.exit
732+
.exit:
730733
ret void
731734
}
732735
)IR");
733736

734737
Function *F = M->getFunction("foo");
735-
for (BasicBlock &BB : *F) {
738+
for (const BasicBlock &BB : *F) {
736739
OS << printBasicBlock(&BB);
737-
EXPECT_EQ(OS.str(), "label %" + BB.getName().str());
740+
BB.printAsOperand(OSCheck);
741+
EXPECT_EQ(OS.str(), OSCheck.str());
738742
S.clear();
743+
SCheck.clear();
739744
}
740745
OS << printBasicBlock(nullptr);
741746
EXPECT_EQ(OS.str(), "");

0 commit comments

Comments
 (0)