<div dir="ltr">Ah, no worries - thanks for your attention/responses!</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 8, 2016 at 3:55 PM, Davide Italiano <span dir="ltr"><<a href="mailto:davide@freebsd.org" target="_blank">davide@freebsd.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Mon, Feb 8, 2016 at 3:53 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
><br>
><br>
> On Mon, Feb 8, 2016 at 3:51 PM, Davide Italiano <<a href="mailto:davide@freebsd.org">davide@freebsd.org</a>> wrote:<br>
>><br>
>> On Mon, Feb 8, 2016 at 3:04 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br>
>> ><br>
>> ><br>
>> > On Mon, Feb 8, 2016 at 2:58 PM, Davide Italiano via llvm-commits<br>
>> > <<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> wrote:<br>
>> >><br>
>> >> 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:<br>
>> >><br>
>> >> <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>
>> >><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<br>
>> >> this<br>
>> >> // will be in bss or not, but we could approximate.<br>
>> >> - return 'd';<br>
>> >> + return (GV.getValueType()->isFunctionTy()) ? 't' : 'd';<br>
>> ><br>
>> ><br>
>> > Drop the excess parens around the condition expression ^<br>
>> ><br>
>> >><br>
>> >> }<br>
>> >><br>
>> >> static char getSymbolNMTypeChar(IRObjectFile &Obj,<br>
>> >> basic_symbol_iterator<br>
>> >> 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>
>> ><br>
>> ><br>
>> > Same here (though I admit this one's a bit more interesting/might be<br>
>> > helpful<br>
>> > for precedence comfort) and below.<br>
>> ><br>
>> >><br>
>> >> }<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() ==<br>
>> >> ELF::STT_OBJECT;<br>
>> >> }<br>
>> >><br>
>> >> static char getNMTypeChar(SymbolicFile &Obj, basic_symbol_iterator I)<br>
>> >> {<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>
>> ><br>
>> ><br>
>><br>
>> Uh, sure. The second one makes me a little bit uncomfortable, but, if<br>
>> it's the preferred style, I won't argue further.<br>
><br>
><br>
> The first is, I tihnk, sufficiently obvious as to say the change is<br>
> obviously good. The 2nd and 3rd I leave to your discretion.<br>
><br>
> - David<br>
<br>
</div></div>I changed them all. r260173. Again, thanks a lot for all your post<br>
commit reviews!<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
--<br>
Davide<br>
<br>
"There are no solved problems; there are only problems that are more<br>
or less solved" -- Henri Poincare<br>
</div></div></blockquote></div><br></div>