[PATCH] D27934: [APFloat] Remove 'else' after return. NFC

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 19 18:30:27 PST 2016


mehdi_amini added inline comments.


================
Comment at: llvm/include/llvm/ADT/APFloat.h:772-774
     } else {
       llvm_unreachable("Unexpected semantics");
     }
----------------
timshen wrote:
> mehdi_amini wrote:
> > Why aren't you doing the same transformation as before here?
> This will also work:
>     if (usesLayout<IEEEFloat>(*U.semantics))
>       return U.IEEE.makeInf(Neg);
>     if (usesLayout<DoubleAPFloat>(*U.semantics))
>       return U.Double.makeInf(Neg);
>     llvm_unreachable("Unexpected semantics");
> 
> But @jtony have opinions on returning an expression as void in D27872, and suggested removing the void.
> 
> I'm slightly in favor of the early return version, since it's more consistent with other places; but I didn't have many data points from others. I'm happy to change.
This seems both more compact, and consistent with the other cases, so it has my preference. 
I don't object to the argument that someone may find undesirable to return a void call, but then we should call it out in the coding guidelines.


https://reviews.llvm.org/D27934





More information about the llvm-commits mailing list