[llvm-commits] [llvm] r92219 - /llvm/trunk/lib/VMCore/Metadata.cpp
Chris Lattner
sabre at nondot.org
Mon Dec 28 01:12:36 PST 2009
Author: lattner
Date: Mon Dec 28 03:12:35 2009
New Revision: 92219
URL: http://llvm.org/viewvc/llvm-project?rev=92219&view=rev
Log:
rearrange some methods, no functionality change.
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=92219&r1=92218&r2=92219&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Metadata.cpp (original)
+++ llvm/trunk/lib/VMCore/Metadata.cpp Mon Dec 28 03:12:35 2009
@@ -89,24 +89,27 @@
// MDNode implementation.
//
+/// ~MDNode - Destroy MDNode.
+MDNode::~MDNode() {
+ LLVMContextImpl *pImpl = getType()->getContext().pImpl;
+ pImpl->MDNodeSet.RemoveNode(this);
+ delete [] Operands;
+ Operands = NULL;
+}
+
MDNode::MDNode(LLVMContext &C, Value *const *Vals, unsigned NumVals,
bool isFunctionLocal)
: MetadataBase(Type::getMetadataTy(C), Value::MDNodeVal) {
NumOperands = NumVals;
Operands = new MDNodeElement[NumOperands];
- MDNodeElement *Ptr = Operands;
+
for (unsigned i = 0; i != NumVals; ++i)
- Ptr[i].set(Vals[i], this);
+ Operands[i].set(Vals[i], this);
if (isFunctionLocal)
SubclassData |= FunctionLocalBit;
}
-void MDNode::Profile(FoldingSetNodeID &ID) const {
- for (unsigned i = 0, e = getNumElements(); i != e; ++i)
- ID.AddPointer(getElement(i));
-}
-
MDNode *MDNode::get(LLVMContext &Context, Value*const* Vals, unsigned NumVals,
bool isFunctionLocal) {
LLVMContextImpl *pImpl = Context.pImpl;
@@ -124,14 +127,12 @@
return N;
}
-/// ~MDNode - Destroy MDNode.
-MDNode::~MDNode() {
- LLVMContextImpl *pImpl = getType()->getContext().pImpl;
- pImpl->MDNodeSet.RemoveNode(this);
- delete [] Operands;
- Operands = NULL;
+void MDNode::Profile(FoldingSetNodeID &ID) const {
+ for (unsigned i = 0, e = getNumElements(); i != e; ++i)
+ ID.AddPointer(getElement(i));
}
+
/// getElement - Return specified element.
Value *MDNode::getElement(unsigned i) const {
assert(i < getNumElements() && "Invalid element number!");
More information about the llvm-commits
mailing list