diff options
author | Owen Anderson <resistor@mac.com> | 2010-12-18 07:37:18 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2010-12-18 07:37:18 +0000 |
commit | fffa8635361639acadb78089c5b9b445c0aa1d30 (patch) | |
tree | c292730164461e0c80923e64b4f1c2c4f5e3c6ad /lib/Linker | |
parent | 3132780a2ed58945b0ec5033002be44bedb6b785 (diff) | |
download | external_llvm-fffa8635361639acadb78089c5b9b445c0aa1d30.zip external_llvm-fffa8635361639acadb78089c5b9b445c0aa1d30.tar.gz external_llvm-fffa8635361639acadb78089c5b9b445c0aa1d30.tar.bz2 |
Revert r122143 through r122140, which collectively broke the LLVMC tests on
the buildbots.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122149 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Linker')
-rw-r--r-- | lib/Linker/LinkModules.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index f6c7d03..dd0b07e 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -449,7 +449,7 @@ static void LinkNamedMDNodes(Module *Dest, Module *Src, 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) + for (unsigned i = 0, e = SrcNMD->getNumOperands(); i != e; ++i) DestNMD->addOperand(cast<MDNode>(MapValue(SrcNMD->getOperand(i), ValueMap, true))); @@ -559,14 +559,14 @@ static bool LinkGlobals(Module *Dest, const Module *Src, // we are replacing may be a function (if a prototype, weak, etc) or a // global variable. GlobalVariable *NewDGV = - new GlobalVariable(*Dest, SGV->getType()->getElementType(), - SGV->isConstant(), NewLinkage, /*init*/0, + new GlobalVariable(*Dest, SGV->getType()->getElementType(), + SGV->isConstant(), NewLinkage, /*init*/0, DGV->getName(), 0, false, SGV->getType()->getAddressSpace()); // Propagate alignment, section, and visibility info. CopyGVAttributes(NewDGV, SGV); - DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewDGV, + DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewDGV, DGV->getType())); // DGV will conflict with NewDGV because they both had the same @@ -928,7 +928,7 @@ static bool LinkFunctionProtos(Module *Dest, const Module *Src, CopyGVAttributes(NewDF, SF); // Any uses of DF need to change to NewDF, with cast - DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewDF, + DGV->replaceAllUsesWith(ConstantExpr::getBitCast(NewDF, DGV->getType())); // DF will conflict with NewDF because they both had the same. We must @@ -1017,7 +1017,7 @@ static bool LinkFunctionBody(Function *Dest, Function *Src, Value *Old = MI->second; if (!isa<Instruction>(Old) && !isa<BasicBlock>(Old)) { Value *New = MapValue(Old, ValueMap, true); - if (New != Old) + if (New != Old) I->setMetadata(MI->first, cast<MDNode>(New)); } } @@ -1100,7 +1100,7 @@ static bool LinkAppendingVars(Module *M, "Appending variables with different section name need to be linked!"); unsigned NewSize = T1->getNumElements() + T2->getNumElements(); - ArrayType *NewType = ArrayType::get(T1->getElementType(), + ArrayType *NewType = ArrayType::get(T1->getElementType(), NewSize); G1->setName(""); // Clear G1's name in case of a conflict! @@ -1144,7 +1144,7 @@ static bool LinkAppendingVars(Module *M, // getelementptr instructions to not use the Cast! G1->replaceAllUsesWith(ConstantExpr::getBitCast(NG, G1->getType())); - G2->replaceAllUsesWith(ConstantExpr::getBitCast(NG, + G2->replaceAllUsesWith(ConstantExpr::getBitCast(NG, G2->getType())); // Remove the two globals from the module now... @@ -1301,9 +1301,10 @@ Linker::LinkModules(Module *Dest, Module *Src, std::string *ErrorMsg) { // If the source library's module id is in the dependent library list of the // destination library, remove it since that module is now linked in. - const std::string &modId = Src->getModuleIdentifier(); - if (!modId.empty()) - Dest->removeLibrary(sys::path::stem(modId)); + sys::Path modId; + modId.set(Src->getModuleIdentifier()); + if (!modId.isEmpty()) + Dest->removeLibrary(modId.getBasename()); return false; } |