diff options
author | Dan Gohman <gohman@apple.com> | 2010-08-24 19:31:04 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-08-24 19:31:04 +0000 |
commit | e5835fbe7fb3d87b8cd110b24f0f9772384a5212 (patch) | |
tree | 5206e2ebc2b956d0d702433e70960aece60c95d6 /lib/Linker | |
parent | ae528f65ba731e2e080822496ef36db950ffe1c1 (diff) | |
download | external_llvm-e5835fbe7fb3d87b8cd110b24f0f9772384a5212.zip external_llvm-e5835fbe7fb3d87b8cd110b24f0f9772384a5212.tar.gz external_llvm-e5835fbe7fb3d87b8cd110b24f0f9772384a5212.tar.bz2 |
When linking NamedMDNodes, remap their operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111948 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Linker')
-rw-r--r-- | lib/Linker/LinkModules.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index fd9692d..016c82c 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -451,14 +451,16 @@ static bool GetLinkageResult(GlobalValue *Dest, const GlobalValue *Src, } // Insert all of the named mdnoes in Src into the Dest module. -static void LinkNamedMDNodes(Module *Dest, Module *Src) { +static void LinkNamedMDNodes(Module *Dest, Module *Src, + ValueToValueMapTy &ValueMap) { 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->getOrInsertNamedMetadata(SrcNMD->getName()); // Add Src elements into Dest node. for (unsigned i = 0, e = SrcNMD->getNumOperands(); i != e; ++i) - DestNMD->addOperand(SrcNMD->getOperand(i)); + DestNMD->addOperand(cast<MDNode>(MapValue(SrcNMD->getOperand(i), + ValueMap))); } } @@ -1243,7 +1245,7 @@ Linker::LinkModules(Module *Dest, Module *Src, std::string *ErrorMsg) { } // Insert all of the named mdnoes in Src into the Dest module. - LinkNamedMDNodes(Dest, Src); + LinkNamedMDNodes(Dest, Src, ValueMap); // Insert all of the globals in src into the Dest module... without linking // initializers (which could refer to functions not yet mapped over). |