[llvm-commits] [llvm] r92218 - /llvm/trunk/lib/VMCore/Metadata.cpp
Chris Lattner
sabre at nondot.org
Mon Dec 28 01:10:16 PST 2009
Author: lattner
Date: Mon Dec 28 03:10:16 2009
New Revision: 92218
URL: http://llvm.org/viewvc/llvm-project?rev=92218&view=rev
Log:
avoid temporary CallbackVH's.
Modified:
llvm/trunk/lib/VMCore/Metadata.cpp
Modified: llvm/trunk/lib/VMCore/Metadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Metadata.cpp?rev=92218&r1=92217&r2=92218&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Metadata.cpp (original)
+++ llvm/trunk/lib/VMCore/Metadata.cpp Mon Dec 28 03:10:16 2009
@@ -64,6 +64,11 @@
MDNodeElement(Value *V, MDNode *P) : CallbackVH(V), Parent(P) {}
~MDNodeElement() {}
+ void set(Value *V, MDNode *P) {
+ setValPtr(V);
+ Parent = P;
+ }
+
virtual void deleted();
virtual void allUsesReplacedWith(Value *NV);
};
@@ -91,7 +96,7 @@
Operands = new MDNodeElement[NumOperands];
MDNodeElement *Ptr = Operands;
for (unsigned i = 0; i != NumVals; ++i)
- Ptr[i] = MDNodeElement(Vals[i], this);
+ Ptr[i].set(Vals[i], this);
if (isFunctionLocal)
SubclassData |= FunctionLocalBit;
@@ -161,9 +166,8 @@
// Replace From element(s) in place.
for (SmallVector<unsigned, 4>::iterator I = Indexes.begin(), E = Indexes.end();
- I != E; ++I) {
- Operands[*I] = MDNodeElement(To, this);
- }
+ I != E; ++I)
+ Operands[*I].set(To, this);
// Insert updated "this" into the context's folding node set.
// If a node with same element list already exist then before inserting
More information about the llvm-commits
mailing list