From 254e67955faf8653f221fef608ff50eed9e36cf0 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Mon, 8 Dec 2014 13:35:09 +0000 Subject: [PATCH] Simple style fixes. * Use a range loop. * Move simple continue checks earlier. * clang-format. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223654 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Linker/LinkModules.cpp | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 9834502a0dd..fe406986fd6 100644 --- a/lib/Linker/LinkModules.cpp +++ b/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) { - // Skip if not linking from source. - if (DoNotLinkFromSource.count(SF)) continue; - - Function *DF = cast(ValueMap[SF]); - - // Link in the prefix data. - 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)); - + for (Function &SF : *SrcM) { // Skip if no body (function is external). - if (SF->isDeclaration()) + if (SF.isDeclaration()) continue; - if (linkFunctionBody(DF, SF)) + // Skip if not linking from source. + if (DoNotLinkFromSource.count(&SF)) + continue; + + Function *DF = cast(ValueMap[&SF]); + + // Link in the prefix data. + 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 (linkFunctionBody(DF, &SF)) return true; }