diff options
author | Dan Gohman <gohman@apple.com> | 2010-07-21 23:38:33 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-07-21 23:38:33 +0000 |
commit | 17aa92c92a925b4a674440c7ef088c223990e854 (patch) | |
tree | bc129644ee9db39dc25a41c22ce01b14ede5728f /lib/Linker/LinkModules.cpp | |
parent | fcbd1a749f9db4bf144a3343c4d707e1de087a7e (diff) | |
download | external_llvm-17aa92c92a925b4a674440c7ef088c223990e854.zip external_llvm-17aa92c92a925b4a674440c7ef088c223990e854.tar.gz external_llvm-17aa92c92a925b4a674440c7ef088c223990e854.tar.bz2 |
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
Diffstat (limited to 'lib/Linker/LinkModules.cpp')
-rw-r--r-- | lib/Linker/LinkModules.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 8487c83..4891631 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -545,14 +545,10 @@ static void LinkNamedMDNodes(Module *Dest, Module *Src) { for (Module::const_named_metadata_iterator I = Src->named_metadata_begin(), E = Src->named_metadata_end(); I != E; ++I) { const NamedMDNode *SrcNMD = I; - NamedMDNode *DestNMD = Dest->getNamedMetadata(SrcNMD->getName()); - if (!DestNMD) - NamedMDNode::Create(SrcNMD, Dest); - else { - // Add Src elements into Dest node. - for (unsigned i = 0, e = SrcNMD->getNumOperands(); i != e; ++i) - DestNMD->addOperand(SrcNMD->getOperand(i)); - } + NamedMDNode *DestNMD = Dest->getOrInsertNamedMetadata(SrcNMD->getName()); + // Add Src elements into Dest node. + for (unsigned i = 0, e = SrcNMD->getNumOperands(); i != e; ++i) + DestNMD->addOperand(SrcNMD->getOperand(i)); } } |