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.

llvm-svn: 221359

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

index be0f549..db072ca 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 0b3376c..3806fe4 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));