diff options
| author | Eric Christopher <echristo@apple.com> | 2012-02-15 09:09:29 +0000 |
|---|---|---|
| committer | Eric Christopher <echristo@apple.com> | 2012-02-15 09:09:29 +0000 |
| commit | 24e51b7f29154bf89426c6a3ab45a6ecdfa4f10a (patch) | |
| tree | 8f377833c3a8054711a626dcc5ef87d9d2a6f28e /llvm/lib/VMCore/Metadata.cpp | |
| parent | 278c25f241d3ca60026246ad10d0915477d095ef (diff) | |
| download | bcm5719-llvm-24e51b7f29154bf89426c6a3ab45a6ecdfa4f10a.tar.gz bcm5719-llvm-24e51b7f29154bf89426c6a3ab45a6ecdfa4f10a.zip | |
Add a way to replace a field inside a metadata node. This can be
used to incrementally update a created node without needing a
temporary node and RAUW.
llvm-svn: 150571
Diffstat (limited to 'llvm/lib/VMCore/Metadata.cpp')
| -rw-r--r-- | llvm/lib/VMCore/Metadata.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/VMCore/Metadata.cpp b/llvm/lib/VMCore/Metadata.cpp index 5d6eb144c3e..0fc2a2534d2 100644 --- a/llvm/lib/VMCore/Metadata.cpp +++ b/llvm/lib/VMCore/Metadata.cpp @@ -87,6 +87,11 @@ static MDNodeOperand *getOperandPtr(MDNode *N, unsigned Op) { return reinterpret_cast<MDNodeOperand*>(N+1)+Op; } +void MDNode::replaceOperandWith(unsigned i, Value *Val) { + MDNodeOperand *Op = getOperandPtr(this, i); + replaceOperand(Op, Val); +} + MDNode::MDNode(LLVMContext &C, ArrayRef<Value*> Vals, bool isFunctionLocal) : Value(Type::getMetadataTy(C), Value::MDNodeVal) { NumOperands = Vals.size(); |

