forked from OSchip/llvm-project
Remove MDNode from ValueMap when MDNode is destroyed.
llvm-svn: 78612
This commit is contained in:
parent
9e7c7e748f
commit
9b4ea1c474
|
@ -105,7 +105,7 @@ struct LLVMContextImpl {
|
||||||
|
|
||||||
ValueMap<char, Type, ConstantAggregateZero> AggZeroConstants;
|
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,
|
typedef ValueMap<std::vector<Constant*>, ArrayType,
|
||||||
ConstantArray, true /*largekey*/> ArrayConstantsTy;
|
ConstantArray, true /*largekey*/> ArrayConstantsTy;
|
||||||
|
|
|
@ -92,8 +92,17 @@ void MDNode::dropAllReferences() {
|
||||||
Node.clear();
|
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() {
|
MDNode::~MDNode() {
|
||||||
dropAllReferences();
|
dropAllReferences();
|
||||||
|
getType()->getContext().pImpl->MDNodes.remove(this);
|
||||||
}
|
}
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
//NamedMDNode implementation
|
//NamedMDNode implementation
|
||||||
|
|
Loading…
Reference in New Issue