[llvm] r223904 - IR: Move call to dropAllReferences() to MDNode subclasses

Duncan P. N. Exon Smith dexonsmith at apple.com
Tue Dec 9 17:45:04 PST 2014


Author: dexonsmith
Date: Tue Dec  9 19:45:04 2014
New Revision: 223904

URL: http://llvm.org/viewvc/llvm-project?rev=223904&view=rev
Log:
IR: Move call to dropAllReferences() to MDNode subclasses

Don't call `dropAllReferences()` from `MDNode::~MDNode()`, call it
directly from `~MDNodeFwdDecl()` and `~GenericMDNode()`.

Modified:
    llvm/trunk/include/llvm/IR/Metadata.h
    llvm/trunk/lib/IR/Metadata.cpp

Modified: llvm/trunk/include/llvm/IR/Metadata.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/Metadata.h?rev=223904&r1=223903&r2=223904&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/Metadata.h (original)
+++ llvm/trunk/include/llvm/IR/Metadata.h Tue Dec  9 19:45:04 2014
@@ -598,7 +598,7 @@ protected:
   }
 
   MDNode(LLVMContext &Context, unsigned ID, ArrayRef<Metadata *> MDs);
-  ~MDNode() { dropAllReferences(); }
+  ~MDNode() {}
 
   void dropAllReferences();
   void storeDistinctInContext();
@@ -766,7 +766,7 @@ class MDNodeFwdDecl : public MDNode, Rep
 
   MDNodeFwdDecl(LLVMContext &C, ArrayRef<Metadata *> Vals)
       : MDNode(C, MDNodeFwdDeclKind, Vals) {}
-  ~MDNodeFwdDecl() {}
+  ~MDNodeFwdDecl() { dropAllReferences(); }
 
 public:
   static bool classof(const Metadata *MD) {

Modified: llvm/trunk/lib/IR/Metadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Metadata.cpp?rev=223904&r1=223903&r2=223904&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Metadata.cpp (original)
+++ llvm/trunk/lib/IR/Metadata.cpp Tue Dec  9 19:45:04 2014
@@ -428,6 +428,7 @@ GenericMDNode::~GenericMDNode() {
     pImpl->NonUniquedMDNodes.erase(this);
   else
     pImpl->MDNodeSet.erase(this);
+  dropAllReferences();
 }
 
 void GenericMDNode::resolve() {





More information about the llvm-commits mailing list