[llvm] r260482 - [llvm-nm] Simplify code logic. Rewrite a single function an inline.
Davide Italiano via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 10 18:56:03 PST 2016
Author: davide
Date: Wed Feb 10 20:56:02 2016
New Revision: 260482
URL: http://llvm.org/viewvc/llvm-project?rev=260482&view=rev
Log:
[llvm-nm] Simplify code logic. Rewrite a single function an inline.
Modified:
llvm/trunk/tools/llvm-nm/llvm-nm.cpp
Modified: llvm/trunk/tools/llvm-nm/llvm-nm.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-nm/llvm-nm.cpp?rev=260482&r1=260481&r2=260482&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-nm/llvm-nm.cpp (original)
+++ llvm/trunk/tools/llvm-nm/llvm-nm.cpp Wed Feb 10 20:56:02 2016
@@ -774,18 +774,10 @@ static char getSymbolNMTypeChar(COFFObje
return '?';
}
-static uint8_t getNType(MachOObjectFile &Obj, DataRefImpl Symb) {
- if (Obj.is64Bit()) {
- MachO::nlist_64 STE = Obj.getSymbol64TableEntry(Symb);
- return STE.n_type;
- }
- MachO::nlist STE = Obj.getSymbolTableEntry(Symb);
- return STE.n_type;
-}
-
static char getSymbolNMTypeChar(MachOObjectFile &Obj, basic_symbol_iterator I) {
DataRefImpl Symb = I->getRawDataRefImpl();
- uint8_t NType = getNType(Obj, Symb);
+ uint8_t NType = Obj.is64Bit() ? Obj.getSymbol64TableEntry(Symb).n_type
+ : Obj.getSymbolTableEntry(Symb).n_type;
if (NType & MachO::N_STAB)
return '-';
@@ -898,14 +890,10 @@ static unsigned getNsectInMachO(MachOObj
DataRefImpl Symb = Sym.getRawDataRefImpl();
if (Obj.is64Bit()) {
MachO::nlist_64 STE = Obj.getSymbol64TableEntry(Symb);
- if ((STE.n_type & MachO::N_TYPE) == MachO::N_SECT)
- return STE.n_sect;
- return 0;
+ return (STE.n_type & MachO::N_TYPE) == MachO::N_SECT ? STE.n_sect : 0;
}
MachO::nlist STE = Obj.getSymbolTableEntry(Symb);
- if ((STE.n_type & MachO::N_TYPE) == MachO::N_SECT)
- return STE.n_sect;
- return 0;
+ return (STE.n_type & MachO::N_TYPE) == MachO::N_SECT ? STE.n_sect : 0;
}
static void dumpSymbolNamesFromObject(SymbolicFile &Obj, bool printName,
More information about the llvm-commits
mailing list