From c8d7b85ba133f6e590d1c3ac78d47c88914aedea Mon Sep 17 00:00:00 2001 From: Victor Hernandez Date: Sat, 6 Feb 2010 01:31:55 +0000 Subject: 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 --- lib/Linker/LinkModules.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lib/Linker/LinkModules.cpp') 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(In)) { if (MD->isFunctionLocal()) { SmallVector 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(In); -- cgit v1.1