[llvm] r222723 - Use range loops. NFC.
Rafael Espindola
rafael.espindola at gmail.com
Mon Nov 24 20:26:20 PST 2014
Author: rafael
Date: Mon Nov 24 22:26:19 2014
New Revision: 222723
URL: http://llvm.org/viewvc/llvm-project?rev=222723&view=rev
Log:
Use range loops. NFC.
Modified:
llvm/trunk/lib/Linker/LinkModules.cpp
Modified: llvm/trunk/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=222723&r1=222722&r2=222723&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/LinkModules.cpp (original)
+++ llvm/trunk/lib/Linker/LinkModules.cpp Mon Nov 24 22:26:19 2014
@@ -767,27 +767,25 @@ bool ModuleLinker::shouldLinkFromSource(
/// types 'Foo' but one got renamed when the module was loaded into the same
/// LLVMContext.
void ModuleLinker::computeTypeMapping() {
- // Incorporate globals.
- for (Module::global_iterator I = SrcM->global_begin(),
- E = SrcM->global_end(); I != E; ++I) {
- GlobalValue *DGV = getLinkedToGlobal(I);
- if (!DGV) continue;
+ for (GlobalValue &SGV : SrcM->globals()) {
+ GlobalValue *DGV = getLinkedToGlobal(&SGV);
+ if (!DGV)
+ continue;
- if (!DGV->hasAppendingLinkage() || !I->hasAppendingLinkage()) {
- TypeMap.addTypeMapping(DGV->getType(), I->getType());
+ if (!DGV->hasAppendingLinkage() || !SGV.hasAppendingLinkage()) {
+ TypeMap.addTypeMapping(DGV->getType(), SGV.getType());
continue;
}
// Unify the element type of appending arrays.
ArrayType *DAT = cast<ArrayType>(DGV->getType()->getElementType());
- ArrayType *SAT = cast<ArrayType>(I->getType()->getElementType());
+ ArrayType *SAT = cast<ArrayType>(SGV.getType()->getElementType());
TypeMap.addTypeMapping(DAT->getElementType(), SAT->getElementType());
}
- // Incorporate functions.
- for (Module::iterator I = SrcM->begin(), E = SrcM->end(); I != E; ++I) {
- if (GlobalValue *DGV = getLinkedToGlobal(I))
- TypeMap.addTypeMapping(DGV->getType(), I->getType());
+ for (GlobalValue &SGV : *SrcM) {
+ if (GlobalValue *DGV = getLinkedToGlobal(&SGV))
+ TypeMap.addTypeMapping(DGV->getType(), SGV.getType());
}
// Incorporate types by name, scanning all the types in the source module.
More information about the llvm-commits
mailing list