mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-04 18:06:49 +00:00
Include named metadata when cloning a module.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106508 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
df7d419f26
commit
e42f493f4c
@ -122,6 +122,17 @@ Module *llvm::CloneModule(const Module *M,
|
||||
if (const Constant* C = I->getAliasee())
|
||||
GA->setAliasee(cast<Constant>(MapValue(C, ValueMap)));
|
||||
}
|
||||
|
||||
// And named metadata....
|
||||
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;
|
||||
for (unsigned i = 0, e = NMD.getNumOperands(); i != e; ++i)
|
||||
MDs.push_back(cast<MDNode>(MapValue(NMD.getOperand(i), ValueMap)));
|
||||
NamedMDNode::Create(New->getContext(), NMD.getName(),
|
||||
MDs.data(), MDs.size(), New);
|
||||
}
|
||||
|
||||
return New;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user