Fix some memory leak in MLIRContext with respect to registered types/attributes interfaces

Differential Revision: https://reviews.llvm.org/D83618
This commit is contained in:
Mehdi Amini 2020-07-11 20:05:28 +00:00
parent 47872adf6a
commit 3b04af4d84
1 changed files with 6 additions and 0 deletions

View File

@ -331,6 +331,12 @@ public:
public: public:
MLIRContextImpl() : identifiers(identifierAllocator) {} MLIRContextImpl() : identifiers(identifierAllocator) {}
~MLIRContextImpl() {
for (auto typeMapping : registeredTypes)
typeMapping.second->~AbstractType();
for (auto attrMapping : registeredAttributes)
attrMapping.second->~AbstractAttribute();
}
}; };
} // end namespace mlir } // end namespace mlir