Skip to content

Commit a0dadeb

Browse files
committed
[RemoveDIs] Fix asan-identified leak in unittest
llvm#106691 (comment) (cherry picked from commit a80307d)
1 parent 70d0040 commit a0dadeb

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

llvm/unittests/IR/BasicBlockDbgInfoTest.cpp

+5-7
Original file line numberDiff line numberDiff line change
@@ -1569,14 +1569,12 @@ TEST(BasicBlockDbgInfoTest, CloneTrailingRecordsToEmptyBlock) {
15691569
// The trailing records should've been absorbed into NewBB.
15701570
EXPECT_FALSE(BB.getTrailingDbgRecords());
15711571
EXPECT_TRUE(NewBB->getTrailingDbgRecords());
1572-
if (NewBB->getTrailingDbgRecords()) {
1573-
EXPECT_EQ(
1574-
llvm::range_size(NewBB->getTrailingDbgRecords()->getDbgRecordRange()),
1575-
1u);
1572+
if (DbgMarker *Trailing = NewBB->getTrailingDbgRecords()) {
1573+
EXPECT_EQ(llvm::range_size(Trailing->getDbgRecordRange()), 1u);
1574+
// Drop the trailing records now, to prevent a cleanup assertion.
1575+
Trailing->eraseFromParent();
1576+
NewBB->deleteTrailingDbgRecords();
15761577
}
1577-
1578-
// Drop the trailing records now, to prevent a cleanup assertion.
1579-
NewBB->deleteTrailingDbgRecords();
15801578
}
15811579

15821580
} // End anonymous namespace.

0 commit comments

Comments
 (0)