-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Fix: Changed parameter to const reference instead of pass-by-value #150928
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
base: main
Are you sure you want to change the base?
Conversation
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
@llvm/pr-subscribers-debuginfo @llvm/pr-subscribers-llvm-ir Author: None (arrowten) ChangesFull diff: https://github.com/llvm/llvm-project/pull/150928.diff 2 Files Affected:
diff --git a/llvm/include/llvm/IR/Metadata.h b/llvm/include/llvm/IR/Metadata.h
index af252aa24567a..9cd8533069c21 100644
--- a/llvm/include/llvm/IR/Metadata.h
+++ b/llvm/include/llvm/IR/Metadata.h
@@ -237,7 +237,7 @@ class DebugValueUser {
/// `resetDebugValue(Idx, NewDebugValue)` should be used instead.
LLVM_ABI void handleChangedValue(void *Old, Metadata *NewDebugValue);
DebugValueUser() = default;
- explicit DebugValueUser(std::array<Metadata *, 3> DebugValues)
+ explicit DebugValueUser(const std::array<Metadata *, 3> &DebugValues)
: DebugValues(DebugValues) {
trackDebugValues();
}
diff --git a/llvm/unittests/IR/MetadataTest.cpp b/llvm/unittests/IR/MetadataTest.cpp
index ba8367f4a396e..0e8e0831ac9d6 100644
--- a/llvm/unittests/IR/MetadataTest.cpp
+++ b/llvm/unittests/IR/MetadataTest.cpp
@@ -5497,4 +5497,29 @@ TEST_F(MDTupleAllocationDeathTest, ResizeRejected) {
}
#endif
+typedef MetadataTest DebugValueUserTest;
+
+namespace {
+struct DebugValueUserTestHelper: public llvm::DebugValueUser {
+ using llvm::DebugValueUser::DebugValueUser;
+ using llvm::DebugValueUser::getDebugValues;
+};
+}
+
+TEST_F(DebugValueUserTest, GetDebugValues) {
+ auto *V = getConstantAsMetadata();
+ auto *V2 = getConstantAsMetadata();
+ auto *V3 = getConstantAsMetadata();
+ std::array<Metadata *, 3> Debugs = {V, V2, V3};
+ DebugValueUserTestHelper User(Debugs);
+ ArrayRef<Metadata *> Result = User.getDebugValues();
+
+ // Verify the size of the returned array is correct,
+ // and each element is correctly stored and returned.
+ EXPECT_EQ(Result.size(), 3u);
+ EXPECT_EQ(Result[0], V);
+ EXPECT_EQ(Result[1], V2);
+ EXPECT_EQ(Result[2], V3);
+}
+
} // end namespace
|
Hello there,
Trivial one line change looks good to me.
Regards
David Binderman
…________________________________
From: Yanzuo Liu ***@***.***>
Sent: 03 September 2025 00:50
To: llvm/llvm-project ***@***.***>
Cc: dcb314 ***@***.***>; Review requested ***@***.***>
Subject: Re: [llvm/llvm-project] Fix: Changed parameter to const reference instead of pass-by-value (PR #150928)
@zwuis<https://github.com/zwuis> requested your review on: #150928<#150928> Fix: Changed parameter to const reference instead of pass-by-value.
—
Reply to this email directly, view it on GitHub<#150928 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ABAQX5K2YGQH7PIMQIWQJO33QY3NDAVCNFSM6AAAAACCQUYCUOVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJZGQ3TCMZUGAYDKMQ>.
You are receiving this because your review was requested.Message ID: ***@***.***>
|
@dcb314 Well thank you for that, but who accepts the PR? |
No description provided.