[llvm] r219804 - Use 'auto' for easier reading; no functional change intended.

Reid Kleckner rnk at google.com
Wed Oct 15 10:28:48 PDT 2014


On Wed, Oct 15, 2014 at 9:57 AM, Sanjay Patel <spatel at rotateright.com>
wrote:

> Thanks for the hint! I wasn't sure what to do there because this seemed a
> bit weird:
>    if (const OverflowingBinaryOperator *OBO =
> dyn_cast<OverflowingBinaryOperator>(V)) {
>
> We're not specifying 'const' in the dyn_cast itself in the first two
> instances...although in the last case we did:
>    else if (const FPMathOperator *FPMO = dyn_cast<const
> FPMathOperator>(V)) {
>
> Should I add the 2nd 'const' inside the dyn_cast< > for all cases as well
> as on the 'auto'?
>

The LLVM casting machinery is appropriately overloaded so that you don't
have to write the const yourself. We generally rely on that instead of
writing it out.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141015/97f5fad1/attachment.html>


More information about the llvm-commits mailing list