From a12b2d35a01ef81cc326cb029f71485d16785cc4 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Wed, 9 Sep 2009 17:07:07 +0000 Subject: [PATCH] Gracefully destroy MDNodes. llvm-svn: 81353 --- lib/VMCore/LLVMContextImpl.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/VMCore/LLVMContextImpl.h b/lib/VMCore/LLVMContextImpl.h index 77130d1ab94..048018d6b4d 100644 --- a/lib/VMCore/LLVMContextImpl.h +++ b/lib/VMCore/LLVMContextImpl.h @@ -203,6 +203,9 @@ public: AggZeroConstants.freeConstants(); NullPtrConstants.freeConstants(); UndefValueConstants.freeConstants(); + for (FoldingSet::iterator I=MDNodeSet.begin(), + E =MDNodeSet.end(); I != E; ++I) + I->dropAllReferences(); for (IntMapTy::iterator I=IntConstants.begin(), E=IntConstants.end(); I != E; ++I) { if (I->second->use_empty())