[ELF/LTO] Refactor to reduce indentation.
authorDavide Italiano <davide@freebsd.org>
Sat, 26 Mar 2016 18:33:09 +0000 (18:33 +0000)
committerDavide Italiano <davide@freebsd.org>
Sat, 26 Mar 2016 18:33:09 +0000 (18:33 +0000)
Suggested by: Rui Ueyama.

llvm-svn: 264518

lld/ELF/LTO.cpp

index 7b1c31a..cbdd49a 100644 (file)
@@ -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,