From 7c492e24c28d4cef9b6d5b5c10be8df2209b0fad Mon Sep 17 00:00:00 2001 From: George Rimar Date: Mon, 5 Aug 2019 11:19:28 +0000 Subject: [PATCH] [llvm/Object] - Remove ELFFile::getSection(const StringRef SectionName). NFC. This method is dead. It was introduced in D47989, but now the logic from D63475 is used in llvm-readobj instead. Also it has a problem: it returns the first matching section, even if there are multiple sections with the same name. Differential revision: https://reviews.llvm.org/D65393 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@367833 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Object/ELF.h | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/include/llvm/Object/ELF.h b/include/llvm/Object/ELF.h index c18453d1155..aa0864edb78 100644 --- a/include/llvm/Object/ELF.h +++ b/include/llvm/Object/ELF.h @@ -271,7 +271,6 @@ public: Elf_Sym_Range Symtab, ArrayRef ShndxTable) const; Expected getSection(uint32_t Index) const; - Expected getSection(const StringRef SectionName) const; Expected getSymbol(const Elf_Shdr *Sec, uint32_t Index) const; @@ -568,23 +567,6 @@ ELFFile::getSection(uint32_t Index) const { return object::getSection(*TableOrErr, Index); } -template -Expected -ELFFile::getSection(const StringRef SectionName) const { - auto TableOrErr = sections(); - if (!TableOrErr) - return TableOrErr.takeError(); - for (auto &Sec : *TableOrErr) { - auto SecNameOrErr = getSectionName(&Sec); - if (!SecNameOrErr) - return SecNameOrErr.takeError(); - if (*SecNameOrErr == SectionName) - return &Sec; - } - // TODO: this error is untested. - return createError("invalid section name"); -} - template Expected ELFFile::getStringTable(const Elf_Shdr *Section) const { -- 2.40.0