[polly] r202634 - C++11: Use foreach in ScopDetection

Tobias Grosser tobias at grosser.es
Sun Mar 2 09:11:57 PST 2014


On 03/02/2014 05:39 PM, Duncan P. N. Exon Smith wrote:
>
> On 2014 Mar 2, at 04:02, Tobias Grosser <tobias at grosser.es> wrote:
>
>> Author: grosser
>> Date: Sun Mar  2 06:02:46 2014
>> New Revision: 202634
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=202634&view=rev
>> Log:
>> C++11: Use foreach in ScopDetection
>>
>> Modified:
>>     polly/trunk/lib/Analysis/ScopDetection.cpp
>>
>> Modified: polly/trunk/lib/Analysis/ScopDetection.cpp
>> URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/Analysis/ScopDetection.cpp?rev=202634&r1=202633&r2=202634&view=diff
>> ==============================================================================
>> --- polly/trunk/lib/Analysis/ScopDetection.cpp (original)
>> +++ polly/trunk/lib/Analysis/ScopDetection.cpp Sun Mar  2 06:02:46 2014
>> @@ -332,8 +332,8 @@ std::string ScopDetection::formatInvalid
>>
>>    std::vector<Value *> Pointers;
>>
>> -  for (AliasSet::iterator AI = AS.begin(), AE = AS.end(); AI != AE; ++AI)
>> -    Pointers.push_back(AI.getPointer());
>> +  for (auto I: AS)
>> +    Pointers.push_back(I.getValue());
>
> This should probably be:
>
>      for (const auto &I: AS)
>        Pointers.push_back(I.getValue())
>
> There’s no reason to copy PointerRec here, and the ‘const’ makes clear
> that you’re not modifying the original.

Good point. I made most of the foreachs 'const auto &' in commit r202651.

Thanks for the review,
Tobias



More information about the llvm-commits mailing list