Skip to content

Commit

Permalink
[llvm-nm] Yet another attempt of simplifying code.
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@260166 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
dcci committed Feb 8, 2016
1 parent fb2b3b0 commit 68c43d4
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions tools/llvm-nm/llvm-nm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -791,26 +791,20 @@ static char getSymbolNMTypeChar(MachOObjectFile &Obj, basic_symbol_iterator I) {
}

static char getSymbolNMTypeChar(const GlobalValue &GV) {
if (GV.getValueType()->isFunctionTy())
return 't';
// FIXME: should we print 'b'? At the IR level we cannot be sure if this
// will be in bss or not, but we could approximate.
return 'd';
return (GV.getValueType()->isFunctionTy()) ? 't' : 'd';
}

static char getSymbolNMTypeChar(IRObjectFile &Obj, basic_symbol_iterator I) {
const GlobalValue *GV = Obj.getSymbolGV(I->getRawDataRefImpl());
if (!GV)
return 't';
return getSymbolNMTypeChar(*GV);
return (!GV) ? 't' : getSymbolNMTypeChar(*GV);
}

static bool isObject(SymbolicFile &Obj, basic_symbol_iterator I) {
auto *ELF = dyn_cast<ELFObjectFileBase>(&Obj);
if (!ELF)
return false;

return elf_symbol_iterator(I)->getELFType() == ELF::STT_OBJECT;
return (!dyn_cast<ELFObjectFileBase>(&Obj))
? false
: elf_symbol_iterator(I)->getELFType() == ELF::STT_OBJECT;
}

static char getNMTypeChar(SymbolicFile &Obj, basic_symbol_iterator I) {
Expand Down

0 comments on commit 68c43d4

Please sign in to comment.