This commit revises Module class to have default copy/move constructor.
Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
namespace nest
{
+// WARNING All of the descendant of expr::Node SHOULD BE immutable
+//
+// The copy/move constructor of Block and Module class simply copies their shared pointer under
+// the assumption that these classes are immutable.
using Expr = std::shared_ptr<nest::expr::Node>;
} // namespace nest
public:
Module() = default;
-public:
- Module(const Module &) = delete;
- Module(Module &&) = delete;
-
private:
VarContext _var_ctx;
namespace nest
{
+// WARNING Ret SHOULD BE immutable
+//
+// The copy/move constructor of Module class simply copies the shared pointer under the assumption
+// that Ret is immutable.
class Ret
{
public:
ASSERT_EQ(m.ret().id(), ofm.id());
ASSERT_EQ(m.ret().sub().rank(), 1);
}
+
+TEST(MODULE, copy)
+{
+ nest::Module orig;
+ nest::Module copy;
+
+ orig = copy;
+
+ orig.var().make();
+
+ ASSERT_EQ(copy.var().count(), 0);
+}