Return early and remove a redundant error check. NFC.

llvm-svn: 256367
This commit is contained in:
Rui Ueyama 2015-12-24 08:36:56 +00:00
parent 9a5a83a518
commit dc8d3a2104
1 changed files with 6 additions and 9 deletions

View File

@ -61,16 +61,13 @@ ELFFileBase<ELFT>::getSymbolsHelper(bool Local) {
template <class ELFT>
uint32_t ELFFileBase<ELFT>::getSectionIndex(const Elf_Sym &Sym) const {
uint32_t Index = Sym.st_shndx;
if (Index == ELF::SHN_XINDEX)
Index = this->ELFObj.getExtendedSymbolTableIndex(&Sym, this->Symtab,
SymtabSHNDX);
else if (Index == ELF::SHN_UNDEF || Index >= ELF::SHN_LORESERVE)
uint32_t I = Sym.st_shndx;
if (I == ELF::SHN_XINDEX)
return this->ELFObj.getExtendedSymbolTableIndex(&Sym, this->Symtab,
SymtabSHNDX);
if (I >= ELF::SHN_LORESERVE)
return 0;
if (!Index)
error("Invalid section index");
return Index;
return I;
}
template <class ELFT> void ELFFileBase<ELFT>::initStringTable() {