diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-06-26 12:18:49 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-06-26 12:18:49 +0000 |
commit | 2fa80cc5fde697acfc8c69c38e2648aee063d5b7 (patch) | |
tree | ed0c7c8b7d72f217cfd0af85bef7b4a3f0027613 /llvm/lib/Object/MachOObjectFile.cpp | |
parent | 99a9343ae6b9244b8933cef099e6fff70610f59b (diff) | |
download | llvm-2fa80cc5fde697acfc8c69c38e2648aee063d5b7.zip llvm-2fa80cc5fde697acfc8c69c38e2648aee063d5b7.tar.gz llvm-2fa80cc5fde697acfc8c69c38e2648aee063d5b7.tar.bz2 |
Simplify getSymbolType.
This is still a really odd function. Most calls are in object format specific
contexts and should probably be replaced with a more direct query, but at least
now this is not too obnoxious to use.
llvm-svn: 240777
Diffstat (limited to 'llvm/lib/Object/MachOObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/MachOObjectFile.cpp | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/llvm/lib/Object/MachOObjectFile.cpp b/llvm/lib/Object/MachOObjectFile.cpp index 62a0d60..bb914ee 100644 --- a/llvm/lib/Object/MachOObjectFile.cpp +++ b/llvm/lib/Object/MachOObjectFile.cpp @@ -399,28 +399,21 @@ uint64_t MachOObjectFile::getCommonSymbolSizeImpl(DataRefImpl DRI) const { return Value; } -std::error_code MachOObjectFile::getSymbolType(DataRefImpl Symb, - SymbolRef::Type &Res) const { +SymbolRef::Type MachOObjectFile::getSymbolType(DataRefImpl Symb) const { MachO::nlist_base Entry = getSymbolTableEntryBase(this, Symb); uint8_t n_type = Entry.n_type; - Res = SymbolRef::ST_Other; - // If this is a STAB debugging symbol, we can do nothing more. - if (n_type & MachO::N_STAB) { - Res = SymbolRef::ST_Debug; - return std::error_code(); - } + if (n_type & MachO::N_STAB) + return SymbolRef::ST_Debug; switch (n_type & MachO::N_TYPE) { case MachO::N_UNDF : - Res = SymbolRef::ST_Unknown; - break; + return SymbolRef::ST_Unknown; case MachO::N_SECT : - Res = SymbolRef::ST_Function; - break; + return SymbolRef::ST_Function; } - return std::error_code(); + return SymbolRef::ST_Other; } uint32_t MachOObjectFile::getSymbolFlags(DataRefImpl DRI) const { @@ -576,8 +569,7 @@ bool MachOObjectFile::isSectionVirtual(DataRefImpl Sec) const { bool MachOObjectFile::sectionContainsSymbol(DataRefImpl Sec, DataRefImpl Symb) const { - SymbolRef::Type ST; - this->getSymbolType(Symb, ST); + SymbolRef::Type ST = getSymbolType(Symb); if (ST == SymbolRef::ST_Unknown) return false; |