IR: Move creation logic to MDNodeFwdDecl, NFC
[oota-llvm.git] / include / llvm / IR / Metadata.h
index d06621df3aacd7346194e967c6282e6aa557fcd1..1f327f6bdb3f462e05892b299bd3e07fe02f3fa2 100644 (file)
@@ -813,7 +813,6 @@ MDNode *MDNode::getDistinct(LLVMContext &Context, ArrayRef<Metadata *> MDs) {
 /// uniqued, and is suitable for forward references.
 class MDNodeFwdDecl : public MDNode, ReplaceableMetadataImpl {
   friend class Metadata;
-  friend class MDNode;
   friend class ReplaceableMetadataImpl;
 
   MDNodeFwdDecl(LLVMContext &C, ArrayRef<Metadata *> Vals)
@@ -823,6 +822,10 @@ public:
   ~MDNodeFwdDecl() { dropAllReferences(); }
   using MDNode::operator delete;
 
+  static MDNodeFwdDecl *get(LLVMContext &Context, ArrayRef<Metadata *> MDs) {
+    return new (MDs.size()) MDNodeFwdDecl(Context, MDs);
+  }
+
   static bool classof(const Metadata *MD) {
     return MD->getMetadataID() == MDNodeFwdDeclKind;
   }