mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-03 17:31:50 +00:00
Remove MDNode from ValueMap when MDNode is destroyed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78612 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
af37f341df
commit
286d9e4b9d
@ -105,7 +105,7 @@ struct LLVMContextImpl {
|
||||
|
||||
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;
|
||||
|
@ -92,8 +92,17 @@ void MDNode::dropAllReferences() {
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user