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

David Blaikie dblaikie at gmail.com
Wed Dec 10 09:06:02 PST 2014


On Tue, Dec 9, 2014 at 5:45 PM, Duncan P. N. Exon Smith <
dexonsmith at apple.com> wrote:

> 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()`.
>

What was the problem/how did this change address it? (seems unfortunate to
have to duplicate things in subclasses, though I realize it's sometimes
necessary - just not obvious to me what necessitates it in this instance)


>
> 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() {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141210/eff1e3b4/attachment.html>


More information about the llvm-commits mailing list