Commit 41f74ac8 authored by Shucai Xiao's avatar Shucai Xiao
Browse files

fix cppcheck errors.

parent bd86c201
......@@ -35,13 +35,13 @@ struct program
program(program&&) noexcept;
// copy constructor
program(const program&) noexcept;
program(const program&);
// move assignment operator
program& operator=(program&&) noexcept;
// copy assignment operator
program& operator=(const program&) noexcept;
program& operator=(const program&);
~program() noexcept;
......@@ -130,7 +130,7 @@ struct program
friend bool operator!=(const program& x, const program& y) { return !(x == y); }
private:
void copy(const program& prog);
void copy(const program& p);
private:
std::unique_ptr<program_impl> impl;
......
......@@ -90,10 +90,10 @@ program& program::operator=(program&&) noexcept = default;
program::~program() noexcept = default;
// copy constructor
program::program(const program& p) noexcept { copy(p); }
program::program(const program& p) { copy(p); }
// copy assignment operator
program& program::operator=(const program& p) noexcept
program& program::operator=(const program& p)
{
if(this != &p)
{
......@@ -130,7 +130,7 @@ void program::copy(const program& p)
auto&& name = any_cast<builtin::param>(ins->get_operator()).parameter;
auto s = ins->get_shape();
copy_ins = impl->instructions.insert(
impl->instructions.end(), {builtin::param{std::move(name)}, std::move(s), {}});
impl->instructions.end(), {builtin::param{name}, std::move(s), {}});
}
else if(ins->name() == "@outline")
{
......
......@@ -4,6 +4,7 @@
#include <migraphx/instruction.hpp>
#include <migraphx/op/add.hpp>
#include <migraphx/op/mul.hpp>
#include <migraphx/cpu/target.hpp>
#include <sstream>
#include "test.hpp"
#include <basic_ops.hpp>
......@@ -48,20 +49,25 @@ TEST_CASE(program_copy)
{
auto p1 = create_program_1();
auto p2 = p1;
p2.compile(migraphx::cpu::target{});
EXPECT(p1 == p2);
}
{
auto p1 = create_program_1();
auto p2(p1);
p2.compile(migraphx::cpu::target{});
EXPECT(p1 == p2);
}
{
auto p1 = create_program_1();
auto p2 = create_program();
p2 = p1;
p2.compile(migraphx::cpu::target{});
p2 = p1;
p2.compile(migraphx::cpu::target{});
EXPECT(p1 == p2);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment