-
Notifications
You must be signed in to change notification settings - Fork 13.3k
[RemoveDIs] Fix asan-identified leak in unittest #106723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-llvm-ir @llvm/pr-subscribers-debuginfo Author: Orlando Cazalet-Hyams (OCHyams) ChangesFixes issue found here #106691 (comment) The issue wasn't in the code change itself, just the unittest; the trailing marker wasn't properly cleaned up. Full diff: https://github.com/llvm/llvm-project/pull/106723.diff 1 Files Affected:
diff --git a/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp b/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp
index 5615a4493d20a1..5ce14d3f6b9cef 100644
--- a/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp
+++ b/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp
@@ -1569,14 +1569,12 @@ TEST(BasicBlockDbgInfoTest, CloneTrailingRecordsToEmptyBlock) {
// The trailing records should've been absorbed into NewBB.
EXPECT_FALSE(BB.getTrailingDbgRecords());
EXPECT_TRUE(NewBB->getTrailingDbgRecords());
- if (NewBB->getTrailingDbgRecords()) {
- EXPECT_EQ(
- llvm::range_size(NewBB->getTrailingDbgRecords()->getDbgRecordRange()),
- 1u);
+ if (DbgMarker *Trailing = NewBB->getTrailingDbgRecords()) {
+ EXPECT_EQ(llvm::range_size(Trailing->getDbgRecordRange()), 1u);
+ // Drop the trailing records now, to prevent a cleanup assertion.
+ Trailing->eraseFromParent();
+ NewBB->deleteTrailingDbgRecords();
}
-
- // Drop the trailing records now, to prevent a cleanup assertion.
- NewBB->deleteTrailingDbgRecords();
}
} // End anonymous namespace.
|
Confirmed this fixes the asan issue. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/cherry-pick 7ffe67c |
Failed to cherry-pick: 7ffe67c https://github.com/llvm/llvm-project/actions/runs/10633781920 Please manually backport the fix and push it to your github fork. Once this is done, please create a pull request |
Ah yes I should have done that - sorry for any inconvenience there, thanks. |
Fixes issue found here #106691 (comment)
The issue wasn't in the code change itself, just the unittest; the trailing marker wasn't properly cleaned up.