From 3ef971f4c8cf40ba50daced0f69d703b268d6b4f Mon Sep 17 00:00:00 2001 From: Tomasz Jankowski Date: Wed, 5 Jun 2024 14:12:57 +0200 Subject: [PATCH] [Core] Fix coverity issues (#24838) ### Details: - Used move instead of copy. ### Tickets: - CVS-121621 --- src/core/src/model.cpp | 2 +- src/core/src/pass/visualize_tree.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/core/src/model.cpp b/src/core/src/model.cpp index 315c3ab870f6e0..ac2413318f22d1 100644 --- a/src/core/src/model.cpp +++ b/src/core/src/model.cpp @@ -427,7 +427,7 @@ void ov::Model::replace_parameter(size_t parameter_index, const shared_ptrset_use_topological_cache(false); } diff --git a/src/core/src/pass/visualize_tree.cpp b/src/core/src/pass/visualize_tree.cpp index 3cc95403f3ecf7..866093096a082f 100644 --- a/src/core/src/pass/visualize_tree.cpp +++ b/src/core/src/pass/visualize_tree.cpp @@ -261,7 +261,7 @@ bool ov::pass::VisualizeTree::run_on_model(const std::shared_ptr& f) size_t fake_node_ctr = 0; - traverse_nodes(f, [&](std::shared_ptr node) { + traverse_nodes(f, [&](const std::shared_ptr& node) { add_node_arguments(node, height_maps, fake_node_ctr); }); @@ -281,8 +281,8 @@ bool ov::pass::VisualizeTree::run_on_model(const std::shared_ptr& f) ov::pass::VisualizeTree::VisualizeTree(const std::string& file_name, node_modifiers_t nm, bool dot_only) : m_name{file_name}, - m_node_modifiers{nm}, - m_dot_only(dot_only) {} + m_node_modifiers{std::move(nm)}, + m_dot_only{dot_only} {} void ov::pass::VisualizeTree::add_node_arguments(std::shared_ptr node, std::unordered_map& height_maps, @@ -297,7 +297,7 @@ void ov::pass::VisualizeTree::add_node_arguments(std::shared_ptr node, std::string("color=\"") + (arg->description() == "Parameter" ? "blue" : "black") + std::string("\""); std::vector attributes{"shape=\"box\"", "style=\"dashed\"", - color, + std::move(color), std::string("label=\"") + get_node_name(arg) + std::string("\n") + get_constant_value(arg) + std::string("\"")}; @@ -344,8 +344,8 @@ void ov::pass::VisualizeTree::add_node_arguments(std::shared_ptr node, std::string ov::pass::VisualizeTree::add_attributes(std::shared_ptr node) { std::string rc; if (m_nodes_with_attributes.find(node) == m_nodes_with_attributes.end()) { - m_nodes_with_attributes.insert(node); rc = get_attributes(node); + m_nodes_with_attributes.insert(std::move(node)); } return rc; }