<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 8, 2016 at 2:58 PM, Davide Italiano via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: davide<br>
Date: Mon Feb 8 16:58:26 2016<br>
New Revision: 260166<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=260166&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=260166&view=rev</a><br>
Log:<br>
[llvm-nm] Yet another attempt of simplifying code.<br>
<br>
Modified:<br>
llvm/trunk/tools/llvm-nm/llvm-nm.cpp<br>
<br>
Modified: llvm/trunk/tools/llvm-nm/llvm-nm.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-nm/llvm-nm.cpp?rev=260166&r1=260165&r2=260166&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-nm/llvm-nm.cpp?rev=260166&r1=260165&r2=260166&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/tools/llvm-nm/llvm-nm.cpp (original)<br>
+++ llvm/trunk/tools/llvm-nm/llvm-nm.cpp Mon Feb 8 16:58:26 2016<br>
@@ -791,26 +791,20 @@ static char getSymbolNMTypeChar(MachOObj<br>
}<br>
<br>
static char getSymbolNMTypeChar(const GlobalValue &GV) {<br>
- if (GV.getValueType()->isFunctionTy())<br>
- return 't';<br>
// FIXME: should we print 'b'? At the IR level we cannot be sure if this<br>
// will be in bss or not, but we could approximate.<br>
- return 'd';<br>
+ return (GV.getValueType()->isFunctionTy()) ? 't' : 'd';<br></blockquote><div><br></div><div>Drop the excess parens around the condition expression ^</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
}<br>
<br>
static char getSymbolNMTypeChar(IRObjectFile &Obj, basic_symbol_iterator I) {<br>
const GlobalValue *GV = Obj.getSymbolGV(I->getRawDataRefImpl());<br>
- if (!GV)<br>
- return 't';<br>
- return getSymbolNMTypeChar(*GV);<br>
+ return (!GV) ? 't' : getSymbolNMTypeChar(*GV);<br></blockquote><div><br>Same here (though I admit this one's a bit more interesting/might be helpful for precedence comfort) and below.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
}<br>
<br>
static bool isObject(SymbolicFile &Obj, basic_symbol_iterator I) {<br>
- auto *ELF = dyn_cast<ELFObjectFileBase>(&Obj);<br>
- if (!ELF)<br>
- return false;<br>
-<br>
- return elf_symbol_iterator(I)->getELFType() == ELF::STT_OBJECT;<br>
+ return (!dyn_cast<ELFObjectFileBase>(&Obj))<br>
+ ? false<br>
+ : elf_symbol_iterator(I)->getELFType() == ELF::STT_OBJECT;<br>
}<br>
<br>
static char getNMTypeChar(SymbolicFile &Obj, basic_symbol_iterator I) {<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>