[lld] r264518 - [ELF/LTO] Refactor to reduce indentation.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 26 11:33:09 PDT 2016


Author: davide
Date: Sat Mar 26 13:33:09 2016
New Revision: 264518

URL: http://llvm.org/viewvc/llvm-project?rev=264518&view=rev
Log:
[ELF/LTO] Refactor to reduce indentation.

Suggested by: Rui Ueyama.

Modified:
    lld/trunk/ELF/LTO.cpp

Modified: lld/trunk/ELF/LTO.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LTO.cpp?rev=264518&r1=264517&r2=264518&view=diff
==============================================================================
--- lld/trunk/ELF/LTO.cpp (original)
+++ lld/trunk/ELF/LTO.cpp Sat Mar 26 13:33:09 2016
@@ -82,22 +82,22 @@ void BitcodeCompiler::add(BitcodeFile &F
       Keep.push_back(GV);
       continue;
     }
-    if (!BitcodeFile::shouldSkip(Sym)) {
-      if (SymbolBody *B = Bodies[BodyIndex++])
-        if (&B->repl() == B && isa<DefinedBitcode>(B)) {
-          switch (GV->getLinkage()) {
-          default:
-            break;
-          case llvm::GlobalValue::LinkOnceAnyLinkage:
-            GV->setLinkage(GlobalValue::WeakAnyLinkage);
-            break;
-          case llvm::GlobalValue::LinkOnceODRLinkage:
-            GV->setLinkage(GlobalValue::WeakODRLinkage);
-            break;
-          }
-          Keep.push_back(GV);
-        }
+    if (BitcodeFile::shouldSkip(Sym))
+      continue;
+    SymbolBody *B = Bodies[BodyIndex++];
+    if (!B || &B->repl() != B || !isa<DefinedBitcode>(B))
+      continue;
+    switch (GV->getLinkage()) {
+    default:
+      break;
+    case llvm::GlobalValue::LinkOnceAnyLinkage:
+      GV->setLinkage(GlobalValue::WeakAnyLinkage);
+      break;
+    case llvm::GlobalValue::LinkOnceODRLinkage:
+      GV->setLinkage(GlobalValue::WeakODRLinkage);
+      break;
     }
+    Keep.push_back(GV);
   }
 
   Mover.move(Obj->takeModule(), Keep,




More information about the llvm-commits mailing list