aboutsummaryrefslogtreecommitdiff
path: root/lib/Linker/LinkModules.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2009-08-11 06:46:31 +0000
committerDevang Patel <dpatel@apple.com>2009-08-11 06:46:31 +0000
commitae709eaeb12e4a293e812c61514a9ebd9e24fe14 (patch)
tree6cc941194c6b767ceef5b2364a273b0a7983b178 /lib/Linker/LinkModules.cpp
parent9d3627ea27195534242ec8026a9b8c888b85bbba (diff)
Link metadata.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78652 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Linker/LinkModules.cpp')
-rw-r--r--lib/Linker/LinkModules.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp
index ccab2de7eb..3aec864c2d 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/lib/Linker/LinkModules.cpp
@@ -395,6 +395,14 @@ static Value *RemapOperand(const Value *In,
assert(!isa<GlobalValue>(CPV) && "Unmapped global?");
llvm_unreachable("Unknown type of derived type constant value!");
}
+ } else if (const MDNode *N = dyn_cast<MDNode>(In)) {
+ std::vector<Value*> Elems;
+ for (unsigned i = 0, e = N->getNumElements(); i !=e; ++i)
+ Elems.push_back(RemapOperand(N->getElement(i), ValueMap, Context));
+ if (!Elems.empty())
+ Result = MDNode::get(Context, &Elems[0], Elems.size());
+ } else if (const MDString *MDS = dyn_cast<MDString>(In)) {
+ Result = MDString::get(Context, MDS->getString());
} else if (isa<InlineAsm>(In)) {
Result = const_cast<Value*>(In);
}