From 4e31b627757121ca589642bb89fb6fa071c715f3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Staff=20Engineer/=EC=82=BC=EC=84=B1?= =?utf8?q?=EC=A0=84=EC=9E=90?= Date: Mon, 8 Oct 2018 16:33:51 +0900 Subject: [PATCH] [coco] Require Instr on Step construction (#1779) This commit disables default constructor of Step, and explicitly requires Instr on construction. Signed-off-by: Jonghyun Park --- contrib/coco/core/include/coco/IR/Step.h | 6 ++++-- contrib/coco/core/include/coco/IR/UnitF.h | 5 ++++- contrib/coco/core/src/IR/Eval.cpp | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/contrib/coco/core/include/coco/IR/Step.h b/contrib/coco/core/include/coco/IR/Step.h index 24d7a2d..31dad43 100644 --- a/contrib/coco/core/include/coco/IR/Step.h +++ b/contrib/coco/core/include/coco/IR/Step.h @@ -29,7 +29,10 @@ namespace coco class Step final { public: - Step() = default; + explicit Step(Instr *instr) : _instr{instr} + { + // DO NOTHING + } public: ~Step() { op(nullptr); } @@ -40,7 +43,6 @@ public: public: Instr *instr(void) const { return _instr; } - void instr(Instr *i) { _instr = i; } private: Op *_op = nullptr; diff --git a/contrib/coco/core/include/coco/IR/UnitF.h b/contrib/coco/core/include/coco/IR/UnitF.h index 27a8798..66e3c78 100644 --- a/contrib/coco/core/include/coco/IR/UnitF.h +++ b/contrib/coco/core/include/coco/IR/UnitF.h @@ -32,7 +32,10 @@ namespace coco class UnitF final : public FeatureInstr { public: - UnitF() { _step.instr(this); } + UnitF() : _step{this} + { + // DO NOTHING + } public: UnitF *asUnitF(void) override { return this; } diff --git a/contrib/coco/core/src/IR/Eval.cpp b/contrib/coco/core/src/IR/Eval.cpp index f6a51df..23b7f9f 100644 --- a/contrib/coco/core/src/IR/Eval.cpp +++ b/contrib/coco/core/src/IR/Eval.cpp @@ -34,7 +34,7 @@ std::set &operator+=(std::set &res, const coco::Object namespace coco { -Eval::Eval() : _out{this} +Eval::Eval() : _out{this}, _step{this} { // DO NOTHING } -- 2.7.4