[lld] r256367 - Return early and remove a redundant error check. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 24 00:36:57 PST 2015
Author: ruiu
Date: Thu Dec 24 02:36:56 2015
New Revision: 256367
URL: http://llvm.org/viewvc/llvm-project?rev=256367&view=rev
Log:
Return early and remove a redundant error check. NFC.
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=256367&r1=256366&r2=256367&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Thu Dec 24 02:36:56 2015
@@ -61,16 +61,13 @@ ELFFileBase<ELFT>::getSymbolsHelper(bool
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() {
More information about the llvm-commits
mailing list