[llvm] r219804 - Use 'auto' for easier reading; no functional change intended.
Sanjay Patel
spatel at rotateright.com
Wed Oct 15 09:57:18 PDT 2014
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'?
On Wed, Oct 15, 2014 at 10:47 AM, David Blaikie <dblaikie at gmail.com> wrote:
> I /think/ we generally like to still specify the 'const' when using auto
> (like we specify the '*') - though this probably isn't a hard-and-fast
> rule, just a thought.
>
> On Wed, Oct 15, 2014 at 9:21 AM, Sanjay Patel <spatel at rotateright.com>
> wrote:
>
>> Author: spatel
>> Date: Wed Oct 15 11:21:37 2014
>> New Revision: 219804
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=219804&view=rev
>> Log:
>> Use 'auto' for easier reading; no functional change intended.
>>
>> Modified:
>> llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
>>
>> Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=219804&r1=219803&r2=219804&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
>> +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Wed Oct 15 11:21:37
>> 2014
>> @@ -710,18 +710,15 @@ static void WriteModuleInfo(const Module
>> static uint64_t GetOptimizationFlags(const Value *V) {
>> uint64_t Flags = 0;
>>
>> - if (const OverflowingBinaryOperator *OBO =
>> - dyn_cast<OverflowingBinaryOperator>(V)) {
>> + if (auto *OBO = dyn_cast<OverflowingBinaryOperator>(V)) {
>> if (OBO->hasNoSignedWrap())
>> Flags |= 1 << bitc::OBO_NO_SIGNED_WRAP;
>> if (OBO->hasNoUnsignedWrap())
>> Flags |= 1 << bitc::OBO_NO_UNSIGNED_WRAP;
>> - } else if (const PossiblyExactOperator *PEO =
>> - dyn_cast<PossiblyExactOperator>(V)) {
>> + } else if (auto *PEO = dyn_cast<PossiblyExactOperator>(V)) {
>> if (PEO->isExact())
>> Flags |= 1 << bitc::PEO_EXACT;
>> - } else if (const FPMathOperator *FPMO =
>> - dyn_cast<const FPMathOperator>(V)) {
>> + } else if (auto *FPMO = dyn_cast<const FPMathOperator>(V)) {
>> if (FPMO->hasUnsafeAlgebra())
>> Flags |= FastMathFlags::UnsafeAlgebra;
>> if (FPMO->hasNoNaNs())
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141015/3894ab2d/attachment.html>
More information about the llvm-commits
mailing list