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 | f32a960fd32b32f84bb486458ccbc905af490da9 (patch) | |
tree | 90c00395fcdcd46d9336607b0e376d42e9dbf43b /lib/VMCore/Metadata.cpp | |
parent | 900d7b78e6cacca6c6062abf803d7ab1a4e39b38 (diff) | |
download | external_llvm-f32a960fd32b32f84bb486458ccbc905af490da9.tar.gz external_llvm-f32a960fd32b32f84bb486458ccbc905af490da9.tar.bz2 external_llvm-f32a960fd32b32f84bb486458ccbc905af490da9.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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150571 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Metadata.cpp')
-rw-r--r-- | lib/VMCore/Metadata.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/VMCore/Metadata.cpp b/lib/VMCore/Metadata.cpp index 5d6eb144c3..0fc2a2534d 100644 --- a/lib/VMCore/Metadata.cpp +++ b/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(); |