Make NamedMDNode not be a subclass of Value, and simplify the interface

for creating and populating NamedMDNodes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109061 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman
2010-07-21 23:38:33 +00:00
parent fcbd1a749f
commit 17aa92c92a
19 changed files with 97 additions and 273 deletions

View File

@ -127,11 +127,9 @@ Module *llvm::CloneModule(const Module *M,
for (Module::const_named_metadata_iterator I = M->named_metadata_begin(),
E = M->named_metadata_end(); I != E; ++I) {
const NamedMDNode &NMD = *I;
SmallVector<MDNode*, 4> MDs;
NamedMDNode *NewNMD = New->getOrInsertNamedMetadata(NMD.getName());
for (unsigned i = 0, e = NMD.getNumOperands(); i != e; ++i)
MDs.push_back(cast<MDNode>(MapValue(NMD.getOperand(i), VMap)));
NamedMDNode::Create(New->getContext(), NMD.getName(),
MDs.data(), MDs.size(), New);
NewNMD->addOperand(cast<MDNode>(MapValue(NMD.getOperand(i), VMap)));
}
// Update metadata attach with instructions.