IR: MDNode => Value: NamedMDNode::addOperand()
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 5 Nov 2014 17:16:09 +0000 (17:16 +0000)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Wed, 5 Nov 2014 17:16:09 +0000 (17:16 +0000)
Change `NamedMDNode::addOperand()` to take a `Value *` instead of an
`MDNode *`.  This is part of PR21433.

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

include/llvm/IR/Metadata.h
lib/IR/Metadata.cpp

index be0f54974fdee3c31bc9cd3234af15709e92bbc0..db072ca6616dc3ae175cc6a2523a46814a72dce0 100644 (file)
@@ -307,7 +307,7 @@ public:
 
   MDNode *getOperand(unsigned i) const;
   unsigned getNumOperands() const;
-  void addOperand(MDNode *M);
+  void addOperand(Value *M);
   StringRef getName() const;
   void print(raw_ostream &ROS) const;
   void dump() const;
index 0b3376c9e9c7b65a953ae6db8666763df39cb1ab..3806fe4fd4e13c5a14b380e012cdb1230c18d8fd 100644 (file)
@@ -578,7 +578,8 @@ MDNode *NamedMDNode::getOperand(unsigned i) const {
   return &*getNMDOps(Operands)[i];
 }
 
-void NamedMDNode::addOperand(MDNode *M) {
+void NamedMDNode::addOperand(Value *V) {
+  auto *M = cast<MDNode>(V);
   assert(!M->isFunctionLocal() &&
          "NamedMDNode operands must not be function-local!");
   getNMDOps(Operands).push_back(TrackingVH<MDNode>(M));