From 6c889a0c6bba7b81196bde8471fe3e0effa7947c 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: Tue, 11 Sep 2018 17:37:36 +0900 Subject: [PATCH] [coco] Ensure Bag has no reference on destruction (#1449) This commit introduces several asserts inside Bag's destructor to ensure that each bag has no reference in IR on destruction. Signed-off-by: Jonghyun Park --- contrib/coco/core/src/IR/Bag.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/contrib/coco/core/src/IR/Bag.cpp b/contrib/coco/core/src/IR/Bag.cpp index e3faf4c..1e2e4e4 100644 --- a/contrib/coco/core/src/IR/Bag.cpp +++ b/contrib/coco/core/src/IR/Bag.cpp @@ -7,6 +7,8 @@ #include +#include + namespace coco { @@ -17,7 +19,10 @@ Bag::Bag(std::unique_ptr &&info) : _info{std::move(info)} Bag::~Bag() { - // DO NOTHING + // All the references over a bag SHOULD be dropped before its destruction + assert(_info->deps()->size() == 0); + assert(_info->reads()->size() == 0); + assert(_info->updates()->size() == 0); } uint32_t Bag::size(void) const { return _info->size(); } -- 2.7.4