diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-11-02 12:49:55 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-11-02 12:49:55 +0000 |
| commit | 9d338fbb853454d021522daecb659f17e43653f6 (patch) | |
| tree | 95274159143b96eadb4d74f3cf20a7da7a10a868 | |
| parent | 5e31b3ad9300ef53175c026eab46555a3a25b457 (diff) | |
| download | bcm5719-llvm-9d338fbb853454d021522daecb659f17e43653f6.tar.gz bcm5719-llvm-9d338fbb853454d021522daecb659f17e43653f6.zip | |
Simplify getSection. NFC.
llvm-svn: 285803
| -rw-r--r-- | llvm/include/llvm/Object/ELF.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/include/llvm/Object/ELF.h b/llvm/include/llvm/Object/ELF.h index 3e0802e4855..4c3dc2ae809 100644 --- a/llvm/include/llvm/Object/ELF.h +++ b/llvm/include/llvm/Object/ELF.h @@ -415,11 +415,10 @@ ELFFile<ELFT>::getSection(uint32_t Index) const { if (Index >= getNumSections()) return object_error::invalid_section_index; - const uint8_t *Addr = reinterpret_cast<const uint8_t *>(SectionHeaderTable) + - (Index * Header->e_shentsize); - if (Addr >= base() + getBufSize()) + const Elf_Shdr *Addr = SectionHeaderTable + Index; + if (reinterpret_cast<const uint8_t *>(Addr) >= base() + getBufSize()) return object_error::invalid_section_index; - return reinterpret_cast<const Elf_Shdr *>(Addr); + return Addr; } template <class ELFT> |

