[PATCH] D65393: [llvm/Object] - Remove ELFFile<ELFT>::getSection(const StringRef SectionName). NFC.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 29 07:37:07 PDT 2019


grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.

This method is dead. It was introduced in D47989 <https://reviews.llvm.org/D47989>,
but now the logic from D63475 <https://reviews.llvm.org/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.


https://reviews.llvm.org/D65393

Files:
  include/llvm/Object/ELF.h


Index: include/llvm/Object/ELF.h
===================================================================
--- include/llvm/Object/ELF.h
+++ include/llvm/Object/ELF.h
@@ -568,23 +568,6 @@
   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 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65393.212145.patch
Type: text/x-patch
Size: 864 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190729/20e24ee4/attachment-0001.bin>


More information about the llvm-commits mailing list