Skip to content

Fix coverity issues by passing shared pointer by reference. #18473

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

Open
wants to merge 1 commit into
base: sycl
Choose a base branch
from

Conversation

fabiomestre
Copy link
Contributor

@fabiomestre fabiomestre commented May 14, 2025

Changes some functions in the sycl graph implementation to pass shared pointers by reference instead of by value.

Fixes: #18412

@fabiomestre fabiomestre force-pushed the fabio/fix_coverity branch from 4aee6ce to 0e74543 Compare May 14, 2025 18:11
@fabiomestre fabiomestre marked this pull request as ready for review May 14, 2025 18:29
@fabiomestre fabiomestre requested a review from a team as a code owner May 14, 2025 18:29
@fabiomestre fabiomestre requested a review from reble May 14, 2025 18:29
@@ -1024,7 +1024,7 @@ exec_graph_impl::enqueue(const std::shared_ptr<sycl::detail::queue_impl> &Queue,
for (std::vector<sycl::detail::EventImplPtr>::iterator It =
MExecutionEvents.begin();
It != MExecutionEvents.end();) {
auto Event = *It;
std::shared_ptr<event_impl> &Event = *It;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
std::shared_ptr<event_impl> &Event = *It;
auto &Event = *It;

This should work too if we want to have it less explicit as before and only use a reference ... or was that change intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change was intentional. I thought having it explicit was slightly more readable. But I don't feel that strongly about it. I'm ok with reverting if you have a preference for auto.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Coverity] Variable copied when it could be moved
2 participants