[llvm] r370580 - Fix cppcheck shadow variable and variable scope warnings. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 31 06:37:27 PDT 2019


It's too early - there's currently thousands of these warnings. I'm only 
touching the ones I come across when fixing other things (cppcheck warns 
me about them when I touch the file).

I'm slowly plodding through all the MSVC warnings we've disabled in 
HandleLLVMOptions.cmake to see which ones we can easily re-enable.

On 31/08/2019 13:54, Roman Lebedev wrote:
> Should we just enable -Wshadow?
> Any other diagnostics we'd might want?
>
> Roman
>
> On Sat, Aug 31, 2019 at 3:28 PM Simon Pilgrim via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>> Author: rksimon
>> Date: Sat Aug 31 05:30:19 2019
>> New Revision: 370580
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=370580&view=rev
>> Log:
>> Fix cppcheck shadow variable and variable scope warnings. NFCI.
>>
>> Modified:
>>      llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
>>
>> Modified: llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp?rev=370580&r1=370579&r2=370580&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp (original)
>> +++ llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp Sat Aug 31 05:30:19 2019
>> @@ -1346,12 +1346,12 @@ private:
>>         if (ReuseShuffleIndices.empty())
>>           dbgs() << "Emtpy";
>>         else
>> -        for (unsigned Idx : ReuseShuffleIndices)
>> -          dbgs() << Idx << ", ";
>> +        for (unsigned ReuseIdx : ReuseShuffleIndices)
>> +          dbgs() << ReuseIdx << ", ";
>>         dbgs() << "\n";
>>         dbgs() << "ReorderIndices: ";
>> -      for (unsigned Idx : ReorderIndices)
>> -        dbgs() << Idx << ", ";
>> +      for (unsigned ReorderIdx : ReorderIndices)
>> +        dbgs() << ReorderIdx << ", ";
>>         dbgs() << "\n";
>>         dbgs() << "UserTreeIndices: ";
>>         for (const auto &EInfo : UserTreeIndices)
>> @@ -6579,10 +6579,9 @@ static bool findBuildVector(InsertElemen
>>   /// \return true if it matches.
>>   static bool findBuildAggregate(InsertValueInst *IV,
>>                                  SmallVectorImpl<Value *> &BuildVectorOpds) {
>> -  Value *V;
>>     do {
>>       BuildVectorOpds.push_back(IV->getInsertedValueOperand());
>> -    V = IV->getAggregateOperand();
>> +    Value *V = IV->getAggregateOperand();
>>       if (isa<UndefValue>(V))
>>         break;
>>       IV = dyn_cast<InsertValueInst>(V);
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list