[llvm] r249480 - IR: Use auto for iterators, NFC

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 15:41:05 PDT 2015


On Tue, Oct 6, 2015 at 3:37 PM, Duncan P. N. Exon Smith via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: dexonsmith
> Date: Tue Oct  6 17:37:47 2015
> New Revision: 249480
>
> URL: http://llvm.org/viewvc/llvm-project?rev=249480&view=rev
> Log:
> IR: Use auto for iterators, NFC
>
> Modified:
>     llvm/trunk/lib/IR/SymbolTableListTraitsImpl.h
>
> Modified: llvm/trunk/lib/IR/SymbolTableListTraitsImpl.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/SymbolTableListTraitsImpl.h?rev=249480&r1=249479&r2=249480&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/IR/SymbolTableListTraitsImpl.h (original)
> +++ llvm/trunk/lib/IR/SymbolTableListTraitsImpl.h Tue Oct  6 17:37:47 2015
> @@ -46,16 +46,14 @@ void SymbolTableListTraits<ValueSubClass
>
>    if (OldST) {
>      // Remove all entries from the previous symtab.
> -    for (typename iplist<ValueSubClass>::iterator I = ItemList.begin();
> -         I != ItemList.end(); ++I)
> +    for (auto I = ItemList.begin(); I != ItemList.end(); ++I)
>

Is there a reason not to range-for these? (does 'end' need to be
re-evaluated on every iteration (things being added/removed during the
iteration?))


>        if (I->hasName())
>          OldST->removeValueName(I->getValueName());
>    }
>
>    if (NewST) {
>      // Add all of the items to the new symtab.
> -    for (typename iplist<ValueSubClass>::iterator I = ItemList.begin();
> -         I != ItemList.end(); ++I)
> +    for (auto I = ItemList.begin(); I != ItemList.end(); ++I)
>        if (I->hasName())
>          NewST->reinsertValue(I);
>    }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151006/06e4ac62/attachment.html>


More information about the llvm-commits mailing list