[llvm-commits] [llvm] r78612 - in /llvm/trunk/lib/VMCore: LLVMContextImpl.h Metadata.cpp
Devang Patel
dpatel at apple.com
Mon Aug 10 15:59:46 PDT 2009
Author: dpatel
Date: Mon Aug 10 17:59:46 2009
New Revision: 78612
URL: http://llvm.org/viewvc/llvm-project?rev=78612&view=rev
Log:
Remove MDNode from ValueMap when MDNode is destroyed.
Modified:
llvm/trunk/lib/VMCore/LLVMContextImpl.h
llvm/trunk/lib/VMCore/Metadata.cpp
Modified: llvm/trunk/lib/VMCore/LLVMContextImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/LLVMContextImpl.h?rev=78612&r1=78611&r2=78612&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/LLVMContextImpl.h (original)
+++ llvm/trunk/lib/VMCore/LLVMContextImpl.h Mon Aug 10 17:59:46 2009
@@ -105,7 +105,7 @@
ValueMap<char, Type, ConstantAggregateZero> AggZeroConstants;
- ValueMap<std::vector<Value*>, Type, MDNode> MDNodes;
+ ValueMap<std::vector<Value*>, Type, MDNode, true /*largekey*/> MDNodes;
typedef ValueMap<std::vector<Constant*>, ArrayType,
ConstantArray, true /*largekey*/> ArrayConstantsTy;
Modified: llvm/trunk/lib/VMCore/Metadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Metadata.cpp?rev=78612&r1=78611&r2=78612&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Metadata.cpp (original)
+++ llvm/trunk/lib/VMCore/Metadata.cpp Mon Aug 10 17:59:46 2009
@@ -92,8 +92,17 @@
Node.clear();
}
+static std::vector<Value*> getValType(MDNode *N) {
+ std::vector<Value*> Elements;
+ Elements.reserve(N->getNumElements());
+ for (unsigned i = 0, e = N->getNumElements(); i != e; ++i)
+ Elements.push_back(N->getElement(i));
+ return Elements;
+}
+
MDNode::~MDNode() {
dropAllReferences();
+ getType()->getContext().pImpl->MDNodes.remove(this);
}
//===----------------------------------------------------------------------===//
//NamedMDNode implementation
More information about the llvm-commits
mailing list