From f97d0cbe58300f089195288ab738f532f552163a Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 8 Dec 2014 13:35:09 +0000 Subject: Simple style fixes. * Use a range loop. * Move simple continue checks earlier. * clang-format. llvm-svn: 223654 --- llvm/lib/Linker/LinkModules.cpp | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'llvm/lib/Linker/LinkModules.cpp') diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp index 9834502a0dd..fe406986fd6 100644 --- a/llvm/lib/Linker/LinkModules.cpp +++ b/llvm/lib/Linker/LinkModules.cpp @@ -1475,27 +1475,28 @@ bool ModuleLinker::run() { // Link in the function bodies that are defined in the source module into // DstM. - for (Module::iterator SF = SrcM->begin(), E = SrcM->end(); SF != E; ++SF) { + for (Function &SF : *SrcM) { + // Skip if no body (function is external). + if (SF.isDeclaration()) + continue; + // Skip if not linking from source. - if (DoNotLinkFromSource.count(SF)) continue; + if (DoNotLinkFromSource.count(&SF)) + continue; - Function *DF = cast(ValueMap[SF]); + Function *DF = cast(ValueMap[&SF]); // Link in the prefix data. - if (SF->hasPrefixData()) - DF->setPrefixData(MapValue( - SF->getPrefixData(), ValueMap, RF_None, &TypeMap, &ValMaterializer)); + if (SF.hasPrefixData()) + DF->setPrefixData(MapValue(SF.getPrefixData(), ValueMap, RF_None, + &TypeMap, &ValMaterializer)); // Link in the prologue data. - if (SF->hasPrologueData()) - DF->setPrologueData(MapValue( - SF->getPrologueData(), ValueMap, RF_None, &TypeMap, &ValMaterializer)); + if (SF.hasPrologueData()) + DF->setPrologueData(MapValue(SF.getPrologueData(), ValueMap, RF_None, + &TypeMap, &ValMaterializer)); - // Skip if no body (function is external). - if (SF->isDeclaration()) - continue; - - if (linkFunctionBody(DF, SF)) + if (linkFunctionBody(DF, &SF)) return true; } -- cgit v1.2.3