Linker: Don't use MDNode::replaceOperandWith()
[opencl/llvm.git] / lib / IR / Metadata.cpp
index 1a651573733cad56e9ecf2e0fbcacbe383c88f65..cc3d13992b70330b82c0c5bc51d5274c302ee830 100644 (file)
@@ -836,6 +836,11 @@ MDNode *NamedMDNode::getOperand(unsigned i) const {
 
 void NamedMDNode::addOperand(MDNode *M) { getNMDOps(Operands).emplace_back(M); }
 
+void NamedMDNode::setOperand(unsigned I, MDNode *New) {
+  assert(I < getNumOperands() && "Invalid operand number");
+  getNMDOps(Operands)[I].reset(New);
+}
+
 void NamedMDNode::eraseFromParent() {
   getParent()->eraseNamedMetadata(this);
 }