aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-12-28 09:12:35 +0000
committerChris Lattner <sabre@nondot.org>2009-12-28 09:12:35 +0000
commit5768bc2faeed700f412906424c0a942d285d2f6e (patch)
tree2aee8bddf397b88805394de96847e5d569e6664f /lib
parent4d27b641d703208dbcdd9898cbfdd1b90dcf97a6 (diff)
downloadexternal_llvm-5768bc2faeed700f412906424c0a942d285d2f6e.zip
external_llvm-5768bc2faeed700f412906424c0a942d285d2f6e.tar.gz
external_llvm-5768bc2faeed700f412906424c0a942d285d2f6e.tar.bz2
rearrange some methods, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92219 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/VMCore/Metadata.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/lib/VMCore/Metadata.cpp b/lib/VMCore/Metadata.cpp
index 2bf2c60..dd6a0f6 100644
--- a/lib/VMCore/Metadata.cpp
+++ b/lib/VMCore/Metadata.cpp
@@ -89,24 +89,27 @@ void MDNodeElement::allUsesReplacedWith(Value *NV) {
// 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 @@ MDNode *MDNode::get(LLVMContext &Context, Value*const* Vals, unsigned NumVals,
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!");