Skip to content

Commit 344af51

Browse files
committed
Fix coverity issues by passing shared pointer by reference.
Fixes: #18412
1 parent 4c03a9a commit 344af51

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

sycl/source/detail/graph_impl.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ void propagatePartitionUp(std::shared_ptr<node_impl> Node, int PartitionNum) {
139139
/// @param HostTaskList List of host tasks that have already been processed and
140140
/// are encountered as successors to the node Node.
141141
void propagatePartitionDown(
142-
std::shared_ptr<node_impl> Node, int PartitionNum,
142+
const std::shared_ptr<node_impl> &Node, int PartitionNum,
143143
std::list<std::shared_ptr<node_impl>> &HostTaskList) {
144144
if (Node->MCGType == sycl::detail::CGType::CodeplayHostTask) {
145145
if (Node->MPartitionNum != -1) {
@@ -753,7 +753,7 @@ std::vector<sycl::detail::EventImplPtr> graph_impl::getExitNodesEvents(
753753
}
754754

755755
void graph_impl::beginRecording(
756-
std::shared_ptr<sycl::detail::queue_impl> Queue) {
756+
const std::shared_ptr<sycl::detail::queue_impl> &Queue) {
757757
graph_impl::WriteLock Lock(MMutex);
758758
if (!Queue->hasCommandGraph()) {
759759
Queue->setCommandGraph(shared_from_this());
@@ -1024,7 +1024,7 @@ exec_graph_impl::enqueue(const std::shared_ptr<sycl::detail::queue_impl> &Queue,
10241024
for (std::vector<sycl::detail::EventImplPtr>::iterator It =
10251025
MExecutionEvents.begin();
10261026
It != MExecutionEvents.end();) {
1027-
auto Event = *It;
1027+
std::shared_ptr<event_impl> &Event = *It;
10281028
if (!Event->isCompleted()) {
10291029
auto &AttachedEventsList = Event->getPostCompleteEvents();
10301030
CGData.MEvents.reserve(CGData.MEvents.size() +

sycl/source/detail/graph_impl.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ class graph_impl : public std::enable_shared_from_this<graph_impl> {
895895
/// @param EventImpl Event to associate with a node in map.
896896
/// @param NodeImpl Node to associate with event in map.
897897
void addEventForNode(std::shared_ptr<sycl::detail::event_impl> EventImpl,
898-
std::shared_ptr<node_impl> NodeImpl) {
898+
const std::shared_ptr<node_impl> &NodeImpl) {
899899
if (!(EventImpl->hasCommandGraph()))
900900
EventImpl->setCommandGraph(shared_from_this());
901901
MEventsMap[EventImpl] = NodeImpl;
@@ -1145,7 +1145,7 @@ class graph_impl : public std::enable_shared_from_this<graph_impl> {
11451145
/// Sets the Queue state to queue_state::recording. Adds the queue to the list
11461146
/// of recording queues associated with this graph.
11471147
/// @param[in] Queue The queue to be recorded from.
1148-
void beginRecording(std::shared_ptr<sycl::detail::queue_impl> Queue);
1148+
void beginRecording(const std::shared_ptr<sycl::detail::queue_impl> &Queue);
11491149

11501150
/// Store the last barrier node that was submitted to the queue.
11511151
/// @param[in] Queue The queue the barrier was recorded from.
@@ -1212,7 +1212,7 @@ class graph_impl : public std::enable_shared_from_this<graph_impl> {
12121212
/// added as a root node.
12131213
/// @param Node The node to add deps for
12141214
/// @param Deps List of dependent nodes
1215-
void addDepsToNode(std::shared_ptr<node_impl> Node,
1215+
void addDepsToNode(const std::shared_ptr<node_impl> &Node,
12161216
std::vector<std::shared_ptr<node_impl>> &Deps) {
12171217
if (!Deps.empty()) {
12181218
for (auto &N : Deps) {

0 commit comments

Comments
 (0)