[lld] r316880 - Remove unnecessary code.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 29 16:41:16 PDT 2017


Author: ruiu
Date: Sun Oct 29 16:41:16 2017
New Revision: 316880

URL: http://llvm.org/viewvc/llvm-project?rev=316880&view=rev
Log:
Remove unnecessary code.

Discarded section's Repl always points to itself, so returning
Sec is not different from returning Sec->Repl.

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=316880&r1=316879&r2=316880&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Sun Oct 29 16:41:16 2017
@@ -517,12 +517,9 @@ InputSectionBase *ObjFile<ELFT>::getSect
   if (Index >= this->Sections.size())
     fatal(toString(this) + ": invalid section index: " + Twine(Index));
 
-  InputSectionBase *Sec = this->Sections[Index];
-  if (!Sec)
-    return nullptr;
-  if (Sec == &InputSection::Discarded)
-    return Sec;
-  return Sec->Repl;
+  if (InputSectionBase *Sec = this->Sections[Index])
+    return Sec->Repl;
+  return nullptr;
 }
 
 template <class ELFT>




More information about the llvm-commits mailing list