Remove unnecessary code.

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

llvm-svn: 316880
This commit is contained in:
Rui Ueyama 2017-10-29 23:41:16 +00:00
parent ea1398eeb3
commit 27f95a9ac3
1 changed files with 3 additions and 6 deletions

View File

@ -517,12 +517,9 @@ InputSectionBase *ObjFile<ELFT>::getSection(uint32_t Index) const {
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>