diff options
author | Victor Hernandez <vhernandez@apple.com> | 2010-02-06 01:31:55 +0000 |
---|---|---|
committer | Victor Hernandez <vhernandez@apple.com> | 2010-02-06 01:31:55 +0000 |
commit | c8d7b85ba133f6e590d1c3ac78d47c88914aedea (patch) | |
tree | 7b0eb76b843e4ed14156883b3593bfe16652b5bd /lib/Linker | |
parent | 2b3365ca1dd53b078714ec99b5b2ea6b67b23c9c (diff) | |
download | external_llvm-c8d7b85ba133f6e590d1c3ac78d47c88914aedea.zip external_llvm-c8d7b85ba133f6e590d1c3ac78d47c88914aedea.tar.gz external_llvm-c8d7b85ba133f6e590d1c3ac78d47c88914aedea.tar.bz2 |
Linker should not remap null operands of metadata
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95468 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Linker')
-rw-r--r-- | lib/Linker/LinkModules.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 279c4be..7f441b0 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -395,8 +395,12 @@ static Value *RemapOperand(const Value *In, } else if (const MDNode *MD = dyn_cast<MDNode>(In)) { if (MD->isFunctionLocal()) { SmallVector<Value*, 4> Elts; - for (unsigned i = 0, e = MD->getNumOperands(); i != e; ++i) - Elts.push_back(RemapOperand(MD->getOperand(i), ValueMap)); + for (unsigned i = 0, e = MD->getNumOperands(); i != e; ++i) { + if (MD->getOperand(i)) + Elts.push_back(RemapOperand(MD->getOperand(i), ValueMap)); + else + Elts.push_back(NULL); + } Result = MDNode::get(In->getContext(), Elts.data(), MD->getNumOperands()); } else { Result = const_cast<Value*>(In); |