From: Duncan P. N. Exon Smith Date: Wed, 10 Dec 2014 01:45:04 +0000 (+0000) Subject: IR: Move call to dropAllReferences() to MDNode subclasses X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=0e6679635a5dbc3d925369e690606e226aef8e86;p=oota-llvm.git IR: Move call to dropAllReferences() to MDNode subclasses Don't call `dropAllReferences()` from `MDNode::~MDNode()`, call it directly from `~MDNodeFwdDecl()` and `~GenericMDNode()`. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223904 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/llvm/IR/Metadata.h b/include/llvm/IR/Metadata.h index 573e49fbb06..5e1b294fa1f 100644 --- a/include/llvm/IR/Metadata.h +++ b/include/llvm/IR/Metadata.h @@ -598,7 +598,7 @@ protected: } MDNode(LLVMContext &Context, unsigned ID, ArrayRef MDs); - ~MDNode() { dropAllReferences(); } + ~MDNode() {} void dropAllReferences(); void storeDistinctInContext(); @@ -766,7 +766,7 @@ class MDNodeFwdDecl : public MDNode, ReplaceableMetadataImpl { MDNodeFwdDecl(LLVMContext &C, ArrayRef Vals) : MDNode(C, MDNodeFwdDeclKind, Vals) {} - ~MDNodeFwdDecl() {} + ~MDNodeFwdDecl() { dropAllReferences(); } public: static bool classof(const Metadata *MD) { diff --git a/lib/IR/Metadata.cpp b/lib/IR/Metadata.cpp index 0f748495261..506284fa87a 100644 --- a/lib/IR/Metadata.cpp +++ b/lib/IR/Metadata.cpp @@ -428,6 +428,7 @@ GenericMDNode::~GenericMDNode() { pImpl->NonUniquedMDNodes.erase(this); else pImpl->MDNodeSet.erase(this); + dropAllReferences(); } void GenericMDNode::resolve() {