summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Metadata.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2012-02-15 09:09:29 +0000
committerEric Christopher <echristo@apple.com>2012-02-15 09:09:29 +0000
commit24e51b7f29154bf89426c6a3ab45a6ecdfa4f10a (patch)
tree8f377833c3a8054711a626dcc5ef87d9d2a6f28e /llvm/lib/VMCore/Metadata.cpp
parent278c25f241d3ca60026246ad10d0915477d095ef (diff)
downloadbcm5719-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.cpp5
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();
OpenPOWER on IntegriCloud