[llvm] r260166 - [llvm-nm] Yet another attempt of simplifying code.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 8 14:58:26 PST 2016


Author: davide
Date: Mon Feb  8 16:58:26 2016
New Revision: 260166

URL: http://llvm.org/viewvc/llvm-project?rev=260166&view=rev
Log:
[llvm-nm] Yet another attempt of simplifying code.

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=260166&r1=260165&r2=260166&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-nm/llvm-nm.cpp (original)
+++ llvm/trunk/tools/llvm-nm/llvm-nm.cpp Mon Feb  8 16:58:26 2016
@@ -791,26 +791,20 @@ static char getSymbolNMTypeChar(MachOObj
 }
 
 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) {




More information about the llvm-commits mailing list