IR: Move replaceAllUsesWith() back up to MDNode
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 19 Jan 2015 19:35:21 +0000 (19:35 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Mon, 19 Jan 2015 19:35:21 +0000 (19:35 +0000)
Move `MDNodeFwdDecl::replaceAllUsesWith()` back up to `MDNode`, but
assert `isTemporary()`.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226495 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/IR/Metadata.h

index a7fc7b7e51ea72f88da2894338d4fe168272e9aa..5371efba122407e545f585e7d2f6f616e39f5993 100644 (file)
@@ -734,6 +734,15 @@ public:
   bool isDistinct() const { return Storage == Distinct; }
   bool isTemporary() const { return Storage == Temporary; }
 
+  /// \brief RAUW a temporary.
+  ///
+  /// \pre \a isTemporary() must be \c true.
+  void replaceAllUsesWith(Metadata *MD) {
+    assert(isTemporary() && "Expected temporary node");
+    assert(!isResolved() && "Expected RAUW support");
+    Context.getReplaceableUses()->replaceAllUsesWith(MD);
+  }
+
 protected:
   /// \brief Set an operand.
   ///
@@ -971,11 +980,6 @@ public:
   static bool classof(const Metadata *MD) {
     return MD->getMetadataID() == MDNodeFwdDeclKind;
   }
-
-  void replaceAllUsesWith(Metadata *MD) {
-    assert(Context.hasReplaceableUses() && "Expected RAUW support");
-    Context.getReplaceableUses()->replaceAllUsesWith(MD);
-  }
 };
 
 //===----------------------------------------------------------------------===//