mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
Clone named metadata while cloning a module.
Reapply Bob's patch. llvm-svn: 106560
This commit is contained in:
parent
2cf78d18d5
commit
eba73529a6
@ -123,5 +123,16 @@ Module *llvm::CloneModule(const Module *M,
|
||||
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