mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-17 04:24:00 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@240777 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user