From 11ddc679ca09eff744cea781426210c5e09b1d17 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Thu, 11 Feb 2010 19:35:10 +0000 Subject: [PATCH] Destroy MDNodes while destructing llvm context. llvm-svn: 95903 --- llvm/lib/VMCore/LLVMContextImpl.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/llvm/lib/VMCore/LLVMContextImpl.h b/llvm/lib/VMCore/LLVMContextImpl.h index f7f4860614ad..4eb072240456 100644 --- a/llvm/lib/VMCore/LLVMContextImpl.h +++ b/llvm/lib/VMCore/LLVMContextImpl.h @@ -224,7 +224,10 @@ public: if (I->second->use_empty()) delete I->second; } - MDNodeSet.clear(); + while (!MDNodeSet.empty()) { + MDNode *N = &(*MDNodeSet.begin()); + N->destroy(); + } AlwaysOpaqueTy->dropRef(); for (OpaqueTypesTy::iterator I = OpaqueTypes.begin(), E = OpaqueTypes.end(); I != E; ++I) {