[lld] r250054 - Early return.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 12 08:49:03 PDT 2015


Author: ruiu
Date: Mon Oct 12 10:49:02 2015
New Revision: 250054

URL: http://llvm.org/viewvc/llvm-project?rev=250054&view=rev
Log:
Early return.

Modified:
    lld/trunk/ELF/InputFiles.cpp

Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=250054&r1=250053&r2=250054&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Mon Oct 12 10:49:02 2015
@@ -281,19 +281,19 @@ template <class ELFT> void SharedFile<EL
   this->initStringTable();
   this->SoName = this->getName();
 
-  if (DynamicSec) {
-    auto *Begin =
-        reinterpret_cast<const Elf_Dyn *>(Obj.base() + DynamicSec->sh_offset);
-    const Elf_Dyn *End = Begin + DynamicSec->sh_size / sizeof(Elf_Dyn);
+  if (!DynamicSec)
+    return;
+  auto *Begin =
+      reinterpret_cast<const Elf_Dyn *>(Obj.base() + DynamicSec->sh_offset);
+  const Elf_Dyn *End = Begin + DynamicSec->sh_size / sizeof(Elf_Dyn);
 
-    for (const Elf_Dyn &Dyn : make_range(Begin, End)) {
-      if (Dyn.d_tag == DT_SONAME) {
-        uintX_t Val = Dyn.getVal();
-        if (Val >= this->StringTable.size())
-          error("Invalid DT_SONAME entry");
-        this->SoName = StringRef(this->StringTable.data() + Val);
-        break;
-      }
+  for (const Elf_Dyn &Dyn : make_range(Begin, End)) {
+    if (Dyn.d_tag == DT_SONAME) {
+      uintX_t Val = Dyn.getVal();
+      if (Val >= this->StringTable.size())
+        error("Invalid DT_SONAME entry");
+      this->SoName = StringRef(this->StringTable.data() + Val);
+      return;
     }
   }
 }




More information about the llvm-commits mailing list