[lld] r338957 - [LLD][ELF] - Removed dead code from rangeToString(). NFC.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 4 03:56:27 PDT 2018


Author: grimar
Date: Sat Aug  4 03:56:26 2018
New Revision: 338957

URL: http://llvm.org/viewvc/llvm-project?rev=338957&view=rev
Log:
[LLD][ELF] - Removed dead code from rangeToString(). NFC.

This change removes the dead code and makes cosmetic change
showing why it was dead.

Modified:
    lld/trunk/ELF/Writer.cpp

Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=338957&r1=338956&r2=338957&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Sat Aug  4 03:56:26 2018
@@ -2006,8 +2006,6 @@ template <class ELFT> void Writer<ELFT>:
 }
 
 static std::string rangeToString(uint64_t Addr, uint64_t Len) {
-  if (Len == 0)
-    return "<empty range at 0x" + utohexstr(Addr) + ">";
   return "[0x" + utohexstr(Addr) + ", 0x" + utohexstr(Addr + Len - 1) + "]";
 }
 
@@ -2150,7 +2148,7 @@ template <class ELFT> void Writer<ELFT>:
   // file so we skip any non-allocated sections in that case.
   std::vector<SectionOffset> FileOffs;
   for (OutputSection *Sec : OutputSections)
-    if (0 < Sec->Size && Sec->Type != SHT_NOBITS &&
+    if (Sec->Size > 0 && Sec->Type != SHT_NOBITS &&
         (!Config->OFormatBinary || (Sec->Flags & SHF_ALLOC)))
       FileOffs.push_back({Sec, Sec->Offset});
   checkOverlap("file", FileOffs, false);
@@ -2168,7 +2166,7 @@ template <class ELFT> void Writer<ELFT>:
   // ranges in the file.
   std::vector<SectionOffset> VMAs;
   for (OutputSection *Sec : OutputSections)
-    if (0 < Sec->Size && (Sec->Flags & SHF_ALLOC) && !(Sec->Flags & SHF_TLS))
+    if (Sec->Size > 0 && (Sec->Flags & SHF_ALLOC) && !(Sec->Flags & SHF_TLS))
       VMAs.push_back({Sec, Sec->Addr});
   checkOverlap("virtual address", VMAs, true);
 
@@ -2177,7 +2175,7 @@ template <class ELFT> void Writer<ELFT>:
   // script with AT().
   std::vector<SectionOffset> LMAs;
   for (OutputSection *Sec : OutputSections)
-    if (0 < Sec->Size && (Sec->Flags & SHF_ALLOC) && !(Sec->Flags & SHF_TLS))
+    if (Sec->Size > 0 && (Sec->Flags & SHF_ALLOC) && !(Sec->Flags & SHF_TLS))
       LMAs.push_back({Sec, Sec->getLMA()});
   checkOverlap("load address", LMAs, false);
 }




More information about the llvm-commits mailing list