From 961b7c2b5268191741a31e38a3d95df64084c51a Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Tue, 21 Jul 2015 19:38:32 +0000 Subject: [PATCH] Remove always null argument. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@242828 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Object/ELF.h | 37 ++------------------------------ tools/llvm-readobj/ELFDumper.cpp | 3 +-- 2 files changed, 3 insertions(+), 37 deletions(-) diff --git a/include/llvm/Object/ELF.h b/include/llvm/Object/ELF.h index 524d42540b7..4f7adbfa83e 100644 --- a/include/llvm/Object/ELF.h +++ b/include/llvm/Object/ELF.h @@ -245,8 +245,7 @@ public: ErrorOr getStringTableForSymtab(const Elf_Shdr &Section) const; const char *getDynamicString(uintX_t Offset) const; - ErrorOr getSymbolVersion(const Elf_Shdr *section, - const Elf_Sym *Symb, + ErrorOr getSymbolVersion(const Elf_Sym *Symb, bool &IsDefault) const; void VerifyStrTab(const Elf_Shdr *sh) const; @@ -904,40 +903,8 @@ ELFFile::getSectionName(const Elf_Shdr *Section) const { } template -ErrorOr ELFFile::getSymbolVersion(const Elf_Shdr *section, - const Elf_Sym *symb, +ErrorOr ELFFile::getSymbolVersion(const Elf_Sym *symb, bool &IsDefault) const { - StringRef StrTab; - if (section) { - ErrorOr StrTabOrErr = getStringTable(section); - if (std::error_code EC = StrTabOrErr.getError()) - return EC; - StrTab = *StrTabOrErr; - } - // Handle non-dynamic symbols. - if (section != DotDynSymSec && section != nullptr) { - // Non-dynamic symbols can have versions in their names - // A name of the form 'foo@V1' indicates version 'V1', non-default. - // A name of the form 'foo@@V2' indicates version 'V2', default version. - ErrorOr SymName = symb->getName(StrTab); - if (!SymName) - return SymName; - StringRef Name = *SymName; - size_t atpos = Name.find('@'); - if (atpos == StringRef::npos) { - IsDefault = false; - return StringRef(""); - } - ++atpos; - if (atpos < Name.size() && Name[atpos] == '@') { - IsDefault = true; - ++atpos; - } else { - IsDefault = false; - } - return Name.substr(atpos); - } - // This is a dynamic symbol. Look in the GNU symbol version table. if (!dot_gnu_version_sec) { // No version table. diff --git a/tools/llvm-readobj/ELFDumper.cpp b/tools/llvm-readobj/ELFDumper.cpp index 6f760ecdd27..44df3a8def5 100644 --- a/tools/llvm-readobj/ELFDumper.cpp +++ b/tools/llvm-readobj/ELFDumper.cpp @@ -134,8 +134,7 @@ static std::string getFullSymbolName(const ELFO &Obj, std::string FullSymbolName(SymbolName); bool IsDefault; - ErrorOr Version = - Obj.getSymbolVersion(nullptr, &*Symbol, IsDefault); + ErrorOr Version = Obj.getSymbolVersion(&*Symbol, IsDefault); if (Version) { FullSymbolName += (IsDefault ? "@@" : "@"); FullSymbolName += *Version; -- 2.34.1