diff options
Diffstat (limited to 'llvm/lib/IR/LLVMContextImpl.cpp')
-rw-r--r-- | llvm/lib/IR/LLVMContextImpl.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp index d4239e5fa3d..3fd0bb37a4d 100644 --- a/llvm/lib/IR/LLVMContextImpl.cpp +++ b/llvm/lib/IR/LLVMContextImpl.cpp @@ -126,8 +126,10 @@ LLVMContextImpl::~LLVMContextImpl() { MDNodes.reserve(MDNodeSet.size() + NonUniquedMDNodes.size()); MDNodes.append(MDNodeSet.begin(), MDNodeSet.end()); MDNodes.append(NonUniquedMDNodes.begin(), NonUniquedMDNodes.end()); - for (auto &I : MDNodes) - I->destroy(); + for (GenericMDNode *I : MDNodes) + I->dropAllReferences(); + for (GenericMDNode *I : MDNodes) + delete I; assert(MDNodeSet.empty() && NonUniquedMDNodes.empty() && "Destroying all MDNodes didn't empty the Context's sets."); |