return new NamedMDNode(N, MDs, NumMDs, M);
}
+ /// eraseFromParent - Drop all references and remove the node from parent
+ /// module.
+ void eraseFromParent();
+
+ /// dropAllReferences - Remove all uses and clear node vector.
+ void dropAllReferences();
+
+ ~NamedMDNode();
+
typedef SmallVectorImpl<WeakMetadataVH>::const_iterator const_elem_iterator;
/// getParent - Get the module that holds this named metadata collection.
if (ParentModule)
ParentModule->getNamedMDList().push_back(this);
}
+
+/// eraseFromParent - Drop all references and remove the node from parent
+/// module.
+void NamedMDNode::eraseFromParent() {
+ dropAllReferences();
+ getParent()->getNamedMDList().erase(this);
+}
+
+/// dropAllReferences - Remove all uses and clear node vector.
+void NamedMDNode::dropAllReferences() {
+ // FIXME: Update metadata use list.
+ Node.clear();
+}
+
+NamedMDNode::~NamedMDNode() {
+ dropAllReferences();
+}