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 <jh1302.park@samsung.com>
#include <nncc/foundation/Memory.h>
+#include <cassert>
+
namespace coco
{
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(); }