]> granicus.if.org Git - llvm/commitdiff
[llvm/Object] - Remove ELFFile<ELFT>::getSection(const StringRef SectionName). NFC.
authorGeorge Rimar <grimar@accesssoftek.com>
Mon, 5 Aug 2019 11:19:28 +0000 (11:19 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Mon, 5 Aug 2019 11:19:28 +0000 (11:19 +0000)
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

index c18453d1155c2421812babaa0f1e2ecd9e00437f..aa0864edb78bcf14ab8350022e5b0c283b3fbad2 100644 (file)
@@ -271,7 +271,6 @@ public:
                                         Elf_Sym_Range Symtab,
                                         ArrayRef<Elf_Word> ShndxTable) const;
   Expected<const Elf_Shdr *> getSection(uint32_t Index) const;
-  Expected<const Elf_Shdr *> getSection(const StringRef SectionName) const;
 
   Expected<const Elf_Sym *> getSymbol(const Elf_Shdr *Sec,
                                       uint32_t Index) const;
@@ -568,23 +567,6 @@ ELFFile<ELFT>::getSection(uint32_t Index) const {
   return object::getSection<ELFT>(*TableOrErr, Index);
 }
 
-template <class ELFT>
-Expected<const typename ELFT::Shdr *>
-ELFFile<ELFT>::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 <class ELFT>
 Expected<StringRef>
 ELFFile<ELFT>::getStringTable(const Elf_Shdr *Section) const {